diff --git a/lib/index.js b/lib/index.js index 6b8dc21..6bddfcf 100644 --- a/lib/index.js +++ b/lib/index.js @@ -44,7 +44,11 @@ // the keys will shift all over the place for (i = 0; i < w3cs.length; i += 1) { key = w3cs.key(i); - val = w3cs.getItem(key); + try { + val = JSON.parse(w3cs.getItem(key)); + } catch(e) { + return; + } json[key] = val; } w3cs.clear(); diff --git a/lib/package.json b/lib/package.json index 86a7578..6fd005a 100644 --- a/lib/package.json +++ b/lib/package.json @@ -3,7 +3,7 @@ "name": "json-storage", "description": "A wrapper for storage engines which use the W3C Storage API", "keywords": ["ender", "localStorage", "sessionStorage", "globalStorage", "Storage"], - "version": "1.1.0", + "version": "1.1.1", "repository": { "type": "git", "url": "git://github.com/coolaj86/json-storage-js.git"