The type of the input record
The readonly array type of keys to omit from the record
A new record containing all properties except the specified keys
const user = {
id: 1,
name: 'Charlie',
email: 'charlie@example.com',
password: 'secret123',
internalNote: 'VIP customer',
};
// Direct usage - remove sensitive fields
const safeUser = Obj.omit(user, ['password', 'internalNote']);
assert.deepStrictEqual(safeUser, {
id: 1,
name: 'Charlie',
email: 'charlie@example.com',
});
// Curried usage with pipe
const withoutEmail = pipe(user).map(Obj.omit(['email', 'password'])).value;
assert.deepStrictEqual(withoutEmail, {
id: 1,
name: 'Charlie',
internalNote: 'VIP customer',
});
Creates a new record that excludes the specified keys from the source record. This function supports both direct usage and curried form for functional composition.
Type Safety: Only keys that exist in the source record type are allowed, and the return type precisely reflects which properties remain after omission.
The readonly array type of keys to omit from the record
A readonly array of keys to exclude from the result
A new record containing all properties except the specified keys
const user = {
id: 1,
name: 'Charlie',
email: 'charlie@example.com',
password: 'secret123',
internalNote: 'VIP customer',
};
// Direct usage - remove sensitive fields
const safeUser = Obj.omit(user, ['password', 'internalNote']);
assert.deepStrictEqual(safeUser, {
id: 1,
name: 'Charlie',
email: 'charlie@example.com',
});
// Curried usage with pipe
const withoutEmail = pipe(user).map(Obj.omit(['email', 'password'])).value;
assert.deepStrictEqual(withoutEmail, {
id: 1,
name: 'Charlie',
internalNote: 'VIP customer',
});
Creates a new record that excludes the specified keys from the source record. This function supports both direct usage and curried form for functional composition.
Type Safety: Only keys that exist in the source record type are allowed, and the return type precisely reflects which properties remain after omission.