{"id":31425031,"url":"https://github.com/es-shims/array.prototype.unshift","last_synced_at":"2026-01-20T16:43:22.351Z","repository":{"id":57700744,"uuid":"495913418","full_name":"es-shims/Array.prototype.unshift","owner":"es-shims","description":"ES spec-compliant Array.prototype.unshift shim/polyfill/replacement that works as far down as ES3","archived":false,"fork":false,"pushed_at":"2024-12-20T17:04:30.000Z","size":74,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-29T17:52:05.258Z","etag":null,"topics":["array","ecmascript","es-shims","javascript","polyfill","shim","unshift"],"latest_commit_sha":null,"homepage":"","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":"2022-05-24T16:57:01.000Z","updated_at":"2024-12-20T17:04:34.000Z","dependencies_parsed_at":"2023-01-21T12:17:21.048Z","dependency_job_id":"b522ce1d-cefa-4676-896d-845243bd7157","html_url":"https://github.com/es-shims/Array.prototype.unshift","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"93439aa38c9bb11633e80517d51779cdf249bebf"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/es-shims/Array.prototype.unshift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.unshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.unshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.unshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.unshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/es-shims","download_url":"https://codeload.github.com/es-shims/Array.prototype.unshift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.unshift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277632369,"owners_count":25850734,"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","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ecmascript","es-shims","javascript","polyfill","shim","unshift"],"created_at":"2025-09-30T04:54:54.490Z","updated_at":"2025-09-30T04:54:59.134Z","avatar_url":"https://github.com/es-shims.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ljharb","https://tidelift.com/funding/github/npm/es5-shim"],"categories":[],"sub_categories":[],"readme":"# array.prototype.unshift \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[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nAn ES spec-compliant `Array.prototype.unshift` 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 [spec](https://tc39.es/ecma262/#sec-array.prototype.unshift).\n\nBecause `Array.prototype.unshift` depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.\n\n## Engines where this is needed\n\nNote: this list is not exhaustive.\n\n  - Safari 10 - 13\n  - Chrome 48+ ([v8 bug](https://bugs.chromium.org/p/v8/issues/detail?id=10381))\n  - node 6+\n\n## Example\n\n```js\nvar unshift = require('array.prototype.unshift');\nvar assert = require('assert');\n\nvar a = [1, 1, 1];\nassert.deepEqual(unshift(a, 1, 2), 5);\nassert.deepEqual(a, [1, 2, 1, 1, 1]);\n```\n\n```js\nvar unshift = require('array.prototype.unshift');\nvar assert = require('assert');\n/* when Array#unshift is not present */\ndelete Array.prototype.unshift;\nvar shimmed = unshift.shim();\nassert.equal(shimmed, unshift.getPolyfill());\nassert.equal(shimmed, Array.prototype.unshift);\nassert.deepEqual([1, 2, 3].unshift(1, 2, 3), unshift([1, 2, 3], 1, 2, 3));\n```\n\n```js\nvar unshift = require('array.prototype.unshift');\nvar assert = require('assert');\n/* when Array#unshift is present */\nvar shimmed = unshift.shim();\nassert.equal(shimmed, Array.prototype.unshift);\nassert.deepEqual([1, 2, 3].unshift(1, 2, 3), unshift([1, 2, 3], 1, 2, 3));\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/array.prototype.unshift\n[npm-version-svg]: https://versionbadg.es/es-shims/Array.prototype.unshift.svg\n[deps-svg]: https://david-dm.org/es-shims/Array.prototype.unshift.svg\n[deps-url]: https://david-dm.org/es-shims/Array.prototype.unshift\n[dev-deps-svg]: https://david-dm.org/es-shims/Array.prototype.unshift/dev-status.svg\n[dev-deps-url]: https://david-dm.org/es-shims/Array.prototype.unshift#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/array.prototype.unshift.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/array.prototype.unshift.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/array.prototype.unshift.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=array.prototype.unshift\n[codecov-image]: https://codecov.io/gh/es-shims/Array.prototype.unshift/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/es-shims/Array.prototype.unshift/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Array.prototype.unshift\n[actions-url]: https://github.com/es-shims/Array.prototype.unshift/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Farray.prototype.unshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fes-shims%2Farray.prototype.unshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Farray.prototype.unshift/lists"}