Skip to main content
Module

x/unnullish/mod.ts>unnullish

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

Returns undefined 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: (v: T) => R

Returns

R | undefined