3.0.1 • Published 5 years ago

somefilter v3.0.1

Weekly downloads
618
License
MIT
Repository
github
Last release
5 years ago

somefilter License NPM version Dependency Status Build Status Coverage Status

Right-to-left conditional function composition. Get some result of filter functions call.

Install

npm i somefilter --save

How to use?

const somefilter = require('somefilter');
const notEmpty = ({length} = 0) => length;
const find = (array, condition) => array.filter(condition);

const findZero = array => find(array, a => !a);
const findPositive = array => find(array, a => a > 0);

const findNumbers = somefilter(notEmpty, [findPositive, findZero]);

findNumbers([1, 2, -1, -3]);
// returns
[1, 2];

findNumbers([1, 2, -1, -3, 0, 0, 0]);
// returns
[0, 0, 0];

License

MIT

3.0.1

5 years ago

3.0.0

5 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.3

6 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago