squeeze-js
v1.0.3
Published
Safe property extraction helper for Javascript objects
Downloads
10
Readme
squeeze-js
Safe property extraction for Javascript objects.
Vanilla JS method for safely extracting property value:
let zipcode;
if (person && person.address && person.address.zipcode) {
zipcode = person.address.zipcode;
}
Safe extraction of property value with Squeeze:
const squeeze = require('squeeze-js');
let zipcode = squeeze(person, _ => _.address.zipcode);