Created
January 7, 2016 14:30
-
-
Save jonniedarko/64cb45b1f611c6a16f3b to your computer and use it in GitHub Desktop.
Useful console functions
This file contains hidden or 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
var localStorageToJSON = function localStorageToJSONFn(obj){ | |
var storage = {}; | |
for(var item in obj){ | |
try{ | |
json = JSON.parse(obj[item]); | |
storage[item] = json; | |
} catch(err){ | |
storage[item] = obj[item] | |
} | |
} | |
return storage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment