react-blips
Version:
Official React bindings for Blips
16 lines (12 loc) • 649 B
JavaScript
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import { isNil } from './isNil';
import { isEmpty } from './isEmpty';
export function removeEmptyOrNilProps(obj) {
return Object.entries(obj).reduce(function (acc, _ref) {
var _extends2;
var key = _ref[0],
value = _ref[1];
if (isEmpty(value) || isNil(value)) return acc;
return _extends({}, acc, (_extends2 = {}, _extends2[key] = value, _extends2));
}, {});
}