default
default(value, [strict=false], [ctx])
Effect
Set the return value of validate
and validateSilent
, when the detected value is undefined | null | NaN
.
If strict mode is turned on(strict=true), set the return value when the detected value is undefined | null | NaN | '' | {} | []
.
Arguments
value
(*) The default return value ofvalidate
andvalidateSilent
. Whenvalue
is a function, then set the return value ofvalue
to be the default return value. The function has a parameter: the original detected value -undefined
,null
NaN
, '''
,{}
or[]
.[strict]
(boolean) - Whether turn on strict mode, default isfalse
, means no-strict mode. You can exactly setstrict
totrue
to turn on strict mode.[ctx]
(*) The execution context ifvalue
is a function.
Example
Last updated