Skip to main content
Module

x/unnullish/mod.ts>unnullish

🦕 An opposite function of nullish coalescing operator
Go to Latest
function unnullish
import { unnullish } from "https://deno.land/x/unnullish@v0.1.0/mod.ts";

Returns the value as is if value is nullish, otherwise it executes callback and returns the result.

This function is the opposite of the Nullish coalescing operator (??).

Parameters

value: T | Nullish
callback: (value: T) => R

Returns

R | Nullish