{"id":27944922,"url":"https://github.com/es-shims/array.prototype.flatmap","last_synced_at":"2025-05-07T12:55:15.433Z","repository":{"id":56253517,"uuid":"105318718","full_name":"es-shims/Array.prototype.flatMap","owner":"es-shims","description":"An ESnext spec-compliant `Array.prototype.flatMap` shim/polyfill/replacement that works as far down as ES3.","archived":false,"fork":false,"pushed_at":"2024-12-16T00:45:20.000Z","size":149,"stargazers_count":32,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-07T12:55:06.023Z","etag":null,"topics":["array","ecmascript","flatmap","javascript","polyfill","shim"],"latest_commit_sha":null,"homepage":"https://tc39.github.io/proposal-flatMap/","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":"2017-09-29T21:28:57.000Z","updated_at":"2024-12-16T00:45:24.000Z","dependencies_parsed_at":"2024-02-02T21:24:46.584Z","dependency_job_id":"a0204626-4f8b-4afd-b7e4-06b4080b06ca","html_url":"https://github.com/es-shims/Array.prototype.flatMap","commit_stats":{"total_commits":96,"total_committers":1,"mean_commits":96.0,"dds":0.0,"last_synced_commit":"b3698fb2320992f5ab85a486d1adef0105f739aa"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.flatMap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.flatMap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.flatMap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/es-shims%2FArray.prototype.flatMap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/es-shims","download_url":"https://codeload.github.com/es-shims/Array.prototype.flatMap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252882789,"owners_count":21819155,"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","ecmascript","flatmap","javascript","polyfill","shim"],"created_at":"2025-05-07T12:55:14.388Z","updated_at":"2025-05-07T12:55:15.425Z","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.flatmap \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 ES2019 spec-compliant `Array.prototype.flatMap` 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.flatmap).\n\nBecause `Array.prototype.flatMap` depends on a receiver (the `this` value), the main export takes the array to operate on as the first argument.\n\n## Getting started\n\n```sh\nnpm install --save array.prototype.flatmap\n```\n\n## Usage/Examples\n\n```js\nvar flatMap = require('array.prototype.flatmap');\nvar assert = require('assert');\n\nvar arr = [1, [2], [], 3];\n\nvar results = flatMap(arr, function (x, i) {\n\tassert.equal(x, arr[i]);\n\treturn x;\n});\n\nassert.deepEqual(results, [1, 2, 3]);\n```\n\n```js\nvar flatMap = require('array.prototype.flatmap');\nvar assert = require('assert');\n/* when Array#flatMap is not present */\ndelete Array.prototype.flatMap;\nvar shimmedFlatMap = flatMap.shim();\n\nvar mapper = function (x) { return [x, 1]; };\n\nassert.equal(shimmedFlatMap, flatMap.getPolyfill());\nassert.deepEqual(arr.flatMap(mapper), flatMap(arr, mapper));\n```\n\n```js\nvar flatMap = require('array.prototype.flatmap');\nvar assert = require('assert');\n/* when Array#flatMap is present */\nvar shimmedIncludes = flatMap.shim();\n\nvar mapper = function (x) { return [x, 1]; };\n\nassert.equal(shimmedIncludes, Array.prototype.flatMap);\nassert.deepEqual(arr.flatMap(mapper), flatMap(arr, mapper));\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/array.prototype.flatmap\n[npm-version-svg]: https://versionbadg.es/es-shims/Array.prototype.flatMap.svg\n[deps-svg]: https://david-dm.org/es-shims/Array.prototype.flatMap.svg\n[deps-url]: https://david-dm.org/es-shims/Array.prototype.flatMap\n[dev-deps-svg]: https://david-dm.org/es-shims/Array.prototype.flatMap/dev-status.svg\n[dev-deps-url]: https://david-dm.org/es-shims/Array.prototype.flatMap#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/array.prototype.flatmap.png?downloads=true\u0026stars=true\n[license-image]: https://img.shields.io/npm/l/array.prototype.flatmap.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/array.prototype.flatmap.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=array.prototype.flatmap\n[codecov-image]: https://codecov.io/gh/es-shims/Array.prototype.flatMap/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/es-shims/Array.prototype.flatMap/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Array.prototype.flatMap\n[actions-url]: https://github.com/es-shims/Array.prototype.flatMap/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Farray.prototype.flatmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fes-shims%2Farray.prototype.flatmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fes-shims%2Farray.prototype.flatmap/lists"}