diff options
author | David Sun <dvsuner@protonmail.com> | 2019-02-08 05:45:56 +0800 |
---|---|---|
committer | David Sun <dvsuner@protonmail.com> | 2019-02-08 05:45:56 +0800 |
commit | 6dabed5938a4ccefbc7c8966f8b3f4fbb83acf11 (patch) | |
tree | 14c13fda0355b47ef68bb8c0c4d52a18d75fdcbe /packages/instant/src/util/maybe_big_number.ts | |
parent | d95af455f1102dc7aa833ebb7b84498cce564df3 (diff) | |
download | dexon-0x-contracts-6dabed5938a4ccefbc7c8966f8b3f4fbb83acf11.tar.gz dexon-0x-contracts-6dabed5938a4ccefbc7c8966f8b3f4fbb83acf11.tar.zst dexon-0x-contracts-6dabed5938a4ccefbc7c8966f8b3f4fbb83acf11.zip |
updated order coercion utils architecture and testing
Diffstat (limited to 'packages/instant/src/util/maybe_big_number.ts')
-rw-r--r-- | packages/instant/src/util/maybe_big_number.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/instant/src/util/maybe_big_number.ts b/packages/instant/src/util/maybe_big_number.ts index 7e206a125..95fbd8695 100644 --- a/packages/instant/src/util/maybe_big_number.ts +++ b/packages/instant/src/util/maybe_big_number.ts @@ -16,8 +16,14 @@ export const maybeBigNumberUtil = { return validBigNumber.isNaN() ? undefined : validBigNumber; }, + areMaybeBigNumbersEqual: (val1: Maybe<BigNumber>, val2: Maybe<BigNumber>): boolean => { + if (!_.isUndefined(val1) && !_.isUndefined(val2)) { + return val1.isEqualTo(val2); + } + return _.isUndefined(val1) && _.isUndefined(val2); + }, // converts a BigNumber or String to the BigNumber used by 0x libraries - bigNumberOrStringToMaybeBigNumber: (value: any): Maybe<BigNumber> => { + toMaybeBigNumber: (value: any): Maybe<BigNumber> => { if (_.isString(value)) { return maybeBigNumberUtil.stringToMaybeBigNumber(value); } @@ -27,10 +33,4 @@ export const maybeBigNumberUtil = { } return undefined; }, - areMaybeBigNumbersEqual: (val1: Maybe<BigNumber>, val2: Maybe<BigNumber>): boolean => { - if (!_.isUndefined(val1) && !_.isUndefined(val2)) { - return val1.isEqualTo(val2); - } - return _.isUndefined(val1) && _.isUndefined(val2); - }, }; |