Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Utilities

getPathValue

Takes in an object and a key and returns the value of the key.

Params

Signature: getPathValue(obj, key)

obj : The object to get the value from

key : The key to get the value from (supports dot notation)

Returns

Returns the value of the key.

Examples

import { getPathValue } from '@adobe-commerce/elsie/lib';
const obj = {
foo: {
bar: 'baz',
},
};
const result = getPathValue(obj, 'foo.bar');
console.log(result); // "baz"