Skip to content

Instantly share code, notes, and snippets.

@BoyCook
Created January 9, 2014 14:46
Show Gist options
  • Save BoyCook/8335198 to your computer and use it in GitHub Desktop.
Save BoyCook/8335198 to your computer and use it in GitHub Desktop.
localStorage overrides to get/set item as JSON
Storage.prototype.setItem = function(key, obj) {
return this.setItem(key, JSON.stringify(obj));
};
Storage.prototype.getItem = function(key) {
return JSON.parse(this.getItem(key));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment