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

x/ayonli_jsext/object/index.ts>omit

A JavaScript extension package for building strong and modern applications.
Latest
function omit
import { omit } from "https://deno.land/x/ayonli_jsext@v0.9.72/object/index.ts";

Creates an object composed without the picked keys.

NOTE: This function only collect keys from the object's own properties, except for type Error, whose name, message and cause are always collected.

Examples

Example 1

import { omit } from "@ayonli/jsext/object";

const obj = { foo: "Hello", bar: "World" };

console.log(omit(obj, ["foo"])); // { bar: "World" }

Type Parameters

T extends object
U extends keyof T

Parameters

obj: T
keys: U[]

Returns

Omit<T, U>

Parameters

obj: T
keys: (string | symbol)[]

Returns

Partial<T>