Skip to content

fix: correct invalid use of cases in switch#187

Merged
asyncapi-bot merged 2 commits intoasyncapi:masterfrom
dalelane:fix-switch
Mar 8, 2024
Merged

fix: correct invalid use of cases in switch#187
asyncapi-bot merged 2 commits intoasyncapi:masterfrom
dalelane:fix-switch

Conversation

@dalelane
Copy link
Collaborator

@dalelane dalelane commented Mar 8, 2024

The use of OR's in switch isn't valid.

For an example, try this in Node.js:

const testvalue = 'option4';

switch (testvalue) {
    case ('option1' || 'option2'):
        console.log('1 or 2');
        break;
    case ('option3' || 'option4' || 'option5'):
        console.log('3, 4, or 5');
        break;
    default:
        console.log('unrecognised ' + testvalue)
}

This means we fail to recognise some type options.

Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 8, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
2.8% Duplication on New Code

See analysis details on SonarCloud

@dalelane
Copy link
Collaborator Author

dalelane commented Mar 8, 2024

/rtm

@asyncapi-bot asyncapi-bot merged commit 9e456ee into asyncapi:master Mar 8, 2024
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants