Created
January 23, 2019 12:46
-
-
Save Quadriphobs1/e1cd932c9dbbdfb87ba50459262b8b32 to your computer and use it in GitHub Desktop.
Object key resover
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
| function resolve(path, obj=self, separator='.') { | |
| var properties = Array.isArray(path) ? path : path.split(separator) | |
| return properties.reduce((prev, curr) => prev && prev[curr], obj) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment