_.defaultTo(value, defaultValue)
source npm package
Checks value to determine whether a default value should be returned in its place. The defaultValue is returned if value is NaN, null, or undefined.
Since
4.14.0
Arguments
value (*): The value to check.
defaultValue (*): The default value.
Returns
(*): Returns the resolved value.
Example
_.defaultTo(1, 10);
// => 1
_.defaultTo(undefined, 10);
// => 10