Created
January 15, 2021 17:12
-
-
Save ha6000/0a764ccd1718e30b4d4e32498791d934 to your computer and use it in GitHub Desktop.
Get's certain path of a object
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
function get(object = {}, path = '') { | |
return path.split('.').reduce((obj, token) => obj[token], object); | |
} | |
module.exports = get; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment