Skip to main content
Module

x/unknownutil/mod.ts>isNullish

🦕 A lightweight utility pack for handling unknown type
Go to Latest
function isNullish
import { isNullish } from "https://deno.land/x/unknownutil@v3.18.0/mod.ts";

Return true if the type of x is null or undefined.

import { is } from "@core/unknownutil";

const a: unknown = null;
if (is.Nullish(a)) {
  // a is narrowed to null | undefined
  const _: (null | undefined) = a;
}

Parameters

x: unknown

Returns

x is null | undefined