From a786776d7cf52ab70d54e0dc421dc645a412b3c7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 8 Jun 2017 19:21:46 +0200 Subject: Add assert.hashAtMostOneUniqueValue --- src/utils/assert.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/utils/assert.ts') 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)); }, -- cgit v1.2.3 From 6d4cb28b9d08df574e7f335196dfdd82f02a74c3 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Jun 2017 15:49:56 +0200 Subject: Address feedback --- src/utils/assert.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/utils/assert.ts') diff --git a/src/utils/assert.ts b/src/utils/assert.ts index 2ee87e549..94b119d5a 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -38,7 +38,7 @@ 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 { + hasAtMostOneUniqueValue(value: any[], errMsg: string): void { this.assert(_.uniq(value).length <= 1, errMsg); }, isNumber(variableName: string, value: number): void { -- cgit v1.2.3