diff --git a/coverage/tests.lcov b/coverage/tests.lcov index c4a64ff..91d833a 100644 --- a/coverage/tests.lcov +++ b/coverage/tests.lcov @@ -788,8 +788,8 @@ BRDA:175,26,0,44 BRDA:176,27,0,10 BRDA:176,28,0,34 BRDA:180,29,0,12 -BRDA:178,30,0,22 -BRDA:178,31,0,38 +BRDA:178,30,0,44 +BRDA:178,31,0,76 BRDA:193,32,0,122 BRDA:196,33,0,647 BRDA:199,34,0,658 @@ -15885,9 +15885,9 @@ BRDA:171,29,0,370 BRDA:182,30,0,370 BRDA:185,31,0,35 BRDA:188,32,0,335 -BRDA:186,33,0,37 -BRDA:186,34,0,351 -BRDA:189,35,0,11 +BRDA:186,33,0,72 +BRDA:186,34,0,682 +BRDA:189,35,0,346 BRDA:200,36,0,418 BRDA:209,37,0,41 BRDA:209,38,0,374 diff --git a/dist/gssql.js b/dist/gssql.js index d40c1b6..20ef536 100644 --- a/dist/gssql.js +++ b/dist/gssql.js @@ -1950,10 +1950,10 @@ class SelectTables { let results = []; if (logic === "AND") { - results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c))); + results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c)), recordIDs[0]); } if (logic === "OR") { - results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b)))); + results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b), recordIDs[0]))); } return results; @@ -5168,7 +5168,7 @@ class JoinTables { // skipcq: JS-0128 for (const rec of recIds) { temp.push(typeof rec[i] === 'undefined' ? [] : rec[i]); } - const row = temp.reduce((a, b) => a.filter(c => b.includes(c))); + const row = temp.reduce((accumulator, currentRecords) => accumulator.filter(c => currentRecords.includes(c)), temp[0]); if (row.length > 0) { result[i] = row; diff --git a/src/JoinTables.js b/src/JoinTables.js index d3b9225..0b8bebd 100644 --- a/src/JoinTables.js +++ b/src/JoinTables.js @@ -175,7 +175,7 @@ class JoinTables { // skipcq: JS-0128 for (const rec of recIds) { temp.push(typeof rec[i] === 'undefined' ? [] : rec[i]); } - const row = temp.reduce((a, b) => a.filter(c => b.includes(c))); + const row = temp.reduce((accumulator, currentRecords) => accumulator.filter(c => currentRecords.includes(c)), temp[0]); if (row.length > 0) { result[i] = row; diff --git a/src/Views.js b/src/Views.js index 9ac156d..48b63cd 100644 --- a/src/Views.js +++ b/src/Views.js @@ -183,10 +183,10 @@ class SelectTables { let results = []; if (logic === "AND") { - results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c))); + results = recordIDs.reduce((a, b) => a.filter(c => b.includes(c)), recordIDs[0]); } if (logic === "OR") { - results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b)))); + results = Array.from(new Set(recordIDs.reduce((a, b) => a.concat(b), recordIDs[0]))); } return results;