npm.io
1.0.5 • Published 8 years ago

q_

Licence
ISC
Version
1.0.5
Deps
0
Vulns
0
Weekly
0
Stars
5

Safe navigation into objects

npm install --save q_


const q = require('q_');

const object = {
  a: {
    b: {
      c: {
        d: 1,
        array: ['foo', 'bar'],
      },
    },
  },
};
  • q(object, 'a.b.c.d'); // => 1
  • q(object, 'a.b.c.array[1]'); // => bar
  • q(object, 'foo'); // => undefined

Keywords