Skip to content

Commit

Permalink
ternarys are okay, if you write them correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jgravois committed Aug 7, 2018
1 parent c4daf3c commit 15e80a1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/arcgis-rest-auth/src/generate-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import {
request,
IRequestOptions,
IGenerateTokenParams,
IGenerateTokenRequestOptions
} from "@esri/arcgis-rest-request";
Expand All @@ -18,14 +19,10 @@ export function generateToken(
requestOptionsOrParams: IGenerateTokenParams | IGenerateTokenRequestOptions
): Promise<IGenerateTokenResponse> {
// TODO: remove union type and type guard next breaking change and just expect IGenerateTokenRequestOptions
let options: IGenerateTokenRequestOptions;
if ((requestOptionsOrParams as IGenerateTokenRequestOptions).params) {
options = requestOptionsOrParams as IGenerateTokenRequestOptions;
} else {
options = {
params: requestOptionsOrParams
};
}
const options: IRequestOptions = (requestOptionsOrParams as IGenerateTokenRequestOptions)
.params
? (requestOptionsOrParams as IRequestOptions)
: { params: requestOptionsOrParams };

/* istanbul ignore else */
if (
Expand Down

0 comments on commit 15e80a1

Please sign in to comment.