Skip to content

Instantly share code, notes, and snippets.

@levigideon
Created July 18, 2014 00:30
Show Gist options
  • Save levigideon/61ffcf378b57f7a83025 to your computer and use it in GitHub Desktop.
Save levigideon/61ffcf378b57f7a83025 to your computer and use it in GitHub Desktop.
localstorage dump
Storage.prototype.dump = function () {
var count = this.length,
dump = {};
for (var i = 0; i < count; i++) {
try {
dump[localStorage.key(i)] = JSON.parse(this.getItem(localStorage.key(i)));
} catch (e) {
dump[localStorage.key(i)] = this.getItem(localStorage.key(i));
}
}
return dump;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment