Appearance
is
Variables
isArray
ts
const isArray: (arg) => arg is any[] = Array.isArray;Defined in: src/is/isArray.ts:11
Checks whether value is an Array.
Parameters
| Parameter | Type |
|---|---|
arg | any |
Returns
arg is any[]
true if value is an Array.
Example
ts
isArray([1, 2, 3]); // => true
isArray('hello'); // => falseisBlob
ts
const isBlob: (instance) => boolean;Defined in: src/is/isBlob.ts:12
Checks whether value is a Blob (when Blob is available).
Parameters
| Parameter | Type |
|---|---|
instance | any |
Returns
boolean
true if value is a Blob instance.
Example
ts
isBlob(new Blob(['data'])); // => true
isBlob('data'); // => falseisBuffer
ts
const isBuffer: (instance) => boolean;Defined in: src/is/isBuffer.ts:12
Checks whether value is a Buffer (in Node.js environments).
Parameters
| Parameter | Type |
|---|---|
instance | any |
Returns
boolean
true if value is a Buffer instance.
Example
ts
isBuffer(Buffer.from('data')); // => true
isBuffer('data'); // => falseisFormData
ts
const isFormData: (instance) => boolean;Defined in: src/is/isFormData.ts:12
Checks whether value is a FormData instance.
Parameters
| Parameter | Type |
|---|---|
instance | any |
Returns
boolean
true if value is a FormData instance.
Example
ts
isFormData(new FormData()); // => true
isFormData({}); // => falseisNaN
ts
const isNaN: (v) => boolean = Number.isNaN;Defined in: src/is/isNaN.ts:12
Checks whether value is NaN (wraps Number.isNaN). Unlike the global isNaN, does not coerce the value before checking.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true only if value is exactly NaN.
Example
ts
isNaN(NaN); // => true
isNaN(undefined); // => false (unlike global isNaN)
isNaN(1); // => falseREGEXP_ASCII
ts
const REGEXP_ASCII: RegExp;Defined in: src/is/isASCII.ts:1
Functions
isArrayBuffer()
ts
function isArrayBuffer(v): v is ArrayBuffer;Defined in: src/is/isArrayBuffer.ts:10
Checks whether value is an ArrayBuffer.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is ArrayBuffer
true if value is an ArrayBuffer.
Example
ts
isArrayBuffer(new ArrayBuffer(8)); // => true
isArrayBuffer([]); // => falseisArrayLike()
ts
function isArrayLike(v): boolean;Defined in: src/is/isArrayLike.ts:13
Checks whether value is array-like (non-null object with a valid numeric length).
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true if value is a non-null object with a valid length property.
Example
ts
isArrayLike([1, 2]); // => true
isArrayLike({ length: 3 }); // => true
isArrayLike('hello'); // => falseisASCII()
ts
function isASCII(v): boolean;Defined in: src/is/isASCII.ts:13
Checks whether a string contains only ASCII-printable characters.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | string | The value to check. |
Returns
boolean
true if the string is non-empty and contains only ASCII characters.
Example
ts
isASCII('hello'); // => true
isASCII('привет'); // => false
isASCII(''); // => falseisBoolean()
ts
function isBoolean(v): v is boolean;Defined in: src/is/isBoolean.ts:11
Checks whether value is a boolean.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is boolean
true if value is a boolean.
Example
ts
isBoolean(true); // => true
isBoolean(false); // => true
isBoolean(1); // => falseisCollection()
ts
function isCollection(v): boolean;Defined in: src/is/isCollection.ts:15
Checks whether value is a "collection": plain object or array-like object.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true if value is a non-null object with valid length or a plain object.
Example
ts
isCollection([1, 2]); // => true
isCollection({ a: 1 }); // => true
isCollection({ length: 3 }); // => true
isCollection('hello'); // => falseisDate()
ts
function isDate(v): v is Date;Defined in: src/is/isDate.ts:11
Checks whether value is a Date instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is Date
true if value is a Date.
Example
ts
isDate(new Date()); // => true
isDate('2024-01-01'); // => falseisDefined()
ts
function isDefined(v): boolean;Defined in: src/is/isDefined.ts:12
Checks whether value is neither undefined nor null.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true if value is defined and not null.
Example
ts
isDefined(0); // => true
isDefined(''); // => true
isDefined(null); // => false
isDefined(undefined); // => falseisDocumentStateReady()
ts
function isDocumentStateReady(window): boolean;Defined in: src/is/isDocumentStateReady.ts:12
Returns true when document.readyState is in interactive or complete state. In IE uses strict 'complete' check; in other browsers allows 'interactive'.
Parameters
| Parameter | Type | Description |
|---|---|---|
window | any | The window object to check against. |
Returns
boolean
true if the document is ready.
Example
ts
isDocumentStateReady(window); // => true (when DOM is ready)isEmail()
ts
function isEmail(v): boolean;Defined in: src/is/isEmail.ts:11
Validates an email address using a project-specific regexp.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | string | The value to validate. |
Returns
boolean
true if value is a valid email address under 255 characters.
Example
ts
isEmail('user@example.com'); // => true
isEmail('not-an-email'); // => false
isEmail(''); // => falseisEmpty()
ts
function isEmpty(src, k?): boolean;Defined in: src/is/isEmpty.ts:10
Checks whether an object has no enumerable properties.
Parameters
| Parameter | Type | Description |
|---|---|---|
src | Record<string, any> | The object to check. |
k? | string | - |
Returns
boolean
true if the object has no enumerable properties.
Example
ts
isEmpty({}); // => true
isEmpty({ a: 1 }); // => falseisEqual()
ts
function isEqual(
src1,
src2,
depth?): boolean;Defined in: src/is/isEqual.ts:15
Deep equality check up to depth levels of nesting. At depth 0 (default), nested objects are compared by reference only.
Parameters
| Parameter | Type | Description |
|---|---|---|
src1 | any | First value. |
src2 | any | Second value. |
depth? | number | Nesting depth limit (default: 0). |
Returns
boolean
true if both values are deeply equal within the given depth.
Example
ts
isEqual(1, 1); // => true
isEqual({ a: 1 }, { a: 1 }); // => true
isEqual({ a: {} }, { a: {} }); // => false (depth 0, nested ref differs)
isEqual({ a: {} }, { a: {} }, 1); // => true (depth 1, recurses into keys)isFunction()
ts
function isFunction(v): v is (args: any[]) => any;Defined in: src/is/isFunction.ts:10
Checks whether value is a function.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is (args: any[]) => any
true if value is a function.
Example
ts
isFunction(() => {}); // => true
isFunction({}); // => falseisHash()
ts
function isHash(v, length?): boolean;Defined in: src/is/isHash.ts:16
Checks whether value is a hex string of the given length (default 32).
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
v | any | undefined | The value to check. |
length | number | 32 | Expected length of the hex string (default: 32). |
Returns
boolean
true if value is a lowercase hex string of the expected length.
Example
ts
isHash('a'.repeat(32)); // => true
isHash('abc123', 6); // => true
isHash('xyz', 3); // => false (non-hex chars)isHttpUrl()
ts
function isHttpUrl(url): boolean;Defined in: src/is/isHttpUrl.ts:15
Validates an HTTP/HTTPS URL (supports both Latin and Cyrillic domains).
Parameters
| Parameter | Type | Description |
|---|---|---|
url | any | The value to validate. |
Returns
boolean
true if value is a string matching a valid HTTP/HTTPS URL pattern.
Example
ts
isHttpUrl('https://example.com'); // => true
isHttpUrl('not-a-url'); // => falseisIE()
ts
function isIE(window): boolean;Defined in: src/is/isIE.ts:11
Detects Internet Explorer by window.navigator.userAgent.
Parameters
| Parameter | Type | Description |
|---|---|---|
window | any | The window object to inspect. |
Returns
boolean
true if the browser is Internet Explorer.
Example
ts
isIE(window); // => false (in modern browsers)isIndex()
ts
function isIndex(v): boolean;Defined in: src/is/isIndex.ts:14
Checks whether a string is a non-negative integer index.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true if value contains only digits (a valid array index string).
Example
ts
isIndex('0'); // => true
isIndex('42'); // => true
isIndex('-1'); // => false
isIndex('1.5'); // => falseisInsign()
ts
function isInsign(m): boolean;Defined in: src/is/isInsign.ts:20
Checks that value is "insignificant":
null/undefined(but NOT0)- empty array
- empty plain object
Parameters
| Parameter | Type | Description |
|---|---|---|
m | any | The value to check. |
Returns
boolean
true if value is insignificant.
Example
ts
isInsign(null); // => true
isInsign([]); // => true
isInsign({}); // => true
isInsign(0); // => false
isInsign([1]); // => falseisInteger()
ts
function isInteger(v): boolean;Defined in: src/is/isInteger.ts:12
Checks whether value is a 32-bit signed integer.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true if value is a 32-bit integer.
Example
ts
isInteger(42); // => true
isInteger(-1); // => true
isInteger(1.5); // => false
isInteger(2 ** 31); // => false (overflow)isInvalidStringLength()
ts
function isInvalidStringLength(v, length): boolean;Defined in: src/is/isInvalidStringLength.ts:14
Returns true when value is not a string or has length less than required.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
length | number | Minimum required length. |
Returns
boolean
true if value is invalid (not a string or too short).
Example
ts
isInvalidStringLength('hello', 3); // => false
isInvalidStringLength('hi', 3); // => true
isInvalidStringLength(null, 3); // => trueisLength()
ts
function isLength(v): boolean;Defined in: src/is/isLength.ts:19
Checks whether value is a valid array-like length.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true if value is a non-negative integer not exceeding Number.MAX_SAFE_INTEGER.
Example
ts
isLength(0); // => true
isLength(100); // => true
isLength(-1); // => false
isLength(1.5); // => falseisMatch()
ts
function isMatch(
src,
matchs,
depth?): boolean;Defined in: src/is/isMatch.ts:14
Checks whether src matches the structure of matchs up to depth levels (default: 10). Unlike isEqual, only the keys present in matchs are compared.
Parameters
| Parameter | Type | Description |
|---|---|---|
src | any | The value to test. |
matchs | any | The pattern to match against. |
depth? | number | Maximum recursion depth (default: 10). |
Returns
boolean
true if all keys in matchs are present in src with equal values.
Example
ts
isMatch({ a: 1, b: 2 }, { a: 1 }); // => true
isMatch({ a: 1 }, { a: 2 }); // => false
isMatch({ a: 1 }, { b: 1 }); // => falseisNumber()
ts
function isNumber(v): v is number;Defined in: src/is/isNumber.ts:11
Checks whether value is a number.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is number
true if value has type 'number' (including NaN).
Example
ts
isNumber(42); // => true
isNumber(NaN); // => true (NaN has type 'number')
isNumber('1'); // => falseisObject()
ts
function isObject(v): v is object;Defined in: src/is/isObject.ts:11
Checks whether value is a non-null object.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is object
true if value is an object and not null.
Example
ts
isObject({}); // => true
isObject([]); // => true
isObject(null); // => falseisObjectLike()
ts
function isObjectLike(v): boolean;Defined in: src/is/isObjectLike.ts:14
Checks whether value is object-like (object or function).
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
boolean
true if typeof v is 'object' or 'function' and value is truthy.
Example
ts
isObjectLike({}); // => true
isObjectLike(() => {}); // => true
isObjectLike(null); // => false
isObjectLike('str'); // => falseisPhone()
ts
function isPhone(v): boolean;Defined in: src/is/isPhone.ts:12
Validates a Russian phone number in the format +7(XXX)XXX-XX-XX.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | string | The value to validate. |
Returns
boolean
true if value matches the expected phone format.
Example
ts
isPhone('+7(999)123-45-67'); // => true
isPhone('89991234567'); // => falseisPlainObject()
ts
function isPlainObject(value): value is Record<string, any>;Defined in: src/is/isPlainObject.ts:15
Checks whether value is a "plain object": an object whose prototype chain has at most Object.prototype or null.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | any | The value to check. |
Returns
value is Record<string, any>
true if value is a plain object.
Example
ts
isPlainObject({}); // => true
isPlainObject(Object.create(null)); // => true
isPlainObject([]); // => false
isPlainObject(new Date()); // => falseisPlainObjectBase()
ts
function isPlainObjectBase(value): value is Record<string, any>;Defined in: src/is/isPlainObject.ts:19
Parameters
| Parameter | Type |
|---|---|
value | any |
Returns
value is Record<string, any>
isPromise()
ts
function isPromise(v): v is Promise<any>;Defined in: src/is/isPromise.ts:13
Checks whether value is a Promise (or thenable).
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is Promise<any>
true if value has a .then method.
Example
ts
isPromise(Promise.resolve()); // => true
isPromise({ then: () => {} }); // => true
isPromise({}); // => falseisRegExp()
ts
function isRegExp(v): v is RegExp;Defined in: src/is/isRegExp.ts:10
Checks whether value is a RegExp.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is RegExp
true if value is a RegExp instance.
Example
ts
isRegExp(/abc/); // => true
isRegExp('abc'); // => falseisSafeNumber()
ts
function isSafeNumber(v): boolean;Defined in: src/is/isSafeNumber.ts:14
Checks that value can be parsed to a safe non-negative number less than 2147483647.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check (coerced via parseFloat). |
Returns
boolean
true if value parses to a valid non-negative safe number.
Example
ts
isSafeNumber(100); // => true
isSafeNumber('3.14'); // => true
isSafeNumber(-1); // => false
isSafeNumber(2147483647); // => false (not less than MAX_SAFE_NUMBER)isStandardObject()
ts
function isStandardObject(value): boolean;Defined in: src/is/isStandardObject.ts:14
Checks whether value is a "standard" object: plain object or array.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check. |
Returns
boolean
true if value is a plain object or an array.
Example
ts
isStandardObject({}); // => true
isStandardObject([]); // => true
isStandardObject(new Date()); // => falseisString()
ts
function isString(v): v is string;Defined in: src/is/isString.ts:10
Checks whether value is a string.
Parameters
| Parameter | Type | Description |
|---|---|---|
v | any | The value to check. |
Returns
v is string
true if value has type 'string'.
Example
ts
isString('hello'); // => true
isString(42); // => falseisVisibleInViewport()
ts
function isVisibleInViewport(element?): boolean;Defined in: src/is/isVisibleInViewport.ts:9
Checks whether a DOM element is fully visible within the current viewport.
Parameters
| Parameter | Type | Description |
|---|---|---|
element? | HTMLElement | The element to check. |
Returns
boolean
true if the element's bounding rect is fully inside the viewport.
Example
ts
isVisibleInViewport(document.getElementById('btn')); // => true or false