@dzava/object-get

0.1.0 • Public • Published

Get the property of an a object using a path.

Install

yarn add @dzava/object-get

Usage

import get from '@dzava/object-get'

const o = {
    foo: 'bar',
    users: [ {name: 'John', last: 'Smith'}, {name: 'Jane'} ],
}

get(o, 'some.key', null) // null
get(o, 'foo') // bar
get(o, 'users.0.name') // John
get(o, 'users.*.name') // ['John', 'Jane']
get(o, 'users.*.last', null) // ['Smith', null]

License

The MIT License (MIT).

Readme

Keywords

Package Sidebar

Install

npm i @dzava/object-get

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

5.71 kB

Total Files

4

Last publish

Collaborators

  • dzava