number negative integer - nberlette/is GitHub Wiki
function isNegativeInteger<N = number>(it: N): it is NegativeInteger<N>;
Checks if a given value is a negative integer.
Name | Info |
---|---|
it |
The value to check. |
true
if the value is a negative integer, false
otherwise.
Numbers
import { isNegativeInteger } from "jsr:@nick/is/integer";
console.log(isNegativeInteger(0)); // false
console.log(isNegativeInteger(1)); // false
console.log(isNegativeInteger(-1)); // true
console.log(isNegativeInteger(1.5)); // false
console.log(isNegativeInteger(NaN)); // false
console.log(isNegativeInteger(Infinity)); // false
function isNegativeInteger(it: unknown): it is NegativeInteger<number>;
Checks if a given value is a negative integer.
Name | Info |
---|---|
it |
The value to check. |
true
if the value is a negative integer, false
otherwise.
Numbers
import { isNegativeInteger } from "jsr:@nick/is/integer";
console.log(isNegativeInteger(0)); // false
console.log(isNegativeInteger(1)); // false
console.log(isNegativeInteger(-1)); // true
console.log(isNegativeInteger(1.5)); // false
console.log(isNegativeInteger(NaN)); // false
console.log(isNegativeInteger(Infinity)); // false
export type NegativeInteger<N = number> = Cast<N, NEGATIVE & INTEGER>;
Casts a value into a negative integer type. If the value is not a number, it
will resolve to never
.
-
N
(default:number
)
Numbers