Skip to content

Commit

Permalink
Merge #1211
Browse files Browse the repository at this point in the history
1211: Use optional chaining instead of ternary operators in `searchGet` method r=bidoubiwa a=mmachatschek

# Pull Request

## What does this PR do?
This removes unnecessary ternary operators in the `searchGet` method

## PR checklist
Please check if your PR fulfills the following requirements:
- [ ] Does this PR fix an existing issue?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?


Co-authored-by: Markus Machatschek <markus.machatschek@hey.com>
  • Loading branch information
meili-bors[bot] and mmachatschek committed May 2, 2022
2 parents 7a967cb + bfb1ac6 commit aaa8716
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/lib/indexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,11 @@ class Index<T = Record<string, any>> {
q: query,
...options,
filter: parseFilter(options?.filter),
sort: options?.sort ? options.sort.join(',') : undefined,
facetsDistribution: options?.facetsDistribution
? options.facetsDistribution.join(',')
: undefined,
attributesToRetrieve: options?.attributesToRetrieve
? options.attributesToRetrieve.join(',')
: undefined,
attributesToCrop: options?.attributesToCrop
? options.attributesToCrop.join(',')
: undefined,
attributesToHighlight: options?.attributesToHighlight
? options.attributesToHighlight.join(',')
: undefined,
sort: options?.sort?.join(','),
facetsDistribution: options?.facetsDistribution?.join(','),
attributesToRetrieve: options?.attributesToRetrieve?.join(','),
attributesToCrop: options?.attributesToCrop?.join(','),
attributesToHighlight: options?.attributesToHighlight?.join(','),
}

return await this.httpRequest.get<SearchResponse<T>>(
Expand Down

0 comments on commit aaa8716

Please sign in to comment.