From f641bb1e287f5ee487b18eafac4bbca821ad2956 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Thu, 21 Nov 2024 09:40:21 -0500 Subject: [PATCH] Use chaining Signed-off-by: Andrew W. Harn --- packages/zosfiles/src/methods/search/Search.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/zosfiles/src/methods/search/Search.ts b/packages/zosfiles/src/methods/search/Search.ts index 8e508d6226..f1431e77f4 100644 --- a/packages/zosfiles/src/methods/search/Search.ts +++ b/packages/zosfiles/src/methods/search/Search.ts @@ -146,7 +146,7 @@ export class Search { searchOptions.progressTask.stageName = TaskStage.FAILED; searchOptions.progressTask.percentComplete = 100; searchOptions.progressTask.statusMessage = "Operation timed out"; - } else if (searchOptions.abortSearch && searchOptions.abortSearch()) { + } else if (searchOptions.abortSearch?.()) { searchOptions.progressTask.stageName = TaskStage.FAILED; searchOptions.progressTask.percentComplete = 100; searchOptions.progressTask.statusMessage = "Operation cancelled"; @@ -181,7 +181,7 @@ export class Search { apiResponse: matchResponses }; - if (searchOptions.abortSearch && searchOptions.abortSearch()) { + if (searchOptions.abortSearch?.()) { // Notify the user the search was cancelled, and give the results from before the cancellation. apiResponse.commandResponse = "The search was cancelled.\n" + apiResponse.commandResponse; } @@ -246,11 +246,11 @@ export class Search { const failures: string[] = []; const total = searchItems.length; let complete = 0; - let searchAborted: boolean = searchOptions.abortSearch && searchOptions.abortSearch(); + let searchAborted: boolean = searchOptions.abortSearch?.(); const createSearchPromise = async (searchItem: ISearchItem) => { if (!this.timerExpired && !searchAborted) { - if (searchOptions.abortSearch && searchOptions.abortSearch()) { + if (searchOptions.abortSearch?.()) { searchAborted = true; } @@ -315,11 +315,11 @@ export class Search { const failures: string[] = []; const total = searchItems.length; let complete = 0; - let searchAborted: boolean = searchOptions.abortSearch && searchOptions.abortSearch(); + let searchAborted: boolean = searchOptions.abortSearch?.(); const createFindPromise = async (searchItem: ISearchItem) => { if (!this.timerExpired && !searchAborted) { - if (searchOptions.abortSearch && searchOptions.abortSearch()) { + if (searchOptions.abortSearch?.()) { searchAborted = true; }