{"id":13527040,"url":"https://github.com/tc39/proposal-array-filtering","last_synced_at":"2025-04-15T10:29:30.106Z","repository":{"id":48574258,"uuid":"217193089","full_name":"tc39/proposal-array-filtering","owner":"tc39","description":"A proposal to make filtering arrays easier","archived":false,"fork":false,"pushed_at":"2021-07-20T00:34:17.000Z","size":75,"stargazers_count":175,"open_issues_count":9,"forks_count":5,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-28T19:12:37.223Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://tc39.es/proposal-array-filtering/","language":"HTML","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/tc39.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-10-24T02:19:41.000Z","updated_at":"2025-01-06T10:07:45.000Z","dependencies_parsed_at":"2022-09-04T09:00:34.224Z","dependency_job_id":null,"html_url":"https://github.com/tc39/proposal-array-filtering","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/tc39%2Fproposal-array-filtering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tc39%2Fproposal-array-filtering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tc39%2Fproposal-array-filtering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tc39%2Fproposal-array-filtering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tc39","download_url":"https://codeload.github.com/tc39/proposal-array-filtering/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249051204,"owners_count":21204777,"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":[],"created_at":"2024-08-01T06:01:39.737Z","updated_at":"2025-04-15T10:29:30.085Z","avatar_url":"https://github.com/tc39.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"# proposal-array-filtering\n\nA proposal to add `Array.prototype.filterReject`.\n\n```js\nconst array = [1, 2, 3, 4, 5];\n\n// filter keeps the items that return true.\narray.filter(i =\u003e (i \u003c 3)); // =\u003e [1, 2];\n\n// filterReject removes the items that return true.\narray.filterReject(i =\u003e (i \u003c 3)); // =\u003e [3, 4, 5];\n```\n\n## Champions\n\n- Justin Ridgewell ([@jridgewell](https://github.com/jridgewell/))\n\n## Status\n\nCurrent [Stage](https://tc39.es/process-document/): 1\n\n## Motivation\n\n`Array.p.filter` is confusing. I constantly have to ask myself \"am I\nkeeping, or filtering out the current item?\".\n\n\u003cdl\u003e\n  \u003cdt\u003e\"Keeping\"\u003c/dt\u003e\n  \u003cdd\u003e\n\n  Implies that returning `true` would keep the current item.\n\n  \u003c/dd\u003e\n\n  \u003cdt\u003e\"Filtering out\"\u003c/dt\u003e\n  \u003cdd\u003e\n\n  Implies that returning `true` would remove the current item.\n\n  \u003c/dd\u003e\n\u003c/dl\u003e\n\n`Array.p.filter` acts as \"keeping\". But when I think of the word\n\"filter\", I think of \"filtering out\". So every time that I attempt to\nwrite an array filter, I end up writing the opposite of what I intended.\n\n`Array.p.filterReject` attempts to fix this confusion. By providing a\nclearly named filtering function that matches my intuition, I'm able\nwhat will happen when calling `filterReject`. And because it exists, I'm\nable to assume that `filter` does something different, so it must be\n\"keep\" version.\n\n## Polyfill\n\nA polyfill is available in the [core-js](https://github.com/zloirock/core-js) library. You can find it in the [ECMAScript proposals section](https://github.com/zloirock/core-js#array-filtering).\n\n## Ongoing Discussions\n\n- [Supporting Data from HTTP Archive and GitHub Archive](https://github.com/jridgewell/proposal-array-filtering/issues/4)\n- [What should `filterOut` be called?](https://github.com/jridgewell/proposal-array-filtering/issues/6)\n- [Should `partition` be included?](https://github.com/jridgewell/proposal-array-filtering/issues/2)\n\n## Related\n\n- Ruby\n  - [`Array#select`](https://ruby-doc.org/core-2.4.1/Array.html#method-i-select)\n  - [`Array#reject`](https://ruby-doc.org/core-2.4.1/Array.html#method-i-reject)\n  - [`Array#partition`](https://ruby-doc.org/core-2.5.1/Enumerable.html#method-i-partition)\n- Underscore\n  - [`_.select`](https://underscorejs.org/#filter) (aliased to _.filter)\n  - [`_.reject`](https://underscorejs.org/#reject)\n  - [`_.partition`](https://underscorejs.org/#partition)\n- Lodash\n  - [`_.reject`](https://lodash.com/docs/4.17.15#reject) ([700k downloads/week](https://www.npmjs.com/package/lodash.reject))\n  - [`_.partition`](https://lodash.com/docs/4.17.15#partition) ([18k downloads/week](https://www.npmjs.com/package/lodash.partition))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftc39%2Fproposal-array-filtering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftc39%2Fproposal-array-filtering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftc39%2Fproposal-array-filtering/lists"}