Skip to content

Commit

Permalink
replace if statement with switch
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushmau5 committed Jul 8, 2022
1 parent 632597a commit 504873f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/commands/diff.ts
Expand Up @@ -186,16 +186,12 @@ export default class Diff extends Command {
* @returns The output(if the format exists) or a message indicating the format doesn't exist
*/
function genericOutput(diffOutput: AsyncAPIDiff, outputType: string) {
if (outputType === 'breaking') {
return diffOutput.breaking();
} else if (outputType === 'non-breaking') {
diffOutput.nonBreaking();
} else if (outputType === 'unclassified') {
return diffOutput.unclassified();
} else if (outputType === 'all') {
return diffOutput.getOutput();
} else {
return `The output type ${outputType} is not supported at the moment.`;
switch (outputType) {
case 'breaking': return diffOutput.breaking();
case 'non-breaking': return diffOutput.nonBreaking();
case 'unclassified': return diffOutput.unclassified();
case 'all': return diffOutput.getOutput();
default: return `The output type ${outputType} is not supported at the moment.`;
}
}

Expand Down

0 comments on commit 504873f

Please sign in to comment.