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