refactor: Prevent for-each calls

This commit is contained in:
Joachim Van Herwegen
2023-10-30 16:58:39 +01:00
parent 20d4a0c3af
commit c9e4c7041c
7 changed files with 13 additions and 9 deletions

View File

@@ -146,7 +146,7 @@ export function mockFileSystem(rootFilepath?: string, time?: Date): { data: any
const name = parts.at(-1) as string;
parts = parts.slice(0, -1);
let folder = cache.data;
parts.forEach((part): any => {
for (const part of parts) {
if (typeof folder === 'string') {
throwSystemError('ENOTDIR');
}
@@ -154,7 +154,7 @@ export function mockFileSystem(rootFilepath?: string, time?: Date): { data: any
if (!folder) {
throwSystemError('ENOENT');
}
});
}
return { folder, name };
}