UNPKG

379 BJavaScriptView Raw
1const ADDRESS_PREFIX = "a0";
2const ADDRESS_SIZE = 42;
3
4
5function isAddressValid(address) {
6
7 if (!address || address.length === 0) {
8 return false;
9 }
10
11 if (address.length !== ADDRESS_SIZE) {
12 return false;
13 }
14
15 if (address.substr(0, 2).toUpperCase() !== ADDRESS_PREFIX.toUpperCase()) {
16 return false;
17 }
18
19 return true;
20}
21
22module.exports = {
23 isAddressValid,
24};