merge-anything
merge-anything copied to clipboard
Handling "undefined"
Maybe this is by design, but I was surprised to learn that this:
import { merge } from "merge-anything"
const defaultTheme = {}
const theme = undefined
merge(defaultTheme, theme)
Returns undefined
. Is this expected, maybe it is, but I was kind of expecting it to return {}
. Am I right?
I would hate to have to handle this scenario like this everytime:
merge(defaultTheme, theme || {})