Check Utilities
Collection of validation and check utilities.
isArray
Checks if a value is an array.
Signature:
export declare const isArray: <T>(value: T) => boolean;Example:
import { isArray } from "easy-kit-utils";
isArray([1, 2]); // true
isArray("abc"); // falseisBlankArray
Checks if a value is an array and is empty.
Signature:
export declare const isBlankArray: <T>(value: T[]) => boolean;Example:
import { isBlankArray } from "easy-kit-utils";
isBlankArray([]); // true
isBlankArray([1]); // falseisBoolean
Checks if value is classified as a boolean primitive or object.
Signature:
export declare const isBoolean: (value: unknown) => value is boolean;Example:
import { isBoolean } from "easy-kit-utils";
isBoolean(false); // true
isBoolean(null); // falseisDefined
Checks if value is defined (not undefined).
Signature:
export declare const isDefined: <T>(value: T | undefined) => value is T;Example:
import { isDefined } from "easy-kit-utils";
isDefined(undefined); // false
isDefined(0); // trueisEmptyString
Checks if a value is an empty string.
Signature:
export declare const isEmptyString: <T>(value: T) => boolean;Example:
import { isEmptyString } from "easy-kit-utils";
isEmptyString(""); // true
isEmptyString(" "); // true (if trimmed check included)
isEmptyString("abc"); // falseisFunction
Checks if a value is a function.
Signature:
export declare const isFunction: <T>(value: T) => boolean;Example:
import { isFunction } from "easy-kit-utils";
isFunction(() => {}); // true
isFunction(123); // falseisNull
Checks if value is null.
Signature:
export declare const isNull: (value: unknown) => value is null;Example:
import { isNull } from "easy-kit-utils";
isNull(null); // true
isNull(undefined); // falseisNumber
Checks if a value is a number and not NaN.
Signature:
export declare const isNumber: <T>(value: T) => boolean;Example:
import { isNumber } from "easy-kit-utils";
isNumber(123); // true
isNumber(NaN); // false
isNumber("123"); // falseisObject
Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".
Signature:
export declare const isObject: <T>(value: T) => boolean;Example:
import { isObject } from "easy-kit-utils";
isObject({}); // true
isObject([1, 2, 3]); // true
isObject(null); // falseisPromise
Checks if value is a Promise.
Signature:
export declare const isPromise: <T = any>(
value: unknown
) => value is Promise<T>;Example:
import { isPromise } from "easy-kit-utils";
isPromise(new Promise(() => {})); // true
isPromise({ then: () => {} }); // trueisString
Checks if value is classified as a String primitive or object.
Signature:
export declare const isString: (value: unknown) => value is string;Example:
import { isString } from "easy-kit-utils";
isString("abc"); // true
isString(1); // falseisTrue
Checks if something is true.
Signature:
export declare const isTrue: (value: unknown) => value is true;Example:
import { isTrue } from "easy-kit-utils";
isTrue(true); // true
isTrue(false); // false
isTrue(1); // falseisTrueFormat
Checks if the provided value matches the specified MIME type format.
Signature:
export declare const isTrueFormat: <T>(value: T, format: Format) => boolean;Example:
import { isTrueFormat, Format } from "easy-kit-utils";
isTrueFormat("image/png", Format.PNG); // true (assuming Format enum/type)