deepget
Small package to get deep nested properties from JavaScript objects
Install
# npm npm install dpgt --save # yarn yarn add dpgt
Use
Import the utility and get nested properties passing the object and the key path.
; // some object with nested propertiesconst cartoon = title: 'Rick and Morty' seasons: 3 characters: rick: firstName: 'Rick' lastName: 'Sanchez' morty: firstName: 'Morty' lastName: 'Smith' ; ;// Sanchez
You can also use an array as a key path.
;// Sanchez
Default values are supported too as a thrid optional argument.
;// Not found
TODO
- Write tests
- Write contributing guide