UNPKG

typing-assets

Version:

Additional typing assets and helpers for better TypeScript experience

32 lines 915 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pickProperties = exports.excludeProperties = void 0; /** * * @param source Source object * @param properties Properties to exclude (as `array`) * @returns Source with excluded properties */ const excludeProperties = (source, ...args) => { for (const key in source) { if ([...args].includes(key)) delete source[key]; } return source; }; exports.excludeProperties = excludeProperties; /** * * @param source Source object * @param properties Properties to pick (as `array`) * @returns Only picked properties from `source` */ const pickProperties = (source, ...args) => { for (const key in source) { if (![...args].includes(key)) delete source[key]; } return source; }; exports.pickProperties = pickProperties; //# sourceMappingURL=propertiesAggregation.js.map