Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ndhoule/some
Check if a predicate function returns true for any value in a collection.
https://github.com/ndhoule/some
Last synced: 13 days ago
JSON representation
Check if a predicate function returns true for any value in a collection.
- Host: GitHub
- URL: https://github.com/ndhoule/some
- Owner: ndhoule
- License: mit
- Created: 2015-05-26T06:11:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-02T20:28:54.000Z (over 8 years ago)
- Last Synced: 2024-10-28T04:17:16.157Z (22 days ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# some [![CI][ci-badge]][ci-link]
Check if a `predicate` function returns true for any value in a `collection`.
## Installation
```sh
$ component install ndhoule/some
$ npm install @ndhoule/some
```## API
### `some(predicate : Function, collection : Array|Object|String)`
```js
var isEven = function(num) { return num % 2 === 0; };some(isEven, [1, 2, 3]); // => true
some(isEven, [1, 3, 5]); // => false
some(isEven, [2, 4, 6]); // => true
```## License
Released under the [MIT license](LICENSE.md).
[ci-link]: https://travis-ci.org/ndhoule/some
[ci-badge]: https://travis-ci.org/ndhoule/some.svg?branch=master