UNPKG

@extra-array/some

Version:

Checks if any value satisfies a test.

48 lines (34 loc) 1.27 kB
Checks if any value satisfies a test. [:package:](https://www.npmjs.com/package/@extra-array/some) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/some) [:vhs:](https://asciinema.org/a/332132) [:moon:](https://www.npmjs.com/package/@extra-array/some.min) [:scroll:](https://unpkg.com/@extra-array/some/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Similar: [some], [every]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.some(x, [ft]); // x: an array // ft: test function (v, i, x) ``` ```javascript const array = require("extra-array"); var x = [1, 2, -3, -4]; array.some(x, v => v > 10); // false array.some(x, v => v < 0); // true ``` <br> <br> ## References - [Array.prototype.some: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) - [any: Python](https://docs.python.org/3/library/functions.html#any) - [Array.some: sugarjs](https://sugarjs.com/docs/#/Array/some) [some]: https://github.com/nodef/extra-array/wiki/some [every]: https://github.com/nodef/extra-array/wiki/every