Skip to content

antoniopresto/safe-object-navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Tiny helper to safe navigation into objects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published