Const
Casts a number to the Uint branded type.
number
Uint
Validates that the value is a non-negative integer and returns it with the Uint brand. Throws a TypeError otherwise.
TypeError
The value as an Uint
const branded = asUint(12);assert.isTrue(branded === 12);assert.isTrue(Uint.is(branded)); Copy
const branded = asUint(12);assert.isTrue(branded === 12);assert.isTrue(Uint.is(branded));
If the value is not a non-negative integer
Casts a
numberto theUintbranded type.Validates that the value is a non-negative integer and returns it with the
Uintbrand. Throws aTypeErrorotherwise.