Skip to content

Commit 3c6861a

Browse files
committed
Stable Version 2.3.2
Fixes #17
1 parent 6df4345 commit 3c6861a

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
##### 2.3.2 - 12 December 2015
2+
3+
###### Backwards compatible bug fixes
4+
- #17 - Id map clean-up
5+
16
##### 2.3.0 - 24 November 2015
27

38
###### Backwards compatible API changes

dist/js-data-localstorage.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* js-data-localstorage
3-
* @version 2.3.1 - Homepage <http://www.js-data.io/docs/dslocalstorageadapter>
3+
* @version 2.3.2 - Homepage <http://www.js-data.io/docs/dslocalstorageadapter>
44
* @author Jason Dobry <jason.dobry@gmail.com>
55
* @copyright (c) 2014-2015 Jason Dobry
66
* @license MIT <https://github.com/js-data/js-data-localstorage/blob/master/LICENSE>
@@ -156,15 +156,19 @@ return /******/ (function(modules) { // webpackBootstrap
156156
if (idsJson) {
157157
ids = DSUtils.fromJson(idsJson);
158158
} else {
159-
this.storage.setItem(idsPath, DSUtils.toJson({}));
160159
ids = {};
161160
}
162161
return ids;
163162
}
164163
}, {
165164
key: 'saveKeys',
166165
value: function saveKeys(ids, resourceConfig, options) {
167-
this.storage.setItem(this.getPath(resourceConfig, options), DSUtils.toJson(ids));
166+
var idsPath = this.getPath(resourceConfig, options);
167+
if (!DSUtils.isEmpty(ids)) {
168+
this.storage.setItem(idsPath, DSUtils.toJson(ids));
169+
} else {
170+
this.storage.removeItem(idsPath);
171+
}
168172
}
169173
}, {
170174
key: 'ensureId',
@@ -564,10 +568,10 @@ return /******/ (function(modules) { // webpackBootstrap
564568
})();
565569

566570
DSLocalStorageAdapter.version = {
567-
full: '2.3.1',
571+
full: '2.3.2',
568572
major: parseInt('2', 10),
569573
minor: parseInt('3', 10),
570-
patch: parseInt('1', 10),
574+
patch: parseInt('2', 10),
571575
alpha: true ? 'false' : false,
572576
beta: true ? 'false' : false
573577
};

dist/js-data-localstorage.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js-data-localstorage.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-localstorage",
33
"description": "localStorage adapter for js-data.",
4-
"version": "2.3.1",
4+
"version": "2.3.2",
55
"homepage": "http://www.js-data.io/docs/dslocalstorageadapter",
66
"repository": {
77
"type": "git",
@@ -44,12 +44,12 @@
4444
"js-data": "~2.x"
4545
},
4646
"devDependencies": {
47-
"babel-core": "6.2.1",
47+
"babel-core": "6.3.17",
4848
"babel-eslint": "4.1.6",
4949
"babel-loader": "6.2.0",
50-
"babel-preset-es2015": "6.1.18",
50+
"babel-preset-es2015": "6.3.13",
5151
"codacy-coverage": "1.1.3",
52-
"coveralls": "2.11.4",
52+
"coveralls": "2.11.6",
5353
"es6-promise": "3.0.2",
5454
"js-data-adapter-tests": "~1.x",
5555
"karma": "0.13.15",

src/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,18 @@ class DSLocalStorageAdapter {
7676
if (idsJson) {
7777
ids = DSUtils.fromJson(idsJson)
7878
} else {
79-
this.storage.setItem(idsPath, DSUtils.toJson({}))
8079
ids = {}
8180
}
8281
return ids
8382
}
8483

8584
saveKeys (ids, resourceConfig, options) {
86-
this.storage.setItem(this.getPath(resourceConfig, options), DSUtils.toJson(ids))
85+
const idsPath = this.getPath(resourceConfig, options)
86+
if (!DSUtils.isEmpty(ids)) {
87+
this.storage.setItem(idsPath, DSUtils.toJson(ids))
88+
} else {
89+
this.storage.removeItem(idsPath)
90+
}
8791
}
8892

8993
ensureId (id, resourceConfig, options) {

0 commit comments

Comments
 (0)