Skip to main content
Module

x/unknownutil/mod.ts>isMap

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

Return true if the type of x is Map<unknown, unknown>.

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

const a: unknown = new Map([["a", 0], ["b", 1]]);
if (is.Map(a)) {
  // a is narrowed to Map<unknown, unknown>
  const _: Map<unknown, unknown> = a;
}

Parameters

x: unknown

Returns

x is Map<unknown, unknown>