1.0.3 • Published 5 years ago
safe-get-prop v1.0.3
safe-get-prop
A function, which safely returns a property on any nested object layer
Usage:
import { safeGetProp } from 'safe-get-prop';
const myObj = { prop1: { prop2: { prop3: 123 } } };
const ensureValue = 'nothing to show';
safeGetProp(myObj, 'prop1.prop2.prop3', ensureValue);