Skip to content

Commit 0ffb61c

Browse files
author
Shlomi Assaf (shlassaf)
committed
fix logic for loading classes from modules
Closes #215
1 parent bdeb297 commit 0ffb61c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/util/importClassesFromDirectories.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ export function importClassesFromDirectories(directories: string[], formats = ["
88
const loadFileClasses = function (exported: any, allLoaded: Function[]) {
99
if (exported instanceof Function) {
1010
allLoaded.push(exported);
11-
12-
} else if (exported instanceof Object) {
13-
Object.keys(exported).forEach(key => loadFileClasses(exported[key], allLoaded));
14-
1511
} else if (exported instanceof Array) {
1612
exported.forEach((i: any) => loadFileClasses(i, allLoaded));
13+
} else if (exported instanceof Object || typeof exported === 'object') {
14+
Object.keys(exported).forEach(key => loadFileClasses(exported[key], allLoaded));
1715
}
1816

1917
return allLoaded;

0 commit comments

Comments
 (0)