Skip to content

Commit

Permalink
lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Nov 1, 2023
1 parent b223978 commit 17554ec
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
30 changes: 15 additions & 15 deletions internals/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down
35 changes: 18 additions & 17 deletions src/tests/test.index.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit 17554ec

Please sign in to comment.