Questionnaire-of-the-Facebo.../node_modules/undefsafe/example.js

15 lines
245 B
JavaScript
Raw Permalink Normal View History

2021-03-11 01:43:28 +00:00
var undefsafe = require('undefsafe');
var object = {
a: {
b: {
c: 1,
d: [1, 2, 3],
e: 'remy'
}
}
};
console.log(undefsafe(object, 'a.b.e')); // "remy"
console.log(undefsafe(object, 'a.b.not.found')); // undefined