koblas / stdnum-js

A JavaScript library to provide functions to handle, parse and validate standard numbers.
MIT License
39 stars 26 forks source link

STDNUM-1 modulus precedes minus unexpectedly - so update the checksum logic #12

Closed Yongyiw closed 2 years ago

Yongyiw commented 2 years ago

Credits to: https://github.com/confluxpe/ruc-validate/blob/main/index.js

previously: const sum = 11 - weightedSum() % 10 should be const sum = (11 - weightedSum()) % 10

in this PR - corrected and cleaned up the checksum logic - added some extra test cases :)

commit-lint[bot] commented 2 years ago

Contributors

Yongyiw

Commit-Lint commands
You can trigger Commit-Lint actions by commenting on this PR: - `@Commit-Lint merge patch` will merge dependabot PR on "patch" versions (X.X.Y - Y change) - `@Commit-Lint merge minor` will merge dependabot PR on "minor" versions (X.Y.Y - Y change) - `@Commit-Lint merge major` will merge dependabot PR on "major" versions (Y.Y.Y - Y change) - `@Commit-Lint merge disable` will desactivate merge dependabot PR - `@Commit-Lint review` will approve dependabot PR - `@Commit-Lint stop review` will stop approve dependabot PR