MongoDB-style "dot notation" querying for JavaScript.
npm install dot-componentMongoDB-style "dot notation" querying for JavaScript.
```
$ component install component/dot
`js
var dot = require('dot');
var obj = {
name: {
first: "tobi"
},
pets: [
{ id: 1, name: 'loki' },
{ id: 2, name: 'jane' }
]
};
dot.get(obj, 'name.first'); // tobi
dot.get(obj, 'name.1.id'); // 2
dot.parent(obj, 'name.first'); // obj.name
dot.set(obj, 'name.1.name', 'Jane');
`
Queries the given path in obj.
Sets the given path to val in obj.init
If is false it won't initialize the path if it doesn't exit.
Returns the parent object/array that contains path within obj.obj
Could be itself. If init` is true it initializes the path.
MIT