fixed bug where if toJSON is called before keys, it threw an error

This commit is contained in:
AJ ONeal 2012-03-03 14:05:37 -07:00
parent 16fb1c730e
commit a704e4ad02
2 changed files with 3 additions and 2 deletions

View File

@ -75,6 +75,7 @@
this._store = w3cStorage;
this._keysAreDirty = true;
this._keys = [];
if (!this._store.getItem('_json-storage-namespaced_')) {
upgradeStorage(this, w3cStorage);
}
@ -135,7 +136,7 @@
var json = {}
;
this._keys.forEach(function (key) {
this.keys().forEach(function (key) {
json[key] = this.get(key);
}, this);

View File

@ -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.1",
"version": "1.1.2",
"repository": {
"type": "git",
"url": "git://github.com/coolaj86/json-storage-js.git"