summaryrefslogtreecommitdiffstats
path: root/js/service/Resource.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-22 01:03:27 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-22 01:03:27 +0200
commitbf52ed4a0aedaf440733147e5e7fb086d16e9841 (patch)
treef23542228f2d6e8d6e647c6e4788f6fa52e45cdc /js/service/Resource.js
parent295adcbef7618f4a0b4781c92e4b1c32b31a5f36 (diff)
add generators to iterate over objects
Diffstat (limited to 'js/service/Resource.js')
-rw-r--r--js/service/Resource.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/js/service/Resource.js b/js/service/Resource.js
index 3c17872dc..832b9d791 100644
--- a/js/service/Resource.js
+++ b/js/service/Resource.js
@@ -25,18 +25,16 @@ app.factory('Resource', () => {
});
}
- add (value) {
- let existing = this.hashMap[value[this.id]];
+ add (obj) {
+ let existing = this.hashMap[obj[this.id]];
if (existing === undefined) {
- this.values.push(value);
- this.hashMap[value[this.id]] = value;
+ this.values.push(obj);
+ this.hashMap[obj[this.id]] = obj;
} else {
// copy values from new to old object if it exists already
- for (let key in value) {
- if (value.hasOwnProperty(key)) {
- existing[key] = value[key];
- }
+ for (let [key, value] of items(obj)) {
+ existing[key] = value;
}
}
}