You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
245 B
15 lines
245 B
1 month ago
|
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
|