Skip to content

dzava/object-get

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published