diff --git a/packages/harmony-staking/src/stakingTransaction.ts b/packages/harmony-staking/src/stakingTransaction.ts index 7e69e06..0c484ee 100644 --- a/packages/harmony-staking/src/stakingTransaction.ts +++ b/packages/harmony-staking/src/stakingTransaction.ts @@ -237,17 +237,17 @@ export class Decimal { value: BN; constructor(value: string) { - if (value.length == 0) { + if (value.length === 0) { throw new Error(`decimal string is empty`); } - var value1 = value; - if (value[0] == '-') { + let value1 = value; + if (value[0] === '-') { throw new Error(`decimal fraction should be be between [0, 1]`); } - if (value[0] == '+') { + if (value[0] === '+') { value1 = value.substr(1); } - if (value1.length == 0) { + if (value1.length === 0) { throw new Error(`decimal string is empty`); } const spaced = value1.split(' '); @@ -255,14 +255,14 @@ export class Decimal { throw new Error(`bad decimal string`); } const splitted = value1.split('.'); - var len = 0; - var combinedStr = splitted[0]; - if (splitted.length == 2) { + let len = 0; + let combinedStr = splitted[0]; + if (splitted.length === 2) { len = splitted[1].length; - if (len == 0 || combinedStr.length == 0) { + if (len === 0 || combinedStr.length === 0) { throw new Error(`bad decimal length`); } - if (splitted[1][0] == '-') { + if (splitted[1][0] === '-') { throw new Error(`bad decimal string`); } combinedStr += splitted[1]; @@ -349,7 +349,7 @@ export class CreateValidator { } encodeArr(): any[] { - var raw: Array> = []; + const raw: Array> = []; this.slotPubKeys.forEach((pubKey) => { raw.push(pubKey); });