Check for undefined, null or zero repositories
`undefined`, `null` and 0 will evaluate to `false` so if we only want to
display the repository count when these values are not present we can
check for a truthy value:
```
query.repositoryCount ? `(${pluralize(...)})` : '';
```
instead of checking explicitly:
```
query.repositoryCount !== undefined && query.repositoryCount !== null && query.repositoryCount != 0 ? `(${pluralize(...)})` : '';
```
This commit is contained in:
@@ -110,7 +110,7 @@ export async function exportResultsToGist(
|
||||
const buildGistDescription = (query: RemoteQuery, analysesResults: AnalysisResults[]) => {
|
||||
const resultCount = sumAnalysesResults(analysesResults);
|
||||
const resultLabel = pluralize(resultCount, 'result', 'results');
|
||||
const repositoryLabel = query.repositoryCount !== undefined ? `(${pluralize(query.repositoryCount, 'repository', 'repositories')})` : '';
|
||||
const repositoryLabel = query.repositoryCount ? `(${pluralize(query.repositoryCount, 'repository', 'repositories')})` : '';
|
||||
return `${query.queryName} (${query.language}) ${resultLabel} ${repositoryLabel}`;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user