{"id":45212390,"url":"https://github.com/oaxoa/fp-filters","last_synced_at":"2026-02-20T16:36:21.850Z","repository":{"id":185376279,"uuid":"656157926","full_name":"Oaxoa/fp-filters","owner":"Oaxoa","description":"A curated list of ready-to-use (functional programming) array filters (TS / ESM / CJS)","archived":false,"fork":false,"pushed_at":"2025-09-11T07:09:11.000Z","size":2156,"stargazers_count":86,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-20T03:20:51.104Z","etag":null,"topics":["array-filters","filter","filtering","filters","fp","functional-programming","predicates"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Oaxoa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-06-20T11:16:28.000Z","updated_at":"2025-11-09T11:28:14.000Z","dependencies_parsed_at":"2023-09-24T17:58:47.106Z","dependency_job_id":"890a417e-f617-4fe7-ba1f-a75f7b4ebc2b","html_url":"https://github.com/Oaxoa/fp-filters","commit_stats":{"total_commits":80,"total_committers":3,"mean_commits":"26.666666666666668","dds":0.08750000000000002,"last_synced_commit":"13e54af3d849254876bbbeeb01d3f4794a9bbe59"},"previous_names":["oaxoa/fp-filters"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/Oaxoa/fp-filters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaxoa%2Ffp-filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaxoa%2Ffp-filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaxoa%2Ffp-filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaxoa%2Ffp-filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oaxoa","download_url":"https://codeload.github.com/Oaxoa/fp-filters/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oaxoa%2Ffp-filters/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29657088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-filters","filter","filtering","filters","fp","functional-programming","predicates"],"created_at":"2026-02-20T16:36:21.278Z","updated_at":"2026-02-20T16:36:21.846Z","avatar_url":"https://github.com/Oaxoa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"assets/logo.png\" alt=\"\" height=\"320\" /\u003e\n\n# fp-filters\n\n[![Build Status](https://github.com/oaxoa/fp-filters/actions/workflows/build.yml/badge.svg)](https://github.com/oaxoa/fp-filters/actions/workflows/build.yml) [![codecov](https://codecov.io/gh/Oaxoa/fp-filters/branch/master/graph/badge.svg)](https://codecov.io/gh/Oaxoa/fp-filters)\n\nA curated collection of 130+ common-use filter functions that are written (and can be used) in a functional programming\nstyle.\n\n- GitHub: https://github.com/Oaxoa/fp-filters\n- NPM: https://www.npmjs.com/package/fp-filters\n- Docs: https://oaxoa.github.io/fp-filters/\n\n## 🧠 How is this helpful?\n\n_fp-filters_ allows you to stop rewriting the same code over and over again and greatly improves readability.\nSo that you will probably never write another filter function 🚀!\n\n## Import\n\nAll the functions are grouped by semantics and individually exported.\nE.g.:\n\n```js\n// ...\nimport { isEven } from 'fp-filters/number/isEven.js';\nimport { is } from 'fp-filters/misc/is.js';\nimport { isTrue } from 'fp-filters/boolean/isTrue.js';\nimport { isPastDate } from 'fp-filters/date/isPastDate.js';\nimport { hasProps } from 'fp-filters/object/hasProps.js';\n// ...\n```\n\nTherefore, they must be individually imported.\nNo barrel files or entry points guarantees that you will not import what you don't use.\n\n## 🔎 Examples\n\nA few random examples of the 130+ functions available in _fp-filters_. Grouped by semantic.\nSee full docs here: [https://oaxoa.github.io/fp-filters/](https://oaxoa.github.io/fp-filters/)\n\n### Booleans\n\n```js\n// without fp-filters\narray.filter((arg) =\u003e arg === true);\n// with fp-filters\narray.filter(isTrue);\n```\n\n### Dates\n\n```js\n// without fp-filters\ndates.filter((date) =\u003e {\n  const day = date.getDay();\n  return day === 0 || day === 6;\n});\n// with fp-filters\ndates.filter(isWeekend);\n```\n\n### Lengths\n\n```js\n// without fp-filters\narray.filter((arg) =\u003e arg.length \u003e 0);\n// with fp-filters\narray.filter(isNotEmpty);\n```\n\n### Misc\n\n```js\n// without fp-filters\nids.filter((id) =\u003e id === currentUserId);\n// with fp-filters\nids.filter(is(currentUserId));\n```\n\n### Numbers\n\n```js\n// without fp-filters\nscores.filter((value) =\u003e value !== 0);\n// with fp-filters\nscores.filter(isNotZero);\n```\n\n```js\n// without fp-filters\narray.filter((arg) =\u003e arg % 2 === 0);\n// with fp-filters\narray.filter(isEven);\n```\n\n```js\n// without fp-filters\narray.filter((arg) =\u003e arg \u003e= 10 \u0026\u0026 arg \u003c= 50);\n// with fp-filters\narray.filter(isBetween(10, 50));\n```\n\n### Objects\n\n```js\n// without fp-filters\nproducts.filter((obj) =\u003e obj.id !== undefined \u0026\u0026 obj.plu !== undefined);\n// with fp-filters\nproducts.filter(hasProps(['id', 'plu']));\n```\n\n```js\n// without fp-filters\nproducts.find((obj) =\u003e obj.country === countryId \u0026\u0026 obj.plu === plu);\n// with fp-filters\nproducts.find(hasProps(['country', 'plu'], [countryId, plu]));\n```\n\n```js\n// without fp-filters\narray.filter((obj) =\u003e obj.id === someOtherObj.id \u0026\u0026 obj.brand === someOtherObj.brand);\n// with fp-filters\narray.filter(hasSameProps(someOtherObj, ['id', 'brand']));\n```\n\n### Positions\n\n```js\n// without fp-filters\narray.filter((arg, index) =\u003e index % 3 === 1 || index % 3 === 2);\n// with fp-filters\narray.filter(pattern(false, true, true));\n```\n\n```js\n// without fp-filters\narray.filter((arg, index) =\u003e index % 3 === 1);\n// with fp-filters\narray.filter(isEveryNthIndex(3, 1));\n```\n\n### Strings\n\n```js\n// without fp-filters\narray.filter((arg) =\u003e arg === '');\n// with fp-filters\narray.filter(isEmptyString);\n```\n\n```js\n// without fp-filters\narray.filter((arg: string) =\u003e {\n  for (let i = 0; i \u003c arg.length / 2; i++) {\n    if (arg[i] !== arg[arg.length - i - 1]) {\n      return false;\n    }\n  }\n  return true;\n});\n// with fp-filters\narray.filter(isPalindrome);\n```\n\n### Types\n\n```js\n// without fp-filters\narray.filter((arg) =\u003e arg !== undefined);\n// with fp-filters\narray.filter(isNotUndefined);\n```\n\n```js\n// without fp-filters\narray.filter((arg) =\u003e typeof arg === 'boolean');\n// with fp-filters\narray.filter(isBoolean);\n// do not be tricked by `array.filter(Boolean);`. It is different as \n// it casts the content and then evaluate its truthyness\n```\n\n### Arrays\n\n```js\nconst input = [[1, 2, 3], [2, 4], [0, 4, 8, 16]];\n// without fp-filters\ninput.filter((array) =\u003e array.every((element) =\u003e element % 2 === 0));\n// with fp-filters\ninput.filter(everyElement(isEven))\n```\n\n## ❗ Negate or 🧩 combine filters\n\nMost of the functions include aliases for their negated versions (\nusing [fp-booleans](https://npmjs.org/package/fp-booleans)):\n\n```js\n// E.g.: \narray.filter(is(5))\narray.filter(isNot(5))\n\narray.filter(isBetween(5, 10))\narray.filter(isNotBetween(5, 10))\n\narray.filter(isEmpty)\narray.filter(isNotEmpty)\n\narray.filter(isInstanceOf(SomeClass));\narray.filter(isNotInstanceOf(SomeClass));\n```\n\nbut **you can make your own**.\n\n\u003e _fp-filters_ leaverages _fp-booleans_'s very powerful functions to combine or negate functions\n\nsome examples:\n\n```js\nimport { not, and, or } from 'fp-booleans';\n\nconst isNot = not(is);\narray.filter(isNot(5));\n\nconst canBeDiscounted = (minPrice) =\u003e and(isGreaterOrEqualTo(minPrice), not(isRound));\narray.filter(canBeDiscounted(10));\n\nconst isValidAdmin = or(is('admin'), and(startsWith('user_'), isLowerCase))\narray.filter(isValidAdmin);\n```\n\n## 🧑🏼‍💻 Coding style\n\nfp-filters functions are predicates. Just like array filters are.\nThey get arguments and return a boolean.\nThey can be used as such. But they shine when used as filters.\n\nfp-filters functions are:\n\n### ✨ Pure\n\nAll are pure. Some are higher-order and unlocks the power of partial application in filters.\n\n### 🤏🏼 Tiny\n\nMost are one-liners. The longest is ~10 lines.\n\n### 🧱 Composable\n\nHigher-order predicates and fp-booleans unleash quite some power\n\n### 🪆 Zero-ish dependencies\n\nMost of them have zero deps. Some of them have 1 dependency on fp-booleans (that has zero deps).\nNo surprises.\n\n### 🍃 More than tree-shakeable.\n\nNo barrel files, or entry points.\n\nYou import and bundle only what you use. No way to mess it up.\n\nIf you use one function only, that's what goes in your bundle. The cost of it is in bytes.\n\n\u003e Just as it would cost to write the function yourself. But with free 100% coverage testing, types, docs and no risk of\n\u003e duplicated code.\n\n### 🗂️ Grouped semantically\n\nFunctions for numbers, functions for strings, you get the point.\nSo you will always intuitively know where to find the one you need.\n\n### ✅ 100% tested by design\n\nYes, all of them are tested. Every branch, every line.\n130+ stable unit tests running in less than 1s.\n\n\u003e Functions that are partial applications of other 100% tested functions (from fp-filters or fp-booleans) are\n\u003e not tested. On purpose.\n\n### ✏️ Typescript typed\n\nAll functions are fully typed. No `any` type, some `unknown`. Working on it. Help is appreciated ❤️.\n\n## 🚀 Getting started\n\n### 💻 Installation\n\nfp-filters runs on Node.js and is available as a NPM package.\n\n```bash\nnpm install --save fp-filters\n```\n\nor\n\n```bash\nyarn add fp-filters\n```\n\n## 🤝 Contributions\n\n1. [Coding style](#%F0%9F%A7%91%F0%9F%8F%BC%F0%9F%92%BB-coding-style)\n1. [Contributing guide](CONTRIBUTING.md)\n1. [Code of Conduct](CODE_OF_CONDUCT.md)\n\n## 📜 License \u0026 Copyrights\n\n[MIT](https://opensource.org/licenses/MIT)\n\nCopyright (c) 2023-present, Pierluigi Pesenti (Oaxoa)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foaxoa%2Ffp-filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foaxoa%2Ffp-filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foaxoa%2Ffp-filters/lists"}