JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 742
  • Score
    100M100P100Q99830F
  • License MIT

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

Package Exports

  • somefilter
  • somefilter/legacy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (somefilter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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];

Environments

In old node.js environments that not fully supports es2015, somefilter could be used with:

var somefilter = require('somefilter/legacy');

License

MIT