aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/assert.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-09 01:21:46 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-09 01:22:48 +0800
commita786776d7cf52ab70d54e0dc421dc645a412b3c7 (patch)
tree7283487385f2e966f9e3453b176713479061c4d6 /src/utils/assert.ts
parentc94485dfbba388f481ca6c10bd62b863d7429223 (diff)
downloaddexon-sol-tools-a786776d7cf52ab70d54e0dc421dc645a412b3c7.tar
dexon-sol-tools-a786776d7cf52ab70d54e0dc421dc645a412b3c7.tar.gz
dexon-sol-tools-a786776d7cf52ab70d54e0dc421dc645a412b3c7.tar.bz2
dexon-sol-tools-a786776d7cf52ab70d54e0dc421dc645a412b3c7.tar.lz
dexon-sol-tools-a786776d7cf52ab70d54e0dc421dc645a412b3c7.tar.xz
dexon-sol-tools-a786776d7cf52ab70d54e0dc421dc645a412b3c7.tar.zst
dexon-sol-tools-a786776d7cf52ab70d54e0dc421dc645a412b3c7.zip
Add assert.hashAtMostOneUniqueValue
Diffstat (limited to 'src/utils/assert.ts')
-rw-r--r--src/utils/assert.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts
index 4dc6945a2..c7c164ee5 100644
--- a/src/utils/assert.ts
+++ b/src/utils/assert.ts
@@ -42,6 +42,9 @@ export const assert = {
const availableAddresses = await web3Wrapper.getAvailableAddressesAsync();
this.assert(!_.isEmpty(availableAddresses), 'No addresses were available on the provided web3 instance');
},
+ hashAtMostOneUniqueValue(value: any[], errMsg: string): void {
+ this.assert(_.uniq(value).length <= 1, errMsg);
+ },
isNumber(variableName: string, value: number): void {
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
},