Skip to content

Find nested properties in an object by specifying a path, eg "level1.level2.0.name"

Notifications You must be signed in to change notification settings

ahultgren/findByPath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

findByPath

Find nested properties in an object by specifying a path, eg "level1.level2.0.name".

var findByPath = require('findByPath'),
obj = {
  level1: true,
  parent: {
    level2: "true"
  }
};

findByPath(obj, 'level1'); // true
findByPath(obj, 'parent.level2'); // "true"
findByPath(obj, 'parent/level2', '/'); // "true"
findByPath(obj, 'parent.child'); // undefined

See tests for more examples.

Contributors

Rodney Rehm contributed the better part of the code to Reol.js. Thanks!

About

Find nested properties in an object by specifying a path, eg "level1.level2.0.name"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published