From 4c4d80994a1dcf0795ba3e33bb9c110fb8fed084 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Fri, 24 Nov 2023 01:20:11 -0500 Subject: [PATCH] Avoids unnecessary allocation --- src/views/viewBase.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/views/viewBase.ts b/src/views/viewBase.ts index bba6b5b..25f971b 100644 --- a/src/views/viewBase.ts +++ b/src/views/viewBase.ts @@ -483,17 +483,12 @@ export abstract class ViewBase< }) async findNode( predicate: (node: ViewNode) => boolean, - { - allowPaging = false, - canTraverse, - maxDepth = 2, - token, - }: { + options?: { allowPaging?: boolean; canTraverse?: (node: ViewNode) => boolean | Promise; maxDepth?: number; token?: CancellationToken; - } = {}, + }, ): Promise { const scope = getLogScope(); @@ -502,10 +497,10 @@ export abstract class ViewBase< const node = await this.findNodeCoreBFS( predicate, this.ensureRoot(), - allowPaging, - canTraverse, - maxDepth, - token, + options?.allowPaging ?? false, + options?.canTraverse, + options?.maxDepth ?? 2, + options?.token, ); return node;