UNPKG

@extra-array/includes

Version:
51 lines (37 loc) 1.47 kB
Checks if array has a value. [:package:](https://www.npmjs.com/package/@extra-array/includes) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/includes) [:vhs:](https://asciinema.org/a/332062) [:moon:](https://www.npmjs.com/package/@extra-array/includes.min) [:scroll:](https://unpkg.com/@extra-array/includes/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Similar: [search], [indexOf], [isValue], [includes]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.includes(x, v, [i]); // x: an array // v: search value // i: start index (0) ``` ```javascript const array = require("extra-array"); var x = [1, 2, -3]; array.includes(x, 3); // false array.includes(x, -3); // true ``` <br> <br> ## References - [Array.prototype.includes: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) - [Array.includes: sugarjs](https://sugarjs.com/docs/#/ES7/Array/includes) - [array-tools.contains: @75lb](https://www.npmjs.com/package/array-tools) [search]: https://github.com/nodef/extra-array/wiki/search [indexOf]: https://github.com/nodef/extra-array/wiki/indexOf [isValue]: https://github.com/nodef/extra-array/wiki/isValue [includes]: https://github.com/nodef/extra-array/wiki/includes