UNPKG

@extra-array/has-path

Version:

Checks if nested array has a path.

60 lines (45 loc) 1.95 kB
Checks if nested array has a path. [:package:](https://www.npmjs.com/package/@extra-array/has-path) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/has-path) [:vhs:](https://asciinema.org/a/343814) [:moon:](https://www.npmjs.com/package/@extra-array/has-path.min) [:scroll:](https://unpkg.com/@extra-array/has-path/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Alternatives: [hasValue], [hasPrefix], [hasSuffix], [hasInfix], [hasSubsequence], [hasPermutation], [hasPath].<br> > Similar: [hasPath], [getPath], [setPath$], [removePath$]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.hasPath(x, p); // x: a nested array // p: path ``` ```javascript const array = require("extra-array"); var x = [[2, 4], 6, 8]; array.hasPath(x, [1]); // true array.hasPath(x, [0, 1]); // true array.hasPath(x, [0, 1, 2]); // false ``` <br> <br> ## References - [ArrayList.get: Java](https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#get(int)) - [_.nth: lodash](https://lodash.com/docs/4.17.15#nth) - [Array.at: sugarjs](https://sugarjs.com/docs/#/Array/at) [hasValue]: https://github.com/nodef/extra-array/wiki/hasValue [hasPrefix]: https://github.com/nodef/extra-array/wiki/hasPrefix [hasSuffix]: https://github.com/nodef/extra-array/wiki/hasSuffix [hasInfix]: https://github.com/nodef/extra-array/wiki/hasInfix [hasSubsequence]: https://github.com/nodef/extra-array/wiki/hasSubsequence [hasPermutation]: https://github.com/nodef/extra-array/wiki/hasPermutation [hasPath]: https://github.com/nodef/extra-array/wiki/hasPath [getPath]: https://github.com/nodef/extra-array/wiki/getPath [setPath$]: https://github.com/nodef/extra-array/wiki/setPath$ [removePath$]: https://github.com/nodef/extra-array/wiki/removePath$