Comparing version 0.24.4 to 0.24.5
@@ -28,3 +28,2 @@ "use strict"; | ||
const targetIndex = {}, targetArrayIndex = {}, ids = []; | ||
let forcedIndex = 0; | ||
for (let entry of target) { | ||
@@ -45,11 +44,2 @@ const id = entry[this.sourceField]; | ||
} | ||
else if (this.forceArray) { | ||
if (targetArrayIndex[id]) | ||
targetArrayIndex[id].push({ entry, index: forcedIndex }); | ||
else | ||
targetArrayIndex[id] = [{ entry, index: forcedIndex }]; | ||
ids.push(id); | ||
entry[this.targetField] = []; | ||
forcedIndex++; | ||
} | ||
else { | ||
@@ -61,2 +51,4 @@ if (targetIndex[id]) | ||
ids.push(id); | ||
if (this.forceArray) | ||
entry[this.targetField] = []; | ||
} | ||
@@ -78,3 +70,6 @@ } | ||
for (let subEntry of targetIndex[id]) { | ||
subEntry[this.targetField] = entry; | ||
if (this.forceArray) | ||
subEntry[this.targetField].push(entry); | ||
else | ||
subEntry[this.targetField] = entry; | ||
} | ||
@@ -81,0 +76,0 @@ } |
{ | ||
"name": "api-core", | ||
"version": "0.24.4", | ||
"version": "0.24.5", | ||
"description": "Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -63,3 +63,2 @@ import {ApiQuery, ApiQueryScope, QueryStep} from "./ApiQuery"; | ||
let forcedIndex = 0; | ||
for(let entry of target) { | ||
@@ -78,9 +77,2 @@ const id = entry[this.sourceField]; | ||
} | ||
else if(this.forceArray) { | ||
if (targetArrayIndex[id]) targetArrayIndex[id].push({ entry, index: forcedIndex }); | ||
else targetArrayIndex[id] = [{entry, index: forcedIndex }]; | ||
ids.push(id); | ||
entry[this.targetField] = []; | ||
forcedIndex++ | ||
} | ||
else { | ||
@@ -90,2 +82,4 @@ if (targetIndex[id]) targetIndex[id].push(entry); | ||
ids.push(id); | ||
if (this.forceArray) | ||
entry[this.targetField] = []; | ||
} | ||
@@ -110,3 +104,6 @@ } | ||
for (let subEntry of targetIndex[id]) { | ||
subEntry[this.targetField] = entry; | ||
if (this.forceArray) | ||
subEntry[this.targetField].push(entry); | ||
else | ||
subEntry[this.targetField] = entry; | ||
} | ||
@@ -874,2 +871,2 @@ } | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
683677
8384