Micro check library providing comprehensive type checking and validation operations across different JavaScript environments
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Mathematical validation functions for number properties, comparisons, and arithmetic checks.
Checks if the given number is even.
/**
* Checks if the given value is even
* @param n - Number to check
* @returns True if number is even
* Interfaces: not, all, any
*/
function even(n: number): boolean;Usage Example:
is.even(42); // true
is.not.even(41); // true
is.all.even(40, 42, 44); // true
is.any.even(39, 42, 43); // trueChecks if the given number is odd.
/**
* Checks if the given value is odd
* @param n - Number to check
* @returns True if number is odd
* Interfaces: not, all, any
*/
function odd(n: number): boolean;Usage Example:
is.odd(41); // true
is.not.odd(42); // true
is.all.odd(39, 41, 43); // true
is.any.odd(39, 42, 44); // trueChecks if the given number is positive.
/**
* Checks if the given value is positive
* @param n - Number to check
* @returns True if number is positive
* Interfaces: not, all, any
*/
function positive(n: number): boolean;Usage Example:
is.positive(41); // true
is.not.positive(-42); // true
is.all.positive(39, 41, 43); // true
is.any.positive(-39, 42, -44); // trueChecks if the given number is negative.
/**
* Checks if the given value is negative
* @param n - Number to check
* @returns True if number is negative
* Interfaces: not, all, any
*/
function negative(n: number): boolean;Usage Example:
is.negative(-41); // true
is.not.negative(42); // true
is.all.negative(-39, -41, -43); // true
is.any.negative(-39, 42, 44); // trueChecks if the given number is decimal (has fractional part).
/**
* Checks if the given value is decimal
* @param n - Number to check
* @returns True if number is decimal
* Interfaces: not, all, any
*/
function decimal(n: number): boolean;Usage Example:
is.decimal(41.5); // true
is.not.decimal(42); // true
is.all.decimal(39.5, 41.5, -43.5); // true
is.any.decimal(-39, 42.5, 44); // trueChecks if the given number is an integer.
/**
* Checks if the given value is integer
* @param n - Number to check
* @returns True if number is integer
* Interfaces: not, all, any
*/
function integer(n: number): boolean;Usage Example:
is.integer(41); // true
is.not.integer(42.5); // true
is.all.integer(39, 41, -43); // true
is.any.integer(-39, 42.5, 44); // trueChecks if the given number is finite.
/**
* Checks if the given value is finite
* @param n - Number to check
* @returns True if number is finite
* Interfaces: not, all, any
*/
function finite(n: number): boolean;Usage Example:
is.finite(41); // true
is.not.finite(42 / 0); // true
is.all.finite(39, 41, -43); // true
is.any.finite(-39, Infinity, 44); // trueChecks if the given number is infinite.
/**
* Checks if the given value is infinite
* @param n - Number to check
* @returns True if number is infinite
* Interfaces: not, all, any
*/
function infinite(n: number): boolean;Usage Example:
is.infinite(Infinity); // true
is.not.infinite(42); // true
is.all.infinite(Infinity, -Infinity, -43 / 0); // true
is.any.infinite(-39, Infinity, 44); // trueChecks if the given number is above a minimum value.
/**
* Checks if the given value is above minimum value
* @param n - Number to check
* @param min - Minimum value
* @returns True if number is above minimum
* Interfaces: not
*/
function above(n: number, min: number): boolean;Usage Example:
is.above(41, 30); // true
is.not.above(42, 50); // trueChecks if the given number is under a maximum value.
/**
* Checks if the given value is under maximum value
* @param n - Number to check
* @param max - Maximum value
* @returns True if number is under maximum
* Interfaces: not
*/
function under(n: number, max: number): boolean;Usage Example:
is.under(30, 35); // true
is.not.under(42, 30); // trueChecks if the given number is within a range.
/**
* Checks if the given value is within minimum and maximum values
* @param n - Number to check
* @param min - Minimum value (exclusive)
* @param max - Maximum value (exclusive)
* @returns True if number is within range
* Interfaces: not
*/
function within(n: number, min: number, max: number): boolean;Usage Example:
is.within(30, 20, 40); // true
is.not.within(40, 30, 35); // trueChecks if the given values are equal (handles special cases like 0/-0 and regex comparison).
/**
* Checks if the given values are equal
* @param value - First value
* @param other - Second value
* @returns True if values are equal
* Interfaces: not
*/
function equal(value: any, other: any): boolean;Usage Example:
is.equal(42, 40 + 2); // true
is.equal('yeap', 'yeap'); // true
is.equal(true, true); // true
is.not.equal('yeap', 'nope'); // true