{"id":18627286,"url":"https://github.com/itsnickbarry/is-array-index","last_synced_at":"2026-02-18T00:32:09.744Z","repository":{"id":57276946,"uuid":"168271634","full_name":"ItsNickBarry/is-array-index","owner":"ItsNickBarry","description":"Test whether an input is a valid Array index 🗂️","archived":false,"fork":false,"pushed_at":"2025-02-19T19:30:11.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-03T00:03:26.780Z","etag":null,"topics":["array","index","isarrayindex","numeral","wow"],"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/ItsNickBarry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-30T03:17:42.000Z","updated_at":"2025-02-19T19:30:08.000Z","dependencies_parsed_at":"2024-07-13T11:30:54.624Z","dependency_job_id":"9843e023-f481-4454-9d7c-fea994d586b4","html_url":"https://github.com/ItsNickBarry/is-array-index","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ItsNickBarry/is-array-index","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fis-array-index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fis-array-index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fis-array-index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fis-array-index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItsNickBarry","download_url":"https://codeload.github.com/ItsNickBarry/is-array-index/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fis-array-index/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265156424,"owners_count":23719714,"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","index","isarrayindex","numeral","wow"],"created_at":"2024-11-07T04:41:49.237Z","updated_at":"2026-02-18T00:32:09.694Z","avatar_url":"https://github.com/ItsNickBarry.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# isArrayIndex\n\nUtility for determining whether an input is a valid Array index.\n\n## Usage\n\nInstall the library:\n\n```\nnpm install --save is-array-index\n```\n\nThe module contains a single function, which takes a possible Array index as an argument and returns whether it is valid:\n\n```javascript\nlet isArrayIndex = require('is-array-index');\n\nisArrayIndex(0);\n// =\u003e true\n\nisArrayIndex('1');\n// =\u003e true\n\nisArrayIndex('1.0');\n// =\u003e false\n\nisArrayIndex(0.5);\n// =\u003e false\n```\n\nIn some cases, it may make sense to allow for Array indices which exceed the maximum length of an array, but still satisfy the semantic requirements.  This may be achieved by passing a second argument, a `boolean` indicating whether to unrestrict the theoretical length of an array.  See the [Phonewords](https://github.com/itsnickbarry/phonewords) library for an example.\n\n```javascript\nconst MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1;\n\nisArrayIndex(MAX_ARRAY_LENGTH);\n// =\u003e false\n\nisArrayIndex(MAX_ARRAY_LENGTH, true);\n// =\u003e true\n\nisArrayIndex(Number.MAX_SAFE_INTEGER, true);\n// =\u003e true\n```\n\n### Proxy Example\n\nA `Proxy` wrapped around an `Array` might need to distinguish between array indexing and the accessing of additional properties.\n\n```javascript\nlet proxy = new Proxy([], {\n  get: function (target, property) {\n    if (isArrayIndex(property)) {\n      // execute additional processing\n      return true;\n    } else {\n      return target[property];\n    }\n  },\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsnickbarry%2Fis-array-index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsnickbarry%2Fis-array-index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsnickbarry%2Fis-array-index/lists"}