hitcher

1.0.0 • Public • Published

🔗 Hitcher

Optional object chaining, but now

Install

yarn add hitcher

Usage

import hitch from '$hitcher'
 
const myObj = {
    person: {
        name: {
            first: 'Harry',
            last: 'Fitz'
        },
        github: '@hjfitz'
    }
}
 
const first = hitch(myObj, 'person', 'name', 'first')

API

chain(obj: object, ...keys: string|number)

Follows ...keys in obj, looking for the value of obj[key[0]][key[1]]...[key[n-1]][key[n]]

Inspiration

Optional object chaining - a new feature to land in ES!

Readme

Keywords

none

Package Sidebar

Install

npm i hitcher

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

45.3 kB

Total Files

7

Last publish

Collaborators

  • hjfitz