Skip to content

Instantly share code, notes, and snippets.

@vpalos
Created August 10, 2019 04:05
Embed
What would you like to do?
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