@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
22 lines (17 loc) • 458 B
JavaScript
;
/*!
* @techmely/utils
* Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
* MIT Licensed
*/
// src/deleteProps.ts
function deleteProps(obj, propOrProps) {
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
return Object.keys(obj).reduce((newObj, prop) => {
if (!props.includes(prop)) {
newObj[prop] = obj[prop];
}
return newObj;
}, {});
}
exports.deleteProps = deleteProps;