-
-
Notifications
You must be signed in to change notification settings - Fork 0
number positive integer
Nicholas Berlette edited this page Jun 19, 2025
·
1 revision
function isPositiveInteger<N = number>(it: N): it is PositiveInteger<N>;Checks if a given value is a positive integer.
| Name | Info |
|---|---|
it |
The value to check. |
true if the value is a positive integer, false otherwise.
Numbers
import { isPositiveInteger } from "jsr:@nick/is/integer";
console.log(isPositiveInteger(0)); // true
console.log(isPositiveInteger(1)); // true
console.log(isPositiveInteger(-1)); // false
console.log(isPositiveInteger(1.5)); // false
console.log(isPositiveInteger(NaN)); // false
console.log(isPositiveInteger(Infinity)); // falsefunction isPositiveInteger(it: unknown): it is PositiveInteger;Checks if a given value is a positive integer.
| Name | Info |
|---|---|
it |
The value to check. |
true if the value is a positive integer, false otherwise.
Numbers
import { isPositiveInteger } from "jsr:@nick/is/integer";
console.log(isPositiveInteger(0)); // true
console.log(isPositiveInteger(1)); // true
console.log(isPositiveInteger(-1)); // false
console.log(isPositiveInteger(1.5)); // false
console.log(isPositiveInteger(NaN)); // false
console.log(isPositiveInteger(Infinity)); // falseexport type PositiveInteger<N = number> = Cast<N, POSITIVE & INTEGER>;Casts a value into a positive finite type. If the value is not a number, it will
resolve to never.
-
N(default:number)
Numbers