Safer include
This commit is contained in:
parent
0f040f7814
commit
c15ff3cad0
|
@ -92,12 +92,12 @@ AbstractClass.include = function (objects, include, cb) {
|
|||
|
||||
if (!keyVals[relation.keyFrom]) {
|
||||
objsByKeys[relation.keyFrom] = {};
|
||||
for (var j = 0; j < objs.length; j++) {
|
||||
if (!objsByKeys[relation.keyFrom][objs[j][relation.keyFrom]]) {
|
||||
objsByKeys[relation.keyFrom][objs[j][relation.keyFrom]] = [];
|
||||
objs.filter(Boolean).forEach(function(obj) {
|
||||
if (!objsByKeys[relation.keyFrom][obj[relation.keyFrom]]) {
|
||||
objsByKeys[relation.keyFrom][obj[relation.keyFrom]] = [];
|
||||
}
|
||||
objsByKeys[relation.keyFrom][objs[j][relation.keyFrom]].push(objs[j]);
|
||||
}
|
||||
objsByKeys[relation.keyFrom][obj[relation.keyFrom]].push(obj);
|
||||
});
|
||||
keyVals[relation.keyFrom] = Object.keys(objsByKeys[relation.keyFrom]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue