source: node_modules/es-toolkit/dist/object/omitBy.d.ts@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * Creates a new object composed of the properties that do not satisfy the predicate function.
3 *
4 * This function takes an object and a predicate function, and returns a new object that
5 * includes only the properties for which the predicate function returns false.
6 *
7 * @template T - The type of object.
8 * @param {T} obj - The object to omit properties from.
9 * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines
10 * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`
11 * if the property should be omitted, and `false` otherwise.
12 * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.
13 *
14 * @example
15 * const obj = { a: 1, b: 'omit', c: 3 };
16 * const shouldOmit = (value) => typeof value === 'string';
17 * const result = omitBy(obj, shouldOmit);
18 * // result will be { a: 1, c: 3 }
19 */
20declare function omitBy<T extends Record<string, any>>(obj: T, shouldOmit: (value: T[keyof T], key: keyof T) => boolean): Partial<T>;
21
22export { omitBy };
Note: See TracBrowser for help on using the repository browser.