Const
Casts a number to the SafeInt branded type.
number
SafeInt
Validates that the value is a safe integer and returns it with the SafeInt brand. Throws a TypeError otherwise.
TypeError
The value as a SafeInt
const branded = asSafeInt(123);assert.isTrue(branded === 123);assert.isTrue(SafeInt.is(branded)); Copy
const branded = asSafeInt(123);assert.isTrue(branded === 123);assert.isTrue(SafeInt.is(branded));
If the value is not a safe integer
Casts a
numberto theSafeIntbranded type.Validates that the value is a safe integer and returns it with the
SafeIntbrand. Throws aTypeErrorotherwise.