Created
February 16, 2017 09:54
-
-
Save alexaivars/ec319eea9a649634cd2c3eacb14b168a to your computer and use it in GitHub Desktop.
// safly get values from nested object trees 1 // using similar interface as immutable.js
This file contains hidden or 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
| module.exports = (target, path, defaultValue) => path.reduce( | |
| (obj, key) => obj && obj.hasOwnProperty(key) ? obj[key] : null | |
| , target | |
| ) || defaultValue; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment