UNPKG

@extra-array/every

Version:

Checks if all values satisfy a test.

49 lines (35 loc) 1.35 kB
Checks if all values satisfy a test. [:package:](https://www.npmjs.com/package/@extra-array/every) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/every) [:vhs:](https://asciinema.org/a/332042) [:moon:](https://www.npmjs.com/package/@extra-array/every.min) [:scroll:](https://unpkg.com/@extra-array/every/) [: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.every(x, [ft]); // x: an array // ft: test function (v, i, x) ``` ```javascript const array = require("extra-array"); var x = [1, 2, -3, -4]; array.every(x, v => v > 0); // false array.every(x, v => v > -10); // true ``` <br> <br> ## References - [Array.prototype.every: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) - [all: Python](https://docs.python.org/3/library/functions.html#all) - [Array.every: sugarjs](https://sugarjs.com/docs/#/Array/every) - [Array.none: sugarjs](https://sugarjs.com/docs/#/Array/none) [some]: https://github.com/nodef/extra-array/wiki/some [every]: https://github.com/nodef/extra-array/wiki/every