Created
March 1, 2021 00:02
-
-
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.
This file contains hidden or 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
// 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