Skip to content

Instantly share code, notes, and snippets.

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