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

https://github.com/serapath/getval

read values from nested object like from a flat key value store
https://github.com/serapath/getval

Last synced: about 4 hours ago
JSON representation

read values from nested object like from a flat key value store

Awesome Lists containing this project

README

          

# getval
read values from nested object like from a flat key value store

# usage
`npm install getval`

```js
var getval = require('getval')
var state = { '': 3, a: { b: [5,6,7], '': { '': 15 } } }
console.log('state =',state)
console.log(getval(state)) // => { '': 3, a: { b: [5,6,7], '': { '': 15 } } }
console.log(getval(state, 'a//')) // => 15
console.log(getval(state, '')) // => 3
console.log(getval(state, ['a','b'])) // => [5,6,7]
console.log(getval(state, 'a/b')) // => [5,6,7]
console.log(getval(state, 'a.b', '.')) // => [5,6,7]
console.log(getval(state, 'a/b/0')) // => 5

```

# related
* see [setval](https://www.npmjs.com/package/setval)