text: import hoistStatics from 'hoist-non-react-statics';
  
  function getDisplayName(WrappedComponent) {
    return WrappedComponent.displayName || WrappedComponent.name || 'WrappedComponent';
  }
  
  export function argumentContainer(Container, WrappedComponent) {
    /* eslint no-param-reassign:0 */
    Container.displayName = `Form(${getDisplayName(WrappedComponent)})`;
    Container.WrappedComponent = WrappedComponent;
    return hoistStatics(Container, WrappedComponent);
  }
  
  export function getValueFromEvent(e) {
    // support custom element
    if (!e || !e.target) {
      return e;
    }
    const { target } = e;
    return target.type === 'checkbox' ? target.checked : target.value;
  }
  
  export function getErrorStrs(errors) {
    if (errors) {
      return errors.map((e) => {
        if (e && e.message) {
          return e.message;
        }
        return e;
      });
    }
    return errors;
  }
  
  export function isEmptyObject(obj) {
    return Object.keys(obj).length === 0;
  }
  
  export function flattenArray(arr) {
    return Array.prototype.concat.apply([], arr);
  }
  
  export function mirror(obj) {
    return obj;
  }
  
  export function hasRules(validate) {
    if (validate) {
      return validate.some((item) => {
        return !!item.rules && item.rules.length;
      });
    }
    return false;
  }
  
  export function getParams(ns, opt, cb) {
    let names = ns;
    let callback = cb;
    let options = opt;
    if (cb === undefined) {
      if (typeof names === 'function') {
        callback = names;
        options = {};
        names = undefined;
      } else if (Array.isArray(ns)) {
        if (typeof options === 'function') {
          callback = options;
          options = {};
        } else {
          options = options || {};
        }
      } else {
        callback = options;
        options = names || {};
        names = undefined;
      }
    }
    return {
      names,
      callback,
      options,
    };
  }
  