Eslint formatting updates (#4234)
* Eslint updated (newline-after-var) * Fix newline-after-var * Eslint updated (one-var-declaration-per-line) * Fix one-var-declaration-per-line * Fix additional errors * Lint after merge
This commit is contained in:
@@ -48,11 +48,13 @@ export function asciiToHex (string) {
|
||||
|
||||
export function padRight (input, length) {
|
||||
const value = toHex(input).substr(2, length * 2);
|
||||
|
||||
return '0x' + value + range(length * 2 - value.length).map(() => '0').join('');
|
||||
}
|
||||
|
||||
export function padLeft (input, length) {
|
||||
const value = toHex(input).substr(2, length * 2);
|
||||
|
||||
return '0x' + range(length * 2 - value.length).map(() => '0').join('') + value;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ export function sha3 (value, options) {
|
||||
|
||||
if (forceHex || (!options && isHex(value))) {
|
||||
const bytes = hexToBytes(value);
|
||||
|
||||
return sha3(bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ describe('api/util/sha3', () => {
|
||||
|
||||
it('constructs a correct sha3 encoded as hex', () => {
|
||||
const key = '000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298' + '0000000000000000000000000000000000000000000000000000000000000001';
|
||||
|
||||
expect(sha3(key, { encoding: 'hex' })).to.equal('0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9');
|
||||
expect(sha3(`0x${key}`, { encoding: 'hex' })).to.equal('0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user