🎯 The opposite of pick; this method creates an object composed of the own enumerable property paths of the object that are not omitted.

Info

The source object can be a `Plain Object` or an `Array`.

Syntax

TypeScript
import { omit } from '@opentf/std';

omit<T extends object>(
  obj: T,
  ...paths: (string | unknown[])[]
): Partial<T>;

Parameters

  • obj: The source object or array.

  • ...paths: The property paths to omit.

Returns

A new object or array without the omitted properties.

Examples

TypeScript
omit({ a: 1, b: 2, c: 3 }, 'a', 'c') //=> { b: 2 }

omit([1, 2, 3], '1') //=> [1, 3]
Last updated on
Edit this page