uinix-fp-filter
v1.0.0
Published
uinix fp array filter utility
Downloads
14
Maintainers
Readme
uinix-fp-filter
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 functionxs
(X[]
): Any value
Returns
X[]
— Array of filtered values passing the predicate test.