Creates a new object by excluding specified keys from the original object. This function avoids mutating the original object by creating a new object.
The type of the object from which keys will be omitted.
The keys of the object to be omitted.
The object from which keys will be omitted.
The array of keys to omit from the object.
A new object with the specified keys excluded.
const original = { a: 1, b: 2, c: 3 };const result = omitObjectKeys(original, ['b']);console.log(result); // { a: 1, c: 3 }const user = { name: 'Alice', age: 25, country: 'USA' };const publicData = omitObjectKeys(user, ['age']);console.log(publicData); // { name: 'Alice', country: 'USA' } Copy
const original = { a: 1, b: 2, c: 3 };const result = omitObjectKeys(original, ['b']);console.log(result); // { a: 1, c: 3 }const user = { name: 'Alice', age: 25, country: 'USA' };const publicData = omitObjectKeys(user, ['age']);console.log(publicData); // { name: 'Alice', country: 'USA' }
Creates a new object by excluding specified keys from the original object. This function avoids mutating the original object by creating a new object.