hasIn()

Returns true if the key path is defined in the provided collection.

hasIn(collection: unknown, keyPath: Iterable<unknown>): boolean

Discussion

A functional alternative to collection.hasIn(keypath) which will also work with plain Objects and Arrays.

const { hasIn } = require('immutable')
hasIn({ x: { y: { z: 123 }}}, ['x', 'y', 'z']) // true
hasIn({ x: { y: { z: 123 }}}, ['x', 'q', 'p']) // falserun it
This documentation is generated from immutable.d.ts. Pull requests and Issues welcome.

© 2014–present, Lee Byron and other contributors
Licensed under the 3-clause BSD License.
https://immutable-js.com/docs/v4.0.0/hasIn()/