diff --git a/index.js b/index.js index dd6d479..550b444 100644 --- a/index.js +++ b/index.js @@ -101,16 +101,11 @@ function JSONCookie (str) { */ function JSONCookies (obj) { - var cookies = Object.keys(obj) - var key - var val - - for (var i = 0; i < cookies.length; i++) { - key = cookies[i] - val = JSONCookie(obj[key]) + for (const [key, value] of Object.entries(obj)) { + const decodedValue = JSONCookie(value) - if (val) { - obj[key] = val + if (decodedValue) { + obj[key] = decodedValue } }