Skip to content

Instantly share code, notes, and snippets.

@colmjude
Created July 26, 2011 10:02
Show Gist options
  • Save colmjude/1106417 to your computer and use it in GitHub Desktop.
Save colmjude/1106417 to your computer and use it in GitHub Desktop.
Extends the Local Storage Object to accept and retrieve objects
Storage.prototype.setObject = function(key, value) {
this.setItem(key, JSON.stringify(value));
};
Storage.prototype.getObject = function(key) {
return this.getItem(key) && JSON.parse(this.getItem(key));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment