1.0.1 • Published 7 years ago

data-diver v1.0.1

Weekly downloads
6
License
ISC
Repository
github
Last release
7 years ago

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

Done