Created
August 6, 2019 07:57
-
-
Save iksi/e9e39ac29dfbf3fe0b59ebf541513b95 to your computer and use it in GitHub Desktop.
vanilla js functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get deep value from object by passing path to it as an array | |
const path = (pathArray, nestedObject) => pathArray.reduce((object, key) => ( | |
object && object[key] !== 'undefined' ? object[key] : undefined | |
), nestedObject); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment