gistlib
index.tsxconst cookieString = decodeURIComponent(document.cookie); const cookiesArray = cookieString.split('; '); const cookiesObject = cookiesArray.reduce((acc, cookie) => { const [name, value] = cookie.split('='); return { ...acc, [name]: value }; }, {}); console.log(cookiesObject); 283 chars10 lines
const cookieString = decodeURIComponent(document.cookie); const cookiesArray = cookieString.split('; '); const cookiesObject = cookiesArray.reduce((acc, cookie) => { const [name, value] = cookie.split('='); return { ...acc, [name]: value }; }, {}); console.log(cookiesObject);
gistlibby LogSnag