Object
/ API Reference
Object
/ API Reference

omit

Creates an object composed of the object properties that are not omitted.

The Gist

import { omit } from '@weser/object'

const obj = { a: 1, b: 2, c: 3 }
const omitted = omit(obj, ['b'])

// => { a: 1, c: 3 }
console.log(omitted)

Parameters

ParameterTypeDescription
objTThe source object.
keysArray<keyof T>The property names to omit.

Returns

(Omit<T, K>) Returns the new object without the omitted properties.

On this page