example.js 245 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 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