Skip to content

Commit 5de8c95

Browse files
author
Fabricio Vergara
authored
Update EntityFactory.ts
1 parent 1f17d12 commit 5de8c95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/seeds/EntityFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class EntityFactory<Entity> implements EntityFactoryInterface<Entity> {
7474
if (this.isPromiseLike(entity[attribute])) {
7575
entity[attribute] = await entity[attribute];
7676
}
77-
77+
7878
if (typeof entity[attribute] === 'object' && entity[attribute] instanceof EntityFactory) {
7979
const subEntityFactory = entity[attribute];
8080
const subEntity = await (subEntityFactory as any).build();
@@ -86,6 +86,6 @@ export class EntityFactory<Entity> implements EntityFactoryInterface<Entity> {
8686
}
8787

8888
private isPromiseLike(object: any): boolean {
89-
return object && typeof object.then === 'function';
89+
return !!object && (typeof object === 'object' || typeof object === 'function') && typeof object.then === 'function';
9090
}
9191
}

0 commit comments

Comments
 (0)