getIn()

Returns the value at the provided key path starting at the provided collection, or notSetValue if the key path is not defined.

getIn(
collection: unknown,
keyPath: Iterable<unknown>,
notSetValue: unknown
): unknown

Discussion

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

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