Skip to content

Instantly share code, notes, and snippets.

@Tinusw
Created April 19, 2018 10:51
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 Tinusw/82f436dee2401263607611ec028f2cce to your computer and use it in GitHub Desktop.
Save Tinusw/82f436dee2401263607611ec028f2cce to your computer and use it in GitHub Desktop.
export function storageMock() {
var storage = {};
return {
setItem: function(key, value) {
storage[key] = value || "";
},
getItem: function(key) {
return key in storage ? storage[key] : null;
},
removeItem: function(key) {
delete storage[key];
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment