@clerk/shared
Version:
Internal package utils used by the Clerk SDKs
31 lines (29 loc) • 905 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#region src/object.ts
const without = (obj, ...props) => {
const copy = { ...obj };
for (const prop of props) delete copy[prop];
return copy;
};
const removeUndefined = (obj) => {
return Object.entries(obj).reduce((acc, [key, value]) => {
if (value !== void 0 && value !== null) acc[key] = value;
return acc;
}, {});
};
const applyFunctionToObj = (obj, fn) => {
const result = {};
for (const key in obj) result[key] = fn(obj[key], key);
return result;
};
const filterProps = (obj, filter) => {
const result = {};
for (const key in obj) if (obj[key] && filter(obj[key])) result[key] = obj[key];
return result;
};
//#endregion
exports.applyFunctionToObj = applyFunctionToObj;
exports.filterProps = filterProps;
exports.removeUndefined = removeUndefined;
exports.without = without;
//# sourceMappingURL=object.js.map