function qs(search) {
  if(typeof search !== "string" || !search) return search;
  return search.split("&").reduce((res, cur) => {
    const arr = cur.split("=");
    return Object.assign({[arr[0]]: arr[1]}, res)
  }, {})
}

 

posted on 2020-03-10 11:32  jzfan  阅读(217)  评论(0编辑  收藏  举报