File size: 644 Bytes
bc20498 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import { dequal } from 'dequal';
export function omit(obj, ...keys) {
const result = {};
for (const key of Object.keys(obj)) {
if (!keys.includes(key)) {
result[key] = obj[key];
}
}
return result;
}
export function stripValues(inputObject, toStrip, recursive) {
return Object.fromEntries(Object.entries(inputObject).filter(([_, value]) => !dequal(value, toStrip)));
}
export function removeUndefined(obj) {
const result = {};
for (const key in obj) {
const value = obj[key];
if (value !== undefined) {
result[key] = value;
}
}
return result;
}
|