Open tshemsedinov opened 3 months ago
According to ISO 7064 each letter in the IBAN string must be replaced with two digits, where A = 10, B = 11, ..., Z = 35.
Is there any way to replace charCodeAt
and 55 to avoid magic number, but keep is short?
I've added other countries to the validator as well:
Is there any way to replace
charCodeAt
and 55 to avoid magic number, but keep is short?
To make code understandable all constants should have names and if there are series of constants (for example certain places in BLOB or code, like we have in this place) it should be represented as collection and offsets (see implementation of IP packet parsing or any other binary data structure representation parser).
https://github.com/diia-open-source/be-pkg-utils/blob/e969374fb769e59ab6bbdb709caeba0199e14a8c/src/applicationUtils.ts#L240-L253
validateIbanUA
or better move country to arguments and get universal solution