Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 335 Bytes

README.md

File metadata and controls

13 lines (10 loc) · 335 Bytes

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);

safe-get-prop