import _ from 'lodash';

function omitUndefined(obj) {
  const result = {};
  _.forOwn(obj, function(value, key) {
    if (_.isPlainObject(value)) {
      result[key] = omitUndefined(value);
    }
    else if (!_.isUndefined(value)) {
      result[key] = value;
    }
  });
  return result;
}

export default omitUndefined;
import _ from 'lodash';

function omitUndefined(obj) {
  return _.transform(obj, function(result, value, key) {
    if (_.isPlainObject(value)) {
      result[key] = omitUndefined(value);
    }
    else if (!_.isUndefined(value)) {
      result[key] = value;
    }
  });
}

export default omitUndefined;
Use _.transform instead of _.reduce
Use _.transform instead of _.reduce
