📜  js 解析 cookie 字符串 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:42.649000             🧑  作者: Mango

代码示例1
const parseCookie = str =>
  str
    .split(';')
    .map(v => v.split('='))
    .reduce((acc, v) => {
      acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim());
      return acc;
    }, {});