function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
// 序列化参数, {id: '1', id2: {id-1: '1'}} => "id1=1&id2.id-1=1"
function serializeParams(val) {
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  if (val && Object.prototype.toString.call(val) === '[object Object]') {
    var usp = new URLSearchParams();
    var build = function build(o, p) {
      Object.keys(o).forEach(function (key) {
        var paramKey = p ? "".concat(p, ".").concat(key) : key;
        o[key] && _typeof(o[key]) === 'object' ? build(o[key], paramKey) : usp.append(paramKey, o[key]);
      });
    };
    build(val, prefix);
    return usp.toString();
  }
  return val;
}
export default serializeParams;