refactor(cache): further condense walkTree (#393)

- `forEach` returns `void`, so we can just `return` it and condense the `if` a bit
This commit is contained in:
Anton Gilgur 2022-08-08 15:20:05 -04:00 committed by GitHub
parent ad29112a5f
commit bbed47e16a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,13 +188,9 @@ export class TsCache
public walkTree(cb: (id: string) => void | false): void
{
if (alg.isAcyclic(this.dependencyTree))
{
alg.topsort(this.dependencyTree).forEach(id => cb(id));
return;
}
return alg.topsort(this.dependencyTree).forEach(id => cb(id));
this.context.info(yellow("import tree has cycles"));
this.dependencyTree.nodes().forEach(id => cb(id));
}