ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
20 lines • 755 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const shallowEqual_1 = require("./shallowEqual.cjs");
const isObject = obj => obj && Object.prototype.toString.call(obj) === '[object Object]';
const isEmpty = obj => obj instanceof Date
? false
: obj === '' ||
obj === null ||
obj === undefined ||
(0, shallowEqual_1.shallowEqual)(obj, {});
const removeEmpty = object => Object.keys(object).reduce((acc, key) => {
let child = object[key];
if (isObject(object[key])) {
child = removeEmpty(object[key]);
}
return isEmpty(child) ? acc : { ...acc, [key]: child };
}, {});
exports.default = removeEmpty;
module.exports = exports.default;
//# sourceMappingURL=removeEmpty.js.map