@carbonorm/carbonnode 3.9.5 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,19 +14,22 @@ export abstract class JoinBuilder<G extends OrmGenerics> extends ConditionBuilde
14
14
  buildJoinClauses(joinArgs: any, params: any[] | Record<string, any>): string {
15
15
  let sql = '';
16
16
 
17
- for (const joinType in joinArgs) {
18
- const joinKind = joinType.replace('_', ' ').toUpperCase();
17
+ const joinTypeEntries: Array<[string, any]> = joinArgs instanceof Map
18
+ ? Array.from(joinArgs.entries()).map(([key, value]) => [String(key), value])
19
+ : Object.keys(joinArgs).map(key => [key, (joinArgs as Record<string, any>)[key]]);
20
+
21
+ for (const [joinTypeRaw, joinSection] of joinTypeEntries) {
22
+ const joinKind = joinTypeRaw.replace('_', ' ').toUpperCase();
19
23
  const entries: Array<[any, any]> = [];
20
- const joinSection = joinArgs[joinType];
21
24
 
22
25
  if (joinSection instanceof Map) {
23
26
  joinSection.forEach((value, key) => {
24
27
  entries.push([key, value]);
25
28
  });
26
29
  } else {
27
- for (const raw in joinSection) {
30
+ Object.keys(joinSection).forEach(raw => {
28
31
  entries.push([raw, joinSection[raw]]);
29
- }
32
+ });
30
33
  }
31
34
 
32
35
  for (const [rawKey, conditions] of entries) {