import _typeof from "@babel/runtime/helpers/esm/typeof";
import { stringify } from 'qs';
export function isArray(val) {
  return _typeof(val) === 'object' && Object.prototype.toString.call(val) === '[object Array]';
}
export function isDate(val) {
  return _typeof(val) === 'object' && Object.prototype.toString.call(val) === '[object Date]';
}
export function isObject(val) {
  return val !== null && _typeof(val) === 'object';
}
export function forEach2ObjArr(target, callback) {
  if (!target) return;
  if (_typeof(target) !== 'object') {
    target = [target];
  }
  if (isArray(target)) {
    for (var i = 0; i < target.length; i++) {
      callback.call(null, target[i], i, target);
    }
  } else {
    for (var key in target) {
      if (Object.prototype.hasOwnProperty.call(target, key)) {
        callback.call(null, target[key], key, target);
      }
    }
  }
}
export function reqStringify(val) {
  return stringify(val, {
    arrayFormat: 'repeat',
    strictNullHandling: true
  });
}