omit
import { omit } from "jsr:@ende/collections";function
function omit<T extends object, K extends keyof T>(obj: Readonly<T>, keys: readonly K[]): Omit<T, K>Creates a new object by excluding the specified keys from the provided object.
obj: Readonly<T>The object to omit keys from.
keys: readonly K[]The keys to omit from the object.
Returns
A new object with the specified keys omitted.
Example: Basic usage
import { omit } from "@ende/collections/omit";
import { assertEquals } from "@ende/assert";
const obj = { a: 5, b: 6, c: 7, d: 8 };
const omitted = omit(obj, ["a", "c"]);
assertEquals(omitted, { b: 6, d: 8 });