Skip to content

Instantly share code, notes, and snippets.

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 JesterXL/9a555229ad0416291fae7887c8a24e2d to your computer and use it in GitHub Desktop.
Save JesterXL/9a555229ad0416291fae7887c8a24e2d to your computer and use it in GitHub Desktop.
People think you don't need Lodash or Ramda, but ... you just have to have patience and love and empathy.
// keep in mind this does NOT do paths
const getOr = (defaultValue, prop, object) =>
(object ?? {})?.[prop] ?? defaultValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment