check-nested
v0.0.6
Published
Check for the existence of nested objects
Downloads
65
Readme
check-nested
Check for the existence of nested objects
var checkNested = require('check-nested');
// Some data i don't control
var a = {
b: {
c: {
d: 'Some data i need'
}
}
};
if (checkNested(a, 'a.b.c.d')) {
console.log('Continue');
}
var val = checkNested(a, 'a.b.c.d');
var valDefault = checkNested(a, 'a.b.c.e', 'default');
Credits: CMS - Stackoverflow