Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
remove: function(key) {
var cookies = cookie.parse(document.cookie);
var sessionObject = JSON.parse(cookies["session"]);
delete sessionObject[key];
var sessionObjectJSON = JSON.stringify(sessionObject);
cookies["session"] = sessionObjectJSON;
document.cookie = cookie.serializeObject(cookies);
return localStorage.setItem("session", sessionObjectJSON);
},
removeAll: function() {
set: function(key, value) {
var sessionObjectJSON = localStorage.getItem("session") || "{}";
var sessionObject = JSON.parse(sessionObjectJSON);
if (typeof(sessionObject) != "object") {
sessionObject = {};
}
sessionObject[key] = value;
sessionObjectJSON = JSON.stringify(sessionObject);
document.cookie = cookie.serializeObject({
"session": sessionObjectJSON
});
return localStorage.setItem("session", sessionObjectJSON);
},
get: function(key) {