Pass an array of object paths (e.g.
a.b.c
) and get the first non-undefined value if the property exists, or null if it does not.
Install
Install with npm:
$ npm i get-first
Run tests
npm test
Usage
var getFirst = ; ;//=> 'b' ;//=> 'b' ;//=> 'c' ;//=> 'c' ;//=> 'c' ;//=> 'd' ;//=> {c: 'd'} ;//=> 'f'
Related
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb on January 18, 2016.