Skip to content

Instantly share code, notes, and snippets.

@thepushkarp
Created December 5, 2020 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thepushkarp/40521a50f66920aac55cbc64b334bfd9 to your computer and use it in GitHub Desktop.
Save thepushkarp/40521a50f66920aac55cbc64b334bfd9 to your computer and use it in GitHub Desktop.
Retrieve all local storage items
// https://stackoverflow.com/a/17748203/10307491
function allStorage() {
var archive = {}, // Notice change here
keys = Object.keys(localStorage),
i = keys.length;
while ( i-- ) {
archive[ keys[i] ] = localStorage.getItem( keys[i] );
}
return archive;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment