Created
August 10, 2019 04:05
-
-
Save vpalos/e0e37d56a9c6a503208c830905c3c9d4 to your computer and use it in GitHub Desktop.
Drop-in replacements for Lodash functions (to avoid having to include the lib in the browser).
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
export function _get(object, path, fallback) { | |
const value = path.split(".").reduce((hash, field) => hash && hash[field], object); | |
return typeof value === "undefined" ? fallback : value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment