mocoolka-function
Version:
Function lib for function.
12 lines (11 loc) • 499 B
TypeScript
/**
* Returns the second argument if it is not `null`, `undefined` or `NaN`;
* otherwise the first argument is returned.
*
* @since v0.1.0
* @param defaultValue The default value.
* @param value `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`.
* @return The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value
*/
declare const defaultTo: (defaultValue: any, value: any) => any;
export default defaultTo;