https://github.com/antoniopresto/safe-object-navigation
Tiny helper to safe navigation into objects
https://github.com/antoniopresto/safe-object-navigation
elvis-operator optional-chainig safe-navigation
Last synced: about 2 months ago
JSON representation
Tiny helper to safe navigation into objects
- Host: GitHub
- URL: https://github.com/antoniopresto/safe-object-navigation
- Owner: antoniopresto
- Created: 2017-09-20T02:20:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-18T17:15:22.000Z (about 4 years ago)
- Last Synced: 2025-03-18T12:36:22.584Z (3 months ago)
- Topics: elvis-operator, optional-chainig, safe-navigation
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Safe navigation into objects
npm install --save q_
```js
const q = require('q_');
const object = {
a: {
b: {
c: {
d: 1,
array: ['foo', 'bar'],
},
},
},
};
```- ``` q(object, 'a.b.c.d'); // => 1 ```
- ``` q(object, 'a.b.c.array[1]'); // => bar```
- ``` q(object, 'foo'); // => undefined```