optional-value

0.2.0 • Public • Published

optional-value

optional-value finds out a value from nested object or array.

Install

# yarn
$ yarn add optional-value
# npm
$ npm install optional-value

Usage

import o from 'optional-value'

const someObject = {
  foo: {
    bar: 'hoge'
  }
}
const value = o(someObject, 'foo.bar')
// => hoge
const noneValue = o(someObject, 'foo.boo')
// => null
const obj = o(someObject, 'foo')
// => {bar: 'hoge'}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    144
    • latest

Version History

Package Sidebar

Install

npm i optional-value

Weekly Downloads

144

Version

0.2.0

License

MIT

Last publish

Collaborators

  • kotamat