Function: assertInRange()
assertInRange(
input,lowerBound,upperBound,inputName?):void
Defined in: src/utils/num.ts:168
Asserts input is within [lowerBound, upperBound], both bounds included.
The inputName parameter names the input in the assertion message.
Parameters
input
Value to check
lowerBound
Lower bound value, included
upperBound
Upper bound value, included
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, 'amount')
const input2: BigNumberish = 25;
assertInRange(input2, 5, 20, 'amount');
// throws Error: Value is out of amount range [5, 20]