payload
Version:
Node, React, Headless CMS and Application Framework built on Next.js
10 lines (9 loc) • 319 B
JavaScript
// @ts-strict-ignore
export const getObjectDotNotation = (obj, path, defaultValue)=>{
if (!path || !obj) {
return defaultValue;
}
const result = path.split('.').reduce((o, i)=>o?.[i], obj);
return result === undefined ? defaultValue : result;
};
//# sourceMappingURL=getObjectDotNotation.js.map