Module Get object by path
Find an object by giving it a path with or without context.
Returns an object containing information about the object and paths.
Statistics
Social
Project Health
Install
$ npm install @brickify/m-gobp
Usage
var getObject = require('@brickify/m-gobp');
var context = {
foo: {
bar: {
baz: function() {
}
}
}
};
// Use defined context
getObject('foo.bar.baz', context);
process.foo = {
bar: {
baz: function() {
}
}
};
// Use global context
getObject('foo.bar.baz');
Returns
{
context: object|process|global|window,
object: {
decomposed: [...objects],
first: object|process|global|window,
last: End object value,
parent: End parent object
},
paths: {
decomposed: [...paths],
first: first path,
last: End parent object path
}
}