UNPKG

@extra-array/has-key.min

Version:
54 lines (43 loc) 2.03 kB
Checks if array has a key. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:] > Similar: [value], [values], [hasValue], [searchValue].<br> > Similar: [hasValue], [hasPrefix], [hasInfix], [hasSuffix], [hasSubsequence], [hasPermutation].<br> > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array<br> > This is browserified, minified version of [@extra-array/has-key].<br> > It is exported as global variable **array_hasKey**.<br> > CDN: [unpkg], [jsDelivr]. [@extra-array/has-key]: https://www.npmjs.com/package/@extra-array/has-key [unpkg]: https://unpkg.com/@extra-array/has-key.min [jsDelivr]: https://cdn.jsdelivr.net/npm/@extra-array/has-key.min ```javascript array.hasKey(x, [k]); // x: an array // k: key? ``` ```javascript const array = require('extra-array'); var x = [10, 20, 30]; array.hasKey(x, 2); // true array.hasKey(x, 3); // false array.hasKey(x, -1); // true ``` ### references - [Array.prototype.includes: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) - [array-tools.contains: @75lb](https://www.npmjs.com/package/array-tools) [value]: https://github.com/nodef/extra-array/wiki/value [values]: https://github.com/nodef/extra-array/wiki/values [hasValue]: https://github.com/nodef/extra-array/wiki/hasValue [searchValue]: https://github.com/nodef/extra-array/wiki/searchValue [hasPrefix]: https://github.com/nodef/extra-array/wiki/hasPrefix [hasInfix]: https://github.com/nodef/extra-array/wiki/hasInfix [hasSuffix]: https://github.com/nodef/extra-array/wiki/hasSuffix [hasSubsequence]: https://github.com/nodef/extra-array/wiki/hasSubsequence [hasPermutation]: https://github.com/nodef/extra-array/wiki/hasPermutation [:running:]: https://npm.runkit.com/@extra-array/has-key [:vhs:]: https://asciinema.org/a/343739 [:package:]: https://www.npmjs.com/package/@extra-array/has-key [:moon:]: https://www.npmjs.com/package/@extra-array/has-key.min [:ledger:]: https://unpkg.com/@extra-array/has-key/