1.1.1 • Published 9 years ago
getvalue v1.1.1
Getvalue
Get a nested value from an object by path.
Installation
npm install getvalue --saveUsage
Arguments
object(Object) The object to querypath(Array) The path of the property to get- (Optional)
defaultValue(any) The value returned forundefinedresolved 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) //=> 1License
Apache 2.0