Replace lodash with built-ins where possible to reduce bundle size (#1766)

* add tslint rule to disallow lodash.isUndefined

* add tslint rule to disallow lodash.isNull

* apply fixes
This commit is contained in:
Xianny
2019-04-10 09:36:32 -07:00
committed by GitHub
parent 49d951b7be
commit 7423028fea
299 changed files with 1249 additions and 1038 deletions

View File

@@ -70,7 +70,7 @@ describe('MultiSigWalletWithTimeLock', () => {
REQUIRED_APPROVALS,
secondsTimeLocked,
);
expect(_.isUndefined((multiSig as any).external_call)).to.be.equal(true);
expect((multiSig as any).external_call === undefined).to.be.equal(true);
});
});
describe('confirmTransaction', () => {
@@ -271,7 +271,7 @@ describe('MultiSigWalletWithTimeLock', () => {
const blockNum = await web3Wrapper.getBlockNumberAsync();
const blockInfo = await web3Wrapper.getBlockIfExistsAsync(blockNum);
if (_.isUndefined(blockInfo)) {
if (blockInfo === undefined) {
throw new Error(`Unexpectedly failed to fetch block at #${blockNum}`);
}
const timestamp = new BigNumber(blockInfo.timestamp);

View File

@@ -3,7 +3,6 @@ import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
import { artifacts } from '../../src/artifacts';
@@ -23,7 +22,7 @@ export class AssetProxyOwnerWrapper {
from: string,
opts: { value?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
const value = opts.value === undefined ? new BigNumber(0) : opts.value;
const txHash = await this._assetProxyOwner.submitTransaction.sendTransactionAsync(destination, value, data, {
from,
});

View File

@@ -2,7 +2,6 @@ import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
import { artifacts } from '../../src/artifacts';
@@ -22,7 +21,7 @@ export class MultiSigWrapper {
from: string,
opts: { value?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
const value = opts.value === undefined ? new BigNumber(0) : opts.value;
const txHash = await this._multiSig.submitTransaction.sendTransactionAsync(destination, value, data, {
from,
});