Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coderaiser/somefilter
Right-to-left conditional function composition. Get some result of filter functions calls
https://github.com/coderaiser/somefilter
filter javascript nodejs some
Last synced: about 1 month ago
JSON representation
Right-to-left conditional function composition. Get some result of filter functions calls
- Host: GitHub
- URL: https://github.com/coderaiser/somefilter
- Owner: coderaiser
- License: mit
- Created: 2015-11-23T18:04:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-09-19T18:35:35.000Z (about 5 years ago)
- Last Synced: 2024-09-29T15:01:29.116Z (about 2 months ago)
- Topics: filter, javascript, nodejs, some
- Language: JavaScript
- Size: 35.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# somefilter [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
Right-to-left conditional function composition. Get [some][someURL] result of [filter][filterURL] functions call.
## Install
```
npm i somefilter --save
```## How to use?
```js
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
[NPMIMGURL]: https://img.shields.io/npm/v/somefilter.svg?style=flat
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/somefilter/master.svg?style=flat
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/somefilter.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]: https://npmjs.org/package/somefilter "npm"
[BuildStatusURL]: https://travis-ci.org/coderaiser/somefilter "Build Status"
[DependencyStatusURL]: https://david-dm.org/coderaiser/somefilter "Dependency Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"[CoverageURL]: https://coveralls.io/github/coderaiser/somefilter?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/somefilter/badge.svg?branch=master&service=github[someURL]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
[filterURL]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter