Skip to content

fundamentool


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

ParameterType
argany

Returns

arg is any[]

true if value is an Array.

Example

ts
isArray([1, 2, 3]); // => true
isArray('hello');   // => false

isBlob

ts
const isBlob: (instance) => boolean;

Defined in: src/is/isBlob.ts:12

Checks whether value is a Blob (when Blob is available).

Parameters

ParameterType
instanceany

Returns

boolean

true if value is a Blob instance.

Example

ts
isBlob(new Blob(['data'])); // => true
isBlob('data');             // => false

isBuffer

ts
const isBuffer: (instance) => boolean;

Defined in: src/is/isBuffer.ts:12

Checks whether value is a Buffer (in Node.js environments).

Parameters

ParameterType
instanceany

Returns

boolean

true if value is a Buffer instance.

Example

ts
isBuffer(Buffer.from('data')); // => true
isBuffer('data');              // => false

isFormData

ts
const isFormData: (instance) => boolean;

Defined in: src/is/isFormData.ts:12

Checks whether value is a FormData instance.

Parameters

ParameterType
instanceany

Returns

boolean

true if value is a FormData instance.

Example

ts
isFormData(new FormData()); // => true
isFormData({});             // => false

isNaN

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

ParameterTypeDescription
vanyThe 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);         // => false

REGEXP_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

ParameterTypeDescription
vanyThe value to check.

Returns

v is ArrayBuffer

true if value is an ArrayBuffer.

Example

ts
isArrayBuffer(new ArrayBuffer(8)); // => true
isArrayBuffer([]);                 // => false

isArrayLike()

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

ParameterTypeDescription
vanyThe 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');       // => false

isASCII()

ts
function isASCII(v): boolean;

Defined in: src/is/isASCII.ts:13

Checks whether a string contains only ASCII-printable characters.

Parameters

ParameterTypeDescription
vstringThe 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('');       // => false

isBoolean()

ts
function isBoolean(v): v is boolean;

Defined in: src/is/isBoolean.ts:11

Checks whether value is a boolean.

Parameters

ParameterTypeDescription
vanyThe value to check.

Returns

v is boolean

true if value is a boolean.

Example

ts
isBoolean(true);  // => true
isBoolean(false); // => true
isBoolean(1);     // => false

isCollection()

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

ParameterTypeDescription
vanyThe 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');       // => false

isDate()

ts
function isDate(v): v is Date;

Defined in: src/is/isDate.ts:11

Checks whether value is a Date instance.

Parameters

ParameterTypeDescription
vanyThe value to check.

Returns

v is Date

true if value is a Date.

Example

ts
isDate(new Date());    // => true
isDate('2024-01-01'); // => false

isDefined()

ts
function isDefined(v): boolean;

Defined in: src/is/isDefined.ts:12

Checks whether value is neither undefined nor null.

Parameters

ParameterTypeDescription
vanyThe 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); // => false

isDocumentStateReady()

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

ParameterTypeDescription
windowanyThe 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

ParameterTypeDescription
vstringThe 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('');                 // => false

isEmpty()

ts
function isEmpty(src, k?): boolean;

Defined in: src/is/isEmpty.ts:10

Checks whether an object has no enumerable properties.

Parameters

ParameterTypeDescription
srcRecord<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 });  // => false

isEqual()

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

ParameterTypeDescription
src1anyFirst value.
src2anySecond value.
depth?numberNesting 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

ParameterTypeDescription
vanyThe value to check.

Returns

v is (args: any[]) => any

true if value is a function.

Example

ts
isFunction(() => {}); // => true
isFunction({});       // => false

isHash()

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

ParameterTypeDefault valueDescription
vanyundefinedThe value to check.
lengthnumber32Expected 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

ParameterTypeDescription
urlanyThe 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');           // => false

isIE()

ts
function isIE(window): boolean;

Defined in: src/is/isIE.ts:11

Detects Internet Explorer by window.navigator.userAgent.

Parameters

ParameterTypeDescription
windowanyThe 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

ParameterTypeDescription
vanyThe 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'); // => false

isInsign()

ts
function isInsign(m): boolean;

Defined in: src/is/isInsign.ts:20

Checks that value is "insignificant":

  • null/undefined (but NOT 0)
  • empty array
  • empty plain object

Parameters

ParameterTypeDescription
manyThe value to check.

Returns

boolean

true if value is insignificant.

Example

ts
isInsign(null);  // => true
isInsign([]);    // => true
isInsign({});    // => true
isInsign(0);     // => false
isInsign([1]);   // => false

isInteger()

ts
function isInteger(v): boolean;

Defined in: src/is/isInteger.ts:12

Checks whether value is a 32-bit signed integer.

Parameters

ParameterTypeDescription
vanyThe 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

ParameterTypeDescription
vanyThe value to check.
lengthnumberMinimum 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);    // => true

isLength()

ts
function isLength(v): boolean;

Defined in: src/is/isLength.ts:19

Checks whether value is a valid array-like length.

Parameters

ParameterTypeDescription
vanyThe 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); // => false

isMatch()

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

ParameterTypeDescription
srcanyThe value to test.
matchsanyThe pattern to match against.
depth?numberMaximum 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 });        // => false

isNumber()

ts
function isNumber(v): v is number;

Defined in: src/is/isNumber.ts:11

Checks whether value is a number.

Parameters

ParameterTypeDescription
vanyThe 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'); // => false

isObject()

ts
function isObject(v): v is object;

Defined in: src/is/isObject.ts:11

Checks whether value is a non-null object.

Parameters

ParameterTypeDescription
vanyThe value to check.

Returns

v is object

true if value is an object and not null.

Example

ts
isObject({});   // => true
isObject([]);   // => true
isObject(null); // => false

isObjectLike()

ts
function isObjectLike(v): boolean;

Defined in: src/is/isObjectLike.ts:14

Checks whether value is object-like (object or function).

Parameters

ParameterTypeDescription
vanyThe 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');    // => false

isPhone()

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

ParameterTypeDescription
vstringThe value to validate.

Returns

boolean

true if value matches the expected phone format.

Example

ts
isPhone('+7(999)123-45-67'); // => true
isPhone('89991234567');      // => false

isPlainObject()

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

ParameterTypeDescription
valueanyThe 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());          // => false

isPlainObjectBase()

ts
function isPlainObjectBase(value): value is Record<string, any>;

Defined in: src/is/isPlainObject.ts:19

Parameters

ParameterType
valueany

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

ParameterTypeDescription
vanyThe 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({});                  // => false

isRegExp()

ts
function isRegExp(v): v is RegExp;

Defined in: src/is/isRegExp.ts:10

Checks whether value is a RegExp.

Parameters

ParameterTypeDescription
vanyThe value to check.

Returns

v is RegExp

true if value is a RegExp instance.

Example

ts
isRegExp(/abc/); // => true
isRegExp('abc'); // => false

isSafeNumber()

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

ParameterTypeDescription
vanyThe 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

ParameterTypeDescription
valueunknownThe value to check.

Returns

boolean

true if value is a plain object or an array.

Example

ts
isStandardObject({});       // => true
isStandardObject([]);       // => true
isStandardObject(new Date()); // => false

isString()

ts
function isString(v): v is string;

Defined in: src/is/isString.ts:10

Checks whether value is a string.

Parameters

ParameterTypeDescription
vanyThe value to check.

Returns

v is string

true if value has type 'string'.

Example

ts
isString('hello'); // => true
isString(42);      // => false

isVisibleInViewport()

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

ParameterTypeDescription
element?HTMLElementThe 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

MIT License