resolve-keypath
v1.1.0
Published
Resolve the value of an object according the keypath
Downloads
62
Readme
resolve-keypath
Install
npm install resolve-keypath
Usage
var resolve = require('resolve-keypath');
resolve({ a: { b: 1 } }, 'a.b') // 1
resolve({ a: { b: 1 } }, 'a/b', '/') // 1
resolve(null, 'a') // null
// Use `getResolver` if you want to cache the result per object:
var getResolver = resolve.getResolver;
var myResolver = getResolver({ a: { b: 1 }}, '/');
myResolver('a/b') // 1
License
MIT