aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-21 19:56:14 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-21 19:56:14 +0800
commit40a7be0690c81d2e42543aa075ef8da6606e7b7e (patch)
tree73231f3671133364b53d55074f27e03bd61a1d38 /test/utils
parent096d3bdb26921cb3e7d05e65dc286ddf49f98a8a (diff)
downloaddexon-0x-contracts-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar.gz
dexon-0x-contracts-40a7be0690c81d2e42543aa075ef8da6606e7b7e.tar.zst
dexon-0x-contracts-40a7be0690c81d2e42543aa075ef8da6606e7b7e.zip
Use different lodash import syntax which allows to include only used functions
Diffstat (limited to 'test/utils')
-rw-r--r--test/utils/order_factory.ts7
-rw-r--r--test/utils/token_utils.ts10
2 files changed, 10 insertions, 7 deletions
diff --git a/test/utils/order_factory.ts b/test/utils/order_factory.ts
index ef19f2c4c..ec16df22d 100644
--- a/test/utils/order_factory.ts
+++ b/test/utils/order_factory.ts
@@ -1,4 +1,5 @@
-import * as _ from 'lodash';
+import assign from 'lodash/assign';
+import isUndefined from 'lodash/isUndefined';
import * as BigNumber from 'bignumber.js';
import {ZeroEx, SignedOrder} from '../../src';
@@ -16,7 +17,7 @@ export const orderFactory = {
feeRecipient: string,
expirationUnixTimestampSec?: BigNumber.BigNumber): Promise<SignedOrder> {
const defaultExpirationUnixTimestampSec = new BigNumber(2524604400); // Close to infinite
- expirationUnixTimestampSec = _.isUndefined(expirationUnixTimestampSec) ?
+ expirationUnixTimestampSec = isUndefined(expirationUnixTimestampSec) ?
defaultExpirationUnixTimestampSec :
expirationUnixTimestampSec;
const order = {
@@ -34,7 +35,7 @@ export const orderFactory = {
};
const orderHash = await zeroEx.getOrderHashHexAsync(order);
const ecSignature = await zeroEx.signOrderHashAsync(orderHash, maker);
- const signedOrder: SignedOrder = _.assign(order, {ecSignature});
+ const signedOrder: SignedOrder = assign(order, {ecSignature});
return signedOrder;
},
};
diff --git a/test/utils/token_utils.ts b/test/utils/token_utils.ts
index f4fa7ac31..658cfe864 100644
--- a/test/utils/token_utils.ts
+++ b/test/utils/token_utils.ts
@@ -1,4 +1,6 @@
-import * as _ from 'lodash';
+import find from 'lodash/find';
+import filter from 'lodash/filter';
+import isUndefined from 'lodash/isUndefined';
import {Token, ZeroExError} from '../../src';
const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
@@ -9,14 +11,14 @@ export class TokenUtils {
this.tokens = tokens;
}
public getProtocolTokenOrThrow(): Token {
- const zrxToken = _.find(this.tokens, {symbol: PROTOCOL_TOKEN_SYMBOL});
- if (_.isUndefined(zrxToken)) {
+ const zrxToken = find(this.tokens, {symbol: PROTOCOL_TOKEN_SYMBOL});
+ if (isUndefined(zrxToken)) {
throw new Error(ZeroExError.ZRX_NOT_IN_TOKEN_REGISTRY);
}
return zrxToken;
}
public getNonProtocolTokens(): Token[] {
- const nonProtocolTokens = _.filter(this.tokens, token => {
+ const nonProtocolTokens = filter(this.tokens, token => {
return token.symbol !== PROTOCOL_TOKEN_SYMBOL;
});
return nonProtocolTokens;