Skip to content

quickmath #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2022
Merged

quickmath #278

merged 1 commit into from
Nov 23, 2022

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Nov 23, 2022

Checklist

@Uzlopak Uzlopak requested a review from mcollina November 23, 2022 15:16
@@ -12,7 +12,7 @@ function liftErrorCode (code) {
return 1011
} else if (code === 1004 || code === 1005 || code === 1006) {
// ws module forbid those error codes usage, lift to "application level" (4xxx)
return 4000 + (code % 1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was the % 1000) part unnecessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if clause already narrows the values down to the numbers 1004, 1005 and 1006.
So the % 1000 would just return the numbers 4, 5 and 6.

So we can save us the modulo and directly add 3000 instead of 4000.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smart!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@Uzlopak Uzlopak merged commit c68564f into master Nov 23, 2022
@Uzlopak Uzlopak deleted the quickmath branch November 23, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants