data-diver
v1.0.1
Published
Brings optionals to Javascript, makes descending large data structures easy.
Downloads
3
Readme
data-diver
I hate writing this:
props.user &&
props.user.friends &&
props.user.friends[0] &&
props.user.friends[0].friends
Facebook has a solution for it, but it requires additional build steps, so I wrote some code to make it easier.
Usage
yarn add data-diver
import dd from 'data-diver'
let friends = dd(props, 'user.friends.0.friends');
console.log(friends);