aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert/src/index.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-01-09 10:02:41 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-01-09 10:02:41 +0800
commit8019b1b8231cac24dfc6aa3bb2d5115eff11ee89 (patch)
treed270d71404bd3aab44c79dcadf16e348614e9214 /packages/assert/src/index.ts
parent8fe81c9d090ce50496f3150602f19433e7aedd1e (diff)
parent7a56e83fa3ca02d796deba3359da480834a9f6ea (diff)
downloaddexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.gz
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.bz2
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.lz
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.xz
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.tar.zst
dexon-sol-tools-8019b1b8231cac24dfc6aa3bb2d5115eff11ee89.zip
Merge branch 'development' into refactor/httpClientJsonParsing
* development: (21 commits) Update connect CHANGELOG Changes to abi-gen after code review Added constructor ABIs to abi-gen Describe #295 in a CHANGELOG Add #302 description to changelog Fix formatting Apply prettier config Install prettier Remove formatting esilnt rules sendTransactionAsync should return txHash string Added Event generation to abi-gen Publish Add dates to CHANGELOG entries Update subproviders CHANGELOG Support both personal_sign and eth_sign Fix Ledger tests given change from `personal_sign` to `eth_sign` Update subprovider to catch correct RPC method Rename guide Update contribution guide Fix broken links in the abi-gen README ...
Diffstat (limited to 'packages/assert/src/index.ts')
-rw-r--r--packages/assert/src/index.ts25
1 files changed, 14 insertions, 11 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index fadc31d09..e729c043c 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -1,8 +1,5 @@
-import {
- Schema,
- SchemaValidator,
-} from '@0xproject/json-schemas';
-import {addressUtils} from '@0xproject/utils';
+import { Schema, SchemaValidator } from '@0xproject/json-schemas';
+import { addressUtils } from '@0xproject/utils';
import BigNumber from 'bignumber.js';
import * as _ from 'lodash';
import * as validUrl from 'valid-url';
@@ -18,7 +15,8 @@ export const assert = {
assert.isBigNumber(variableName, value);
const hasDecimals = value.decimalPlaces() !== 0;
this.assert(
- !hasDecimals, `${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`,
+ !hasDecimals,
+ `${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`,
);
},
isUndefined(value: any, variableName?: string): void {
@@ -31,8 +29,10 @@ export const assert = {
this.assert(_.isFunction(value), this.typeAssertionMessage(variableName, 'function', value));
},
isHexString(variableName: string, value: string): void {
- this.assert(_.isString(value) && HEX_REGEX.test(value),
- this.typeAssertionMessage(variableName, 'HexString', value));
+ this.assert(
+ _.isString(value) && HEX_REGEX.test(value),
+ this.typeAssertionMessage(variableName, 'HexString', value),
+ );
},
isETHAddressHex(variableName: string, value: string): void {
this.assert(addressUtils.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
@@ -41,8 +41,11 @@ export const assert = {
`Checksummed addresses are not supported. Convert ${variableName} to lower case before passing`,
);
},
- doesBelongToStringEnum(variableName: string, value: string,
- stringEnum: any /* There is no base type for every string enum */): void {
+ doesBelongToStringEnum(
+ variableName: string,
+ value: string,
+ stringEnum: any /* There is no base type for every string enum */,
+ ): void {
const doesBelongToStringEnum = !_.isUndefined(stringEnum[value]);
const enumValues = _.keys(stringEnum);
const enumValuesAsStrings = _.map(enumValues, enumValue => `'${enumValue}'`);
@@ -62,7 +65,7 @@ export const assert = {
this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
},
isWeb3Provider(variableName: string, value: any): void {
- const isWeb3Provider = _.isFunction((value).send) || _.isFunction((value).sendAsync);
+ const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync);
this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value));
},
doesConformToSchema(variableName: string, value: any, schema: Schema): void {