5.0.1 • Published 7 years ago

getval v5.0.1

Weekly downloads
76
License
MIT
Repository
github
Last release
7 years ago

getval

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

usage

npm install getval

  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

5.0.1

7 years ago

5.0.0

8 years ago

4.0.2

8 years ago

4.0.1

8 years ago

4.0.0

8 years ago

2.0.0

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago