An open API service indexing awesome lists of open source software.

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

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```