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

x/molt/lib/std/collections.ts>omit

Update dependencies the Deno way
Latest
function omit
import { omit } from "https://deno.land/x/molt@0.17.2/lib/std/collections.ts";

Creates a new object by excluding the specified keys from the provided object.

Examples

Example 1

import { omit } from "https://deno.land/std@0.224.0/collections/omit.ts";
import { assertEquals } from "https://deno.land/std@0.224.0/assert/assert_equals.ts";

const obj = { a: 5, b: 6, c: 7, d: 8 };
const omitted = omit(obj, ["a", "c"]);

assertEquals(omitted, { b: 6, d: 8 });

Type Parameters

T extends object
K extends keyof T

Parameters

obj: Readonly<T>
keys: readonly K[]

Returns

Omit<T, K>