defaultTo()

Defaults specific non-values to another given value.

This function is valid in v2.8.0 to v2.14.0. This function has been downloaded 43 times.

Parameters

{*} value
Value to test out.
{*} defaultValue
Value to default to if value is not sufficient.
{boolean=} opt_beStrict Optional, Default:false
Specifies whether or not to only check if value is undefined.

Returns

{*}
If opt_beStrict is true-ish and value is undefined, defaultValue will be returned. If opt_beStrict is false-ish and value is undefined, null or NaN, defaultValue will be returned. In all other cases value will be returned.

Required Functions

This function requires the following functions which are included automatically:

  • canDefault()
    Determines whether or not a value would be defaulted to another value.
  • defaulter()
    Creates a partial function which will always default to another value when non-values are passed to it.