-
-
Save nesvand/f4f0aaa883b529aa7d614e2e98e167d7 to your computer and use it in GitHub Desktop.
Storage dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Storage.prototype.dump = function () { | |
let dump = {}; | |
for (const key in this) { | |
if (this.hasOwnProperty(key)) { | |
try { | |
dump[key] = JSON.parse(this.getItem(key)); | |
} catch (e) { | |
dump[key] = this.getItem(key); | |
} | |
} | |
} | |
return dump; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment