Skip to content

Commit

Permalink
Use chaining
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew W. Harn <[email protected]>
  • Loading branch information
awharn committed Nov 21, 2024
1 parent b7cfbce commit f641bb1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/zosfiles/src/methods/search/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;

Check warning on line 254 in packages/zosfiles/src/methods/search/Search.ts

View check run for this annotation

Codecov / codecov/patch

packages/zosfiles/src/methods/search/Search.ts#L254

Added line #L254 was not covered by tests
}

Expand Down Expand Up @@ -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;

Check warning on line 323 in packages/zosfiles/src/methods/search/Search.ts

View check run for this annotation

Codecov / codecov/patch

packages/zosfiles/src/methods/search/Search.ts#L323

Added line #L323 was not covered by tests
}

Expand Down

0 comments on commit f641bb1

Please sign in to comment.