swc/ecmascript/minifier/tests/compress/fixture/projects/mootools/7/output.js
강동윤 20ce326909
feat(es/minifer): Improve minifier (#2229)
swc_ecma_minifier:
 - `if_return`: Allow side-effect-free statements to come after `if_return`.
 - `collapse_vars`: Move variables without init to first.
 - `analyzer`: Remove useless fields.
 - Don't drop `return` tokens if there's a finally block.
 - `drop_return_value`: Drop side-effect-free return arguments.
 - `make_sequences`: Don't inject `void 0` to return args.
 - `if_terminate`: Move to the pure optimizer.
 - Fix a bug related to `RegExp`.
2021-09-16 04:23:33 +00:00

23 lines
830 B
JavaScript

export const exported = {
toQueryString: function(object, base) {
var queryString = [];
return Object.each(object, function(value, key) {
switch(base && (key = base + "[" + key + "]"), typeOf(value)){
case "object":
result = Object.toQueryString(value, key);
break;
case "array":
var result, qs = {
};
value.each(function(val, i) {
qs[i] = val;
}), result = Object.toQueryString(qs, key);
break;
default:
result = key + "=" + encodeURIComponent(value);
}
null != value && queryString.push(result);
}), queryString.join("&");
}
};