fn
omit
v0.0.3testedReturns a new object with the specified keys omitted
Examples
ts
omit({ a: 1, b: 2, c: 3 }, 'a') // => { b: 2, c: 3 }ts
omit({ a: 1, b: 2, c: 3 }, ['a', 'b']) // => { c: 3 }Signature
ts
export function omit<Target extends object, Key extends keyof Target>(
target: Target,
keys: Arrayable<Key>,
): Omit<Target, Key>{ ... }Type Parameters
Targetextends objectKeyextends keyof TargetParameters
| Parameter | Type | Description |
|---|---|---|
target | Target | The object to omit keys from |
keys | Arrayable<Key> | The object to omit keys from |
Returns
Omit<Target, Key>The new object with the specified keys omitted