{"id":19042017,"url":"https://github.com/writetome51/error-if-index-not-valid","last_synced_at":"2026-06-17T18:33:29.748Z","repository":{"id":57226749,"uuid":"178620269","full_name":"writetome51/error-if-index-not-valid","owner":"writetome51","description":"Function triggers error if a given index cannot exist in a given array length","archived":false,"fork":false,"pushed_at":"2020-07-30T23:38:23.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T04:29:35.058Z","etag":null,"topics":["array","error","index","javascript","valid","validation"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/writetome51.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-30T23:06:06.000Z","updated_at":"2020-07-30T23:38:25.000Z","dependencies_parsed_at":"2022-08-24T15:51:12.771Z","dependency_job_id":null,"html_url":"https://github.com/writetome51/error-if-index-not-valid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Ferror-if-index-not-valid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Ferror-if-index-not-valid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Ferror-if-index-not-valid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Ferror-if-index-not-valid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/writetome51","download_url":"https://codeload.github.com/writetome51/error-if-index-not-valid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240100512,"owners_count":19747683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","error","index","javascript","valid","validation"],"created_at":"2024-11-08T22:33:57.256Z","updated_at":"2026-05-08T19:30:17.932Z","avatar_url":"https://github.com/writetome51.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# errorIfIndexNotValid(\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;index,\u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;arrayLength\u003cbr\u003e): void\n\nTriggers error if `index` cannot exist in `arrayLength`.  \n`index` is allowed to be negative.\n\n## Examples\n```\nerrorIfIndexNotValid(1, 2); // No error.\n\nerrorIfIndexNotValid(2, 2);\n// \"Error:  The entered index is not valid.  Whether positive or negative,\n// it exceeds the index range of the array.\"\n\nerrorIfIndexNotValid(-2, 2); // No error.\n\nerrorIfIndexNotValid(-3, 2);\n// \"Error:  The entered index is not valid.  Whether positive or negative,\n// it exceeds the index range of the array.\"\n\nerrorIfIndexNotValid(1, 1);\n// \"Error:  The entered index is not valid.  Whether positive or negative,\n// it exceeds the index range of the array.\"\n```\n\n## Installation\n`npm i  error-if-index-not-valid`\n\n## Loading\n```js\nimport { errorIfIndexNotValid } from 'error-if-index-not-valid';\n```\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Ferror-if-index-not-valid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwritetome51%2Ferror-if-index-not-valid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Ferror-if-index-not-valid/lists"}