Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 340 Bytes

README.md

File metadata and controls

23 lines (18 loc) · 340 Bytes

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