Convert if else to switch (Typescript)

  angular, javascript, typescript

I have method that checks 2 parameters and return string

Here is code

private getClientBankAuthStatus(bankAuth: BankAuthenticationDto, isExpired: boolean): string {
    if (bankAuth && isExpired) {
        return 'Expired';
    }
    if (bankAuth && !isExpired) {
        return 'Yes';
    }
    if (!bankAuth) {
        return 'No';
    }
}

Can I somehow convert it to switch-case?

Source: Ask Javascript Questions

LEAVE A COMMENT