https://github.com/vweevers/deep-dot
Get a nested property of an object or primitive
https://github.com/vweevers/deep-dot
deep nested nodejs property-accessor
Last synced: 4 months ago
JSON representation
Get a nested property of an object or primitive
- Host: GitHub
- URL: https://github.com/vweevers/deep-dot
- Owner: vweevers
- License: mit
- Created: 2015-01-01T20:17:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-09-15T07:59:17.000Z (almost 6 years ago)
- Last Synced: 2025-03-28T21:39:05.408Z (4 months ago)
- Topics: deep, nested, nodejs, property-accessor
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deep-dot
Get a nested property of an object or primitive.
## examples
```js
var deep = require('deep-dot')var obj = {
a: {
b: {
'c.d': [6, '78']
}
}
}// basic usage
console.log(deep(obj, 'a.b.c.d.0') === 6)
console.log(deep(obj, 'a.b.c.d.1.1') === 8)// attach
obj.deep = deep// non existent
console.log(obj.deep('x.y') == null)// array path
console.log(obj.deep(['a', 'b']))// cute side-effects
console.log(deep('window.location'))
console.log(deep(['a','b','c'], [2]) === 'c')
```## install
With [npm](https://npmjs.org) do:
```
npm install deep-dot
```## license
MIT