Skip to content

Instantly share code, notes, and snippets.

@vpalos
Created August 10, 2019 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpalos/e0e37d56a9c6a503208c830905c3c9d4 to your computer and use it in GitHub Desktop.
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).
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