Skip to main content
Version: Next

Function: assertInRange()

assertInRange(input, lowerBound, upperBound, inputName?): void

Defined in: src/utils/num.ts:162

Asserts input is equal to or greater then lowerBound and lower then upperBound.

The inputName parameter is used in the assertion message.

Parameters

input

BigNumberish

Value to check

lowerBound

BigNumberish

Lower bound value

upperBound

BigNumberish

Upper bound value

inputName?

string = ''

Name of the input for error message

Returns

void

Throws

Error if input is out of range

Example

const input1:BigNumberish = 10;
assertInRange(input1, 5, 20, 'value')

const input2: BigNumberish = 25;
assertInRange(input2, 5, 20, 'value');
// throws Error: Message not signable, invalid value length.