Created
April 19, 2018 16:07
-
-
Save Tinusw/6487bf53bffbfd8a9d4399db65b23e46 to your computer and use it in GitHub Desktop.
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
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