aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-24 01:39:56 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-24 01:39:56 +0800
commitc9aef166495c0a1b1c34db01226602375c0b3547 (patch)
treef7b28657a056b1db96bd1314c165976b4c0c69f3 /packages/utils/src
parent6a77e0fe56b1fdc3bef990f8418d741c6a338763 (diff)
downloaddexon-0x-contracts-c9aef166495c0a1b1c34db01226602375c0b3547.tar.gz
dexon-0x-contracts-c9aef166495c0a1b1c34db01226602375c0b3547.tar.zst
dexon-0x-contracts-c9aef166495c0a1b1c34db01226602375c0b3547.zip
Fix linter issues
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/address_utils.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/utils/src/address_utils.ts b/packages/utils/src/address_utils.ts
index cc43bd477..1fc960408 100644
--- a/packages/utils/src/address_utils.ts
+++ b/packages/utils/src/address_utils.ts
@@ -4,6 +4,7 @@ import * as _ from 'lodash';
const BASIC_ADDRESS_REGEX = /^(0x)?[0-9a-f]{40}$/i;
const SAME_CASE_ADDRESS_REGEX = /^(0x)?([0-9a-f]{40}|[0-9A-F]{40})$/;
+const ADDRESS_LENGTH = 40;
export const addressUtils = {
isChecksumAddress(address: string): boolean {
@@ -11,8 +12,7 @@ export const addressUtils = {
const unprefixedAddress = address.replace('0x', '');
const addressHash = jsSHA3.keccak256(unprefixedAddress.toLowerCase());
- const addressLength = 40;
- for (let i = 0; i < addressLength; i++) {
+ for (let i = 0; i < ADDRESS_LENGTH; i++) {
// The nth letter should be uppercase if the nth digit of casemap is 1
const hexBase = 16;
const lowercaseRange = 7;
@@ -41,6 +41,6 @@ export const addressUtils = {
}
},
padZeros(address: string): string {
- return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0'));
+ return addHexPrefix(_.padStart(stripHexPrefix(address), ADDRESS_LENGTH, '0'));
},
};