Parameters
value: undefined | null | T
defaultValue: T
Returns T
Unchanged value if it's not null or undefined or the default value
const foo: Partial<Record<string, string>> = { bar: 'baz' };
unwrapOr(foo.bar, 'qux'); // returns 'baz'
unwrapOr(foo.bat, 'qux'); // returns 'qux'
Returns the value if it's not
nullorundefined, or returns the default value