npm.io
1.0.0 • Published 4 years ago

uinix-fp-filter

Licence
MIT
Version
1.0.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
3

uinix-fp-filter

Build Coverage Downloads Size

uinix-fp array filter utility.


Install

This package is ESM-only and requires Node 12+.

npm install uinix-fp-filter

Use

import {filter} from 'uinix-fp-filter';

const isEven = x => x % 2 === 0;

filter(isEven)([1, 2, 3, 4]); // [2, 4]

const filterIsEven = filter(isEven); // curried
filter([1, 2, 3, 4]); // [2, 4]

API

This package exports the following identifiers: filter. There is no default export.

filter(f)(xs)
Parameters (Curried)
  • f ((x: X) => boolean): The predicate function
  • xs (X[]): Any value
Returns
  • X[] — Array of filtered values passing the predicate test.

License

MIT Chris Zhou

Keywords