Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 24 days 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 (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-09-15T07:59:17.000Z (over 5 years ago)
- Last Synced: 2024-12-07T03:31:01.765Z (27 days 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