type-fns
Version:
A set of types, type checks, and type guards for simpler, safer, and easier to read code.
15 lines • 553 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.omit = void 0;
/**
* a companion to the `Omit` type, returns a new object without the omitted attributes
*/
const omit = (obj, keys) => Object.entries(obj).reduce((summary, [key, value]) => {
// if key is in the specified keys, dont add it to the new object
if (keys.includes(key))
return summary;
// if it is not within specified keys, add it
return { ...summary, [key]: value };
}, {});
exports.omit = omit;
//# sourceMappingURL=omit.js.map