Skip to content

Commit

Permalink
refactor: Replace filter + map with for-loop
Browse files Browse the repository at this point in the history
  • Loading branch information
matz3 committed Mar 26, 2024
1 parent 878c589 commit 9048ebd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/detectors/typeChecker/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ async function collectTransitiveDependencies(pkgName: string, deps: Set<string>)

async function collectSapui5TypesFiles() {
const typesDir = path.dirname(require.resolve("@sapui5/types/package.json"));
const typesFiles = await fs.readdir(path.join(typesDir, "types"), {withFileTypes: true});
return typesFiles
.filter((entry) => entry.isFile() && entry.name.endsWith(".d.ts") && entry.name !== "index.d.ts")
.map((entry) => entry.name);
const allFiles = await fs.readdir(path.join(typesDir, "types"), {withFileTypes: true});
const typesFiles = [];
for (const entry of allFiles) {
if (entry.isFile() && entry.name.endsWith(".d.ts") && entry.name !== "index.d.ts") {
typesFiles.push(entry.name);
}
}
return typesFiles;
}

function addSapui5TypesMappingToCompilerOptions(sapui5TypesFiles: string[], options: ts.CompilerOptions) {
Expand Down

0 comments on commit 9048ebd

Please sign in to comment.