ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
17 lines • 617 B
JavaScript
import { shallowEqual } from "./shallowEqual.js";
const isObject = obj => obj && Object.prototype.toString.call(obj) === '[object Object]';
const isEmpty = obj => obj instanceof Date
? false
: obj === '' ||
obj === null ||
obj === undefined ||
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 };
}, {});
export default removeEmpty;
//# sourceMappingURL=removeEmpty.js.map