aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert/src/index.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-12-22 22:05:32 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-03 18:37:38 +0800
commite744e4cd989bd3ae1070c59f7baa8097f18b8b06 (patch)
treea7fde03873f3c1b8689d3991edbb362f8022e5f0 /packages/assert/src/index.ts
parent9a96e8c704b6f84e00bbe848159a4819844cf09d (diff)
downloaddexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.gz
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.bz2
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.lz
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.xz
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.tar.zst
dexon-sol-tools-e744e4cd989bd3ae1070c59f7baa8097f18b8b06.zip
Apply prettier config
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 {