Const
Casts a number to a NonPositiveInt branded type.
This function validates that the input is a non-positive integer (<= 0) and returns it with the NonPositiveInt brand. This ensures type safety for operations that require non-positive integer values.
The value as a NonPositiveInt branded type
const branded = asNonPositiveInt(-7);assert.isTrue(branded === -7);assert.isTrue(NonPositiveInt.is(branded)); Copy
const branded = asNonPositiveInt(-7);assert.isTrue(branded === -7);assert.isTrue(NonPositiveInt.is(branded));
If the value is not a non-positive integer
Casts a number to a NonPositiveInt branded type.
This function validates that the input is a non-positive integer (<= 0) and returns it with the NonPositiveInt brand. This ensures type safety for operations that require non-positive integer values.