Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rambda/rambda.js>defaultTo

Faster and smaller alternative to Ramda
Latest
function defaultTo
import { defaultTo } from "https://deno.land/x/rambda@9.4.1/rambda.js";

It returns defaultValue, if all of inputArguments are undefined, null or NaN.

Else, it returns the first truthy inputArguments instance(from left to right).

Parameters

defaultValue: T
input: T | null | undefined

Parameters

defaultValue: T

Returns

(input: T | null | undefined) => T