From 16fb1c730ecd731ee2d08aef80f422f08ac8a3b3 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 3 Mar 2012 13:04:29 -0700 Subject: [PATCH] fixed bug with upgrading from 1.0.x --- lib/index.js | 6 +++++- lib/package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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"