bodyParse.js 275 Bytes
Newer Older
wuhao's avatar
wuhao committed
1 2 3 4 5 6 7 8 9 10 11 12
function bodyParse(vals) {
  let val = JSON.parse(JSON.stringify(vals));
  let res = "";
  for (let key in val) {
    let mostkey = key,
      value = val[key] ? val[key] : "";
    res += `&${mostkey}=${value}`;
  }
  return "?" + res.substr(1);
}

export default bodyParse;