Skip to content

Commit 53db620

Browse files
committed
refactor(boot): remove 'for in' workaround
1 parent 102a768 commit 53db620

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/boot/src/booters/booter-utils.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export function isClass(target: any): target is Constructor<any> {
4444
* and then testing each exported member to see if it's a class or not.
4545
*
4646
* @param files An array of string of absolute file paths
47+
* @param projectRootDir The project root directory
4748
* @returns {Constructor<{}>[]} An array of Class constructors from a file
4849
*/
4950
export function loadClassesFromFiles(
@@ -54,10 +55,7 @@ export function loadClassesFromFiles(
5455
for (const file of files) {
5556
debug('Loading artifact file %j', path.relative(projectRootDir, file));
5657
const moduleObj = require(file);
57-
// WORKAROUND: use `for in` instead of Object.values().
58-
// See https://github.com/nodejs/node/issues/20278
59-
for (const k in moduleObj) {
60-
const exported = moduleObj[k];
58+
for (const [k, exported] of Object.entries(moduleObj)) {
6159
if (isClass(exported)) {
6260
debug(' add %s (class %s)', k, exported.name);
6361
classes.push(exported);

0 commit comments

Comments
 (0)