UNPKG

es-next-tools

Version:

A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.

15 lines (14 loc) 773 B
/** * Creates a new object with certain properties omitted. * @param {T} object - The source object. * @param {K[] | ((key: string, value: T[K]) => boolean)} keysOrPredicate - An array of keys to omit or a predicate function. * @returns A new object with the specified keys omitted. * @example * const obj = { a: 1, b: 2, c: 3, d: 4 }; * const result1 = omit(obj, ['b', 'd']); * // { a: 1, c: 3 } * const result2 = omit(obj, (key, value) => value > 2); * // { a: 1, b: 2 } */ export declare function omit<T extends Record<string, any>, K extends keyof T>(object: T, keysOrPredicate: K[]): Omit<T, K>; export declare function omit<T extends Record<string, any>, K extends keyof T>(object: T, keysOrPredicate: ((key: string, value: T[K]) => boolean)): Partial<T>;