3
3
// This file is licensed under the MIT License.
4
4
// License text available at https://opensource.org/licenses/MIT
5
5
6
- import { Constructor } from '@loopback/context' ;
6
+ import { Constructor } from '@loopback/context' ;
7
7
import * as debugFactory from 'debug' ;
8
8
import * as path from 'path' ;
9
- import { promisify } from 'util' ;
9
+ import { promisify } from 'util' ;
10
10
const glob = promisify ( require ( 'glob' ) ) ;
11
11
12
12
const debug = debugFactory ( 'loopback:boot:booter-utils' ) ;
@@ -22,7 +22,7 @@ export async function discoverFiles(
22
22
pattern : string ,
23
23
root : string ,
24
24
) : Promise < string [ ] > {
25
- return await glob ( pattern , { root : root } ) ;
25
+ return await glob ( pattern , { root : root } ) ;
26
26
}
27
27
28
28
/**
@@ -44,6 +44,7 @@ export function isClass(target: any): target is Constructor<any> {
44
44
* and then testing each exported member to see if it's a class or not.
45
45
*
46
46
* @param files An array of string of absolute file paths
47
+ * @param projectRootDir The project root directory
47
48
* @returns {Constructor<{}>[] } An array of Class constructors from a file
48
49
*/
49
50
export function loadClassesFromFiles (
@@ -54,8 +55,6 @@ export function loadClassesFromFiles(
54
55
for ( const file of files ) {
55
56
debug ( 'Loading artifact file %j' , path . relative ( projectRootDir , file ) ) ;
56
57
const moduleObj = require ( file ) ;
57
- // WORKAROUND: use `for in` instead of Object.values().
58
- // See https://github.com/nodejs/node/issues/20278
59
58
for ( const k in moduleObj ) {
60
59
const exported = moduleObj [ k ] ;
61
60
if ( isClass ( exported ) ) {
0 commit comments