Skip to content

Instantly share code, notes, and snippets.

@nefarioustim
Last active December 19, 2015 12:39
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 nefarioustim/5955934 to your computer and use it in GitHub Desktop.
Save nefarioustim/5955934 to your computer and use it in GitHub Desktop.
(function (LocalStorage) {
var DELIM = "|";
LocalStorage.readit = function (key) {
console.log('FN .get for key', key);
var str = localStorage.getItem(key);
console.log('get raw=', str); // e.g. 't35'
if (str === null || str === ''){
return null
}
console.log('delim', DELIM); // outputs |
var rv = str.split(DELIM); // split is not in-place
console.log('splitted', rv); // rv = [''] not 't35'?!
return rv;
}
})(window.LocalStorage = window.LocalStorage || {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment