Skip to content

Commit

Permalink
chore: Bump to v1.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Trinh authored and Scott Trinh committed Apr 28, 2017
1 parent 126a72f commit 2cf14cd
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="1.3.6"></a>
# 1.3.6 (2017-04-28)


## Bug Fixes

- Always remove $$hashKey from object or array objects
([1237fac1](https://github.com/ocombe/angular-localForage/commit/1237fac1b6536a739887819b5175044908f6d866))


<a name="1.3.5"></a>
# 1.3.5 (2017-02-22)

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-localforage",
"main": "dist/angular-localForage.js",
"version": "1.3.5",
"version": "1.3.6",
"homepage": "https://github.com/ocombe/angular-localForage",
"authors": [
"Olivier Combe <[email protected]>"
Expand Down
30 changes: 22 additions & 8 deletions dist/angular-localForage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* angular-localforage - Angular service & directive for https://github.com/mozilla/localForage (Offline storage, improved.)
* @version v1.3.5
* @version v1.3.6
* @link https://github.com/ocombe/angular-localForage
* @license MIT
* @author Olivier Combe <[email protected]>
Expand Down Expand Up @@ -126,13 +126,7 @@
} else {
var deferred = $q.defer(),
args = arguments,
localCopy = value;

//avoid $promises attributes from value objects, if present.
if(angular.isObject(localCopy) && angular.isDefined(localCopy.$promise)) {
localCopy = angular.extend({}, value);
delete localCopy.$promise;
}
localCopy = stripMeta(value);

self._localforage.setItem(self.prefix() + key, localCopy)
.then(function success() {
Expand All @@ -151,6 +145,26 @@

return deferred.promise;
}

function stripMeta(value) {
var copy;
if (angular.isArray(value)) {
return value.map(stripMeta);
} else if (angular.isObject(value) && !(value instanceof Blob)) {
copy = angular.extend({}, value);

angular.isDefined(copy.$promise) && delete copy.$promise;
angular.isDefined(copy.$$hashKey) && delete copy.$$hashKey;

return Object
.keys(copy)
.reduce(function stripEntries(acc, key) {
acc[key] = stripMeta(copy[key]);
return acc;
}, {});
}
return value;
}
};

// Directly get a value from storage
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-localForage.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-localforage",
"version": "1.3.5",
"version": "1.3.6",
"description": "Angular service & directive for https://github.com/mozilla/localForage (Offline storage, improved.)",
"license": "MIT",
"main": "dist/angular-localForage.js",
Expand Down

0 comments on commit 2cf14cd

Please sign in to comment.