Fp

Fp-filters – A curated collection of TS/JS array filter functions

Hacker News

Fp-filters – A curated collection of TS/JS array filter functions

Hello HN, I wanted to share a library I've been working on called: fp-filters - A curated collection of 130+ common-use filter functions that are written (and can be used) in a functional programming style. Why I built this: I have noticed in several codebases the tendency to keep writing the same or similar filter functions over and over again. Often inlined, taxing readability. And realized that most of them do pretty much the same N things. Therefore they could be isolated, curated, and maintained separately. fp-filters provides 130+ composable, point-free filtering functions that make data transformation pipelines more readable and maintainable. All functions are predicates and can be used as such, but they shine when used as filters. Key features: 1. Pure functional approach with no side effects 2. Composable predicates (and, or, not combinators through fp-booleans) 3. Common filter patterns as reusable functions 4. Type safety with TypeScript definitions 5. Exported as both esm and cjs 6. Zero dependencies, tiny footprint 7. Individual exports. Tree shaking is not even needed. 8. 100% test coverage Example usage: const input = [[1, 2, 3], [2, 4], [0, 4, 8, 16]]; // JS input.filter((array) => array.every((element) => element % 2 === 0)); // fp-filters input.filter(everyElement(isEven)) // JS dates.filter((date) => { const day = date.getDay(); return day === 0 || day === 6; }); // fp-filters dates.filter(isWeekend); // JS array.filter((arg) => arg.length > 0); // fp-filters array.filter(isNotEmpty); What makes this different: Unlike lodash/fp or ramda, fp-filters focuses specifically on array filtering patterns with an emphasis on readability in complex data transformations. It's designed to be intuitive for developers already familiar with JavaScript's array methods while providing the benefits of functional composition. The project is MIT licensed and open to contributions. I'd love to hear feedback from the HN community. Links: npm: https://www.npmjs.com/package/fp-filters GitHub: https://github.com/Oaxoa/fp-filters Documentation: https://oaxoa.github.io/fp-filters Thanks for checking it out

Share card

Actual performance

11points
1comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: para · Missing: supports, reddit linkedin, podcasting
81%81% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Hacker NewsStrong engagement from HN community · Strong signals: ide, pipe, io · Missing: https docs, excited, just released
62%62% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Product HuntOn track for Day 1 leaderboard · Strong signals: tiny, code, open · Missing: mac, agents, macos
53%53% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: intuitive · Missing: plus, platform, reviews
45%45% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: para · Missing: mobile apps, ios, personal
35%35% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: arr · Missing: mrr, revenue, profit
12%12% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Se
Search and filter your boardgame collection48%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Search and filter your boardgame collection

Hacker News1
Cu
Curated collection of greatest explainers from all over the world49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Curated collection of greatest explainers from all over the world

Hacker News3
Vu
VueToolbox – Collection of the best Vue.js libraries55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

VueToolbox – Collection of the best Vue.js libraries

Hacker News27
VueToolbox
VueToolbox40%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Collection of the best Vue.js libraries.

Indie Hackers2$10/moproductivity
Ea
Easy Filters – Collection of Image Filters (iOS)46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Easy Filters – Collection of Image Filters (iOS)

Hacker News1
Storypony
Storypony42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Curated collection of stories and poetry by talented writers

Indie Hackerscommitment-side-project
Podstarts
Podstarts64%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A curated collection of entrepreneurial podcasts

Indie Hackerscommitment-side-project
Fi
Filters for Eloquent61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Filters for Eloquent

Hacker News2
St
Stable Diffusion Without Filters68%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Stable Diffusion Without Filters

Hacker News52
De
Decruft your Rails filters with FilterDecrufter53%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Decruft your Rails filters with FilterDecrufter

Hacker News15