From bbed47e16a7678f4f182f412a29a4cef77a2bd77 Mon Sep 17 00:00:00 2001 From: Anton Gilgur <agilgur5@gmail.com> Date: Mon, 8 Aug 2022 15:20:05 -0400 Subject: [PATCH] refactor(cache): further condense `walkTree` (#393) - `forEach` returns `void`, so we can just `return` it and condense the `if` a bit --- src/tscache.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/tscache.ts b/src/tscache.ts index a1a31064..96e6bc82 100644 --- a/src/tscache.ts +++ b/src/tscache.ts @@ -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)); }