1.0.0 • Published 5 years ago
hitcher v1.0.0
🔗 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!
1.0.0
5 years ago