Skip to content

Commit

Permalink
style: Prefer null coalescing over ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
rylnd committed Feb 13, 2020
1 parent 56fc3f5 commit 7162528
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export const createCreateRulesBulkRoute = (
} = payloadRule;
const ruleIdOrUuid = ruleId ?? uuid.v4();
try {
const finalIndex =
outputIndex != null ? outputIndex : getIndex(spacesClient.getSpaceId, config);
const finalIndex = outputIndex ?? getIndex(spacesClient.getSpaceId, config);
const indexExists = await getIndexExists(clusterClient.callAsCurrentUser, finalIndex);
if (!indexExists) {
return createBulkErrorObject({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ export const createCreateRulesRoute = (
return headers.response().code(404);
}

const finalIndex =
outputIndex != null ? outputIndex : getIndex(spacesClient.getSpaceId, config);
const finalIndex = outputIndex ?? getIndex(spacesClient.getSpaceId, config);
const indexExists = await getIndexExists(clusterClient.callAsCurrentUser, finalIndex);
if (!indexExists) {
return headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export const createUpdateRulesBulkRoute = (
references,
version,
} = payloadRule;
const finalIndex =
outputIndex != null ? outputIndex : getIndex(spacesClient.getSpaceId, config);
const finalIndex = outputIndex ?? getIndex(spacesClient.getSpaceId, config);
const idOrRuleIdOrUnknown = id ?? ruleId ?? '(unknown id)';
try {
const rule = await updateRules({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ export const createUpdateRulesRoute = (
return headers.response().code(404);
}

const finalIndex =
outputIndex != null ? outputIndex : getIndex(spacesClient.getSpaceId, config);
const finalIndex = outputIndex ?? getIndex(spacesClient.getSpaceId, config);
const rule = await updateRules({
alertsClient,
actionsClient,
Expand Down

0 comments on commit 7162528

Please sign in to comment.