Add propOr
Frikki opened this issue · 2 comments
Frikki commented
Add propOr
TylorS commented
What do you think about parameter order?
propOr<O extends object, K extends keyof O>(key: K, defaultValue: O[K], obj: O): O[K]
// or
propOr<O extends object, K extends keyof O>(defaultValue: O[K], key: K, obj: O): O[K]
I think I favor the latter because the defaultValue
should probably dictate which key you need from the objects you have and will generally be better for composition.
Frikki commented
Yes, latter.