Skip to content

Instantly share code, notes, and snippets.

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 pfftdammitchris/eb8abb9d52d8080b1f33188c8454cb01 to your computer and use it in GitHub Desktop.
Save pfftdammitchris/eb8abb9d52d8080b1f33188c8454cb01 to your computer and use it in GitHub Desktop.
function LocalStorage(options) {
let _data = {}
let _options = options || {}
return {
get(key) {
return _data[key]
},
set(key, value) {
_data[key] = value
},
remove(key) {
delete _data[key]
},
clear() {
_data = {}
},
}
}
const createLocalStorage = (function () {
return function createLocalStorage(options) {
if (!ls) {
ls = LocalStorage(options)
}
return ls
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment