1.1.1 • Published 7 years ago

getvalue v1.1.1

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
7 years ago

Getvalue

NPM version NPM downloads Build status Test coverage

Get a nested value from an object by path.

Installation

npm install getvalue --save

Usage

Arguments

  1. object (Object) The object to query
  2. path (Array) The path of the property to get
  3. (Optional) defaultValue (any) The value returned for undefined resolved values

Example

import { get } from 'getvalue'

const obj = { a: { b: { c: 10 } } }

get(obj, ['a', 'b', 'c']) //=> 10
get(obj, ['not', 'here']) //=> undefined
get(obj, ['or', 'here'], 1) //=> 1

License

Apache 2.0