From 17554ec7d58b7b51b63d8dc3601ae8e52e546d4b Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Wed, 1 Nov 2023 12:34:49 +0000 Subject: [PATCH] lint:fix --- internals/webpack/webpack.config.js | 30 ++++++++++++------------- src/index.js | 4 ++-- src/tests/test.index.js | 35 +++++++++++++++-------------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/internals/webpack/webpack.config.js b/internals/webpack/webpack.config.js index c27635d..b45c5f9 100644 --- a/internals/webpack/webpack.config.js +++ b/internals/webpack/webpack.config.js @@ -38,21 +38,21 @@ var config = { // eslint-disable-line if (env === 'production') { config.output.filename = filename + '.min.js'; // eslint-disable-line config.plugins - .push(new webpack.optimize.UglifyJsPlugin({ - compressor: { - pure_getters: true, - unsafe: true, - unsafe_comps: true, - warnings: false, - screw_ie8: false, - }, - mangle: { - screw_ie8: false, - }, - output: { - screw_ie8: false, - }, - })); + .push(new webpack.optimize.UglifyJsPlugin({ + compressor: { + pure_getters: true, + unsafe: true, + unsafe_comps: true, + warnings: false, + screw_ie8: false, + }, + mangle: { + screw_ie8: false, + }, + output: { + screw_ie8: false, + }, + })); } module.exports = config; diff --git a/src/index.js b/src/index.js index 2610b5b..c6533a2 100644 --- a/src/index.js +++ b/src/index.js @@ -159,7 +159,7 @@ function getKeys(params, key, allowEmpty) { var value = params[i][key]; // eslint-disable-line if (allowEmpty && !value) { value = ''; - } else if (typeof(value) !== 'string') { + } else if (typeof (value) !== 'string') { throw new Error('invalid abi'); } result.push(value); @@ -177,7 +177,7 @@ function getKeys(params, key, allowEmpty) { * @returns {Boolean} output the string is a hex string */ function isHexString(value, length) { - if (typeof(value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) { + if (typeof (value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) { return false; } diff --git a/src/tests/test.index.js b/src/tests/test.index.js index fe2604e..73ffd27 100644 --- a/src/tests/test.index.js +++ b/src/tests/test.index.js @@ -1,23 +1,24 @@ -const util = require('../index.js'); +/* eslint-disable import/no-extraneous-dependencies */ const assert = require('chai').assert; const BN = require('bn.js'); +const util = require('../index.js'); describe('check all exports', () => { it('should have all exports available', () => { const expected = ['arrayContainsArray', - 'toBuffer', - 'intToBuffer', - 'getBinarySize', - 'stripHexPrefix', - 'isHexPrefixed', - 'padToEven', - 'intToHex', - 'fromAscii', - 'fromUtf8', - 'toAscii', - 'getKeys', - 'isHexString', - 'toUtf8']; + 'toBuffer', + 'intToBuffer', + 'getBinarySize', + 'stripHexPrefix', + 'isHexPrefixed', + 'padToEven', + 'intToHex', + 'fromAscii', + 'fromUtf8', + 'toAscii', + 'getKeys', + 'isHexString', + 'toUtf8']; Object.keys(util).forEach((utilKey) => { assert.equal(expected.includes(utilKey), true, utilKey); @@ -330,9 +331,9 @@ describe('check all exports', () => { }); const toUtf8Tests = [ - { value: '0x6d79537472696e67', expected: 'myString' }, - { value: '0x6d79537472696e6700', expected: 'myString' }, - { value: '0x65787065637465642076616c7565000000000000000000000000000000000000', expected: 'expected value' }, + { value: '0x6d79537472696e67', expected: 'myString' }, + { value: '0x6d79537472696e6700', expected: 'myString' }, + { value: '0x65787065637465642076616c7565000000000000000000000000000000000000', expected: 'expected value' }, ]; describe('toUtf8', () => {