{"id":13772272,"url":"https://github.com/es-shims/array-includes","last_synced_at":"2025-04-05T04:12:46.557Z","repository":{"id":25325998,"uuid":"28753032","full_name":"es-shims/array-includes","owner":"es-shims","description":"Array.prototype.includes spec-compliant polyfill","archived":false,"fork":false,"pushed_at":"2024-03-20T20:47:27.000Z","size":201,"stargazers_count":43,"open_issues_count":1,"forks_count":12,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T03:07:45.147Z","etag":null,"topics":["array","contains","ecmascript","includes","javascript","polyfill","shim"],"latest_commit_sha":null,"homepage":"https://tc39.github.io/ecma262/#sec-array.prototype.includes","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/es-shims.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/es5-shim","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2015-01-03T19:50:23.000Z","updated_at":"2024-09-12T22:32:43.000Z","dependencies_parsed_at":"2024-02-12T04:36:06.975Z","dependency_job_id":"634fa63b-147c-4980-bcb8-a76b5990712c","html_url":"https://github.com/es-shims/array-includes","commit_stats":{"total_commits":217,"total_committers":3,"mean_commits":72.33333333333333,"dds":0.009216589861751112,"last_synced_commit":"4b1922ef553490e4b28008f5d0b0b629122fb04b"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2Farray-includes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2Farray-includes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2Farray-includes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2Farray-includes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/es-shims","download_url":"https://codeload.github.com/es-shims/array-includes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284951,"owners_count":20913704,"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","contains","ecmascript","includes","javascript","polyfill","shim"],"created_at":"2024-08-03T17:01:02.067Z","updated_at":"2025-04-05T04:12:46.521Z","avatar_url":"https://github.com/es-shims.png","language":"JavaScript","readme":"# array-includes \u003csup\u003e[![Version Badge][npm-version-svg]][package-url]\u003c/sup\u003e\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![dependency status][deps-svg]][deps-url]\n[![dev dependency status][dev-deps-svg]][dev-deps-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nAn ES7/ES2016 spec-compliant `Array.prototype.includes` shim/polyfill/replacement that works as far down as ES3.\n\nThis package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the proposed [spec](https://262.ecma-international.org/6.0/).\n\nBecause `Array.prototype.includes` depends on a receiver (the `this` value), the main export takes the array to operate on as the first argument.\n\nEngines that need this package include:\n - IE (all versions)\n - Safari \u003c 9\n - Firefox \u003c 43, and 99-101\n - Chrome \u003c 47\n - Edge \u003c 14\n - node \u003c 6\n\n## Getting started\n\n```sh\nnpm install --save array-includes\n```\n\n## Usage\n\nBasic usage: **includes(array, value[, fromIndex=0])**\n\n```js\nvar includes = require('array-includes');\nvar assert = require('assert');\nvar arr = [ 'one', 'two' ];\n\nincludes(arr, 'one'); // true\nincludes(arr, 'three'); // false\nincludes(arr, 'one', 1); // false\n```\n\n\n\n## Example\n\n```js\nvar arr = [\n\t1,\n\t'foo',\n\tNaN,\n\t-0\n];\n\nassert.equal(arr.indexOf(0) \u003e -1, true);\nassert.equal(arr.indexOf(-0) \u003e -1, true);\nassert.equal(includes(arr, 0), true);\nassert.equal(includes(arr, -0), true);\n\nassert.equal(arr.indexOf(NaN) \u003e -1, false);\nassert.equal(includes(arr, NaN), true);\n\nassert.equal(includes(arr, 'foo', 0), true);\nassert.equal(includes(arr, 'foo', 1), true);\nassert.equal(includes(arr, 'foo', 2), false);\n```\n\n```js\n/* when Array#includes is not present */\ndelete Array.prototype.includes;\nvar shimmedIncludes = includes.shim();\n\nassert.equal(shimmedIncludes, includes.getPolyfill());\nassert.equal(arr.includes('foo', 1), includes(arr, 'foo', 1));\n```\n\n```js\n/* when Array#includes is present */\nvar shimmedIncludes = includes.shim();\n\nassert.equal(shimmedIncludes, Array.prototype.includes);\nassert.equal(arr.includes(1, 'foo'), includes(arr, 1, 'foo'));\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/array-includes\n[npm-version-svg]: https://versionbadg.es/es-shims/array-includes.svg\n[deps-svg]: https://david-dm.org/es-shims/array-includes.svg\n[deps-url]: https://david-dm.org/es-shims/array-includes\n[dev-deps-svg]: https://david-dm.org/es-shims/array-includes/dev-status.svg\n[dev-deps-url]: https://david-dm.org/es-shims/array-includes#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/array-includes.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/array-includes.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/array-includes.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=array-includes\n[codecov-image]: https://codecov.io/gh/es-shims/array-includes/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/es-shims/array-includes/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/array-includes\n[actions-url]: https://github.com/es-shims/array-includes/actions\n","funding_links":["https://github.com/sponsors/ljharb","https://tidelift.com/funding/github/npm/es5-shim"],"categories":["JavaScript","Arrays"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Farray-includes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fes-shims%2Farray-includes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Farray-includes/lists"}