This package has been deprecated

Author message:

Use the `get` method in `setvalue` instead

getvalue
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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

Package Sidebar

Install

npm i getvalue

Weekly Downloads

17

Version

1.1.1

License

Apache-2.0

Last publish

Collaborators

  • blakeembrey