@sindresorhus/is
- Version 7.0.0
- Published
- 99.3 kB
- No dependencies
- MIT license
Install
npm i @sindresorhus/is
yarn add @sindresorhus/is
pnpm add @sindresorhus/is
Overview
Type check values
Index
Variables
Functions
- assertAll()
- assertAny()
- assertArray()
- assertArrayBuffer()
- assertArrayLike()
- assertAsyncFunction()
- assertAsyncGenerator()
- assertAsyncGeneratorFunction()
- assertAsyncIterable()
- assertBigint()
- assertBigInt64Array()
- assertBigUint64Array()
- assertBlob()
- assertBoolean()
- assertBoundFunction()
- assertBuffer()
- assertClass()
- assertDataView()
- assertDate()
- assertDirectInstanceOf()
- assertEmptyArray()
- assertEmptyMap()
- assertEmptyObject()
- assertEmptySet()
- assertEmptyString()
- assertEmptyStringOrWhitespace()
- assertEnumCase()
- assertError()
- assertEvenInteger()
- assertFalsy()
- assertFloat32Array()
- assertFloat64Array()
- assertFormData()
- assertFunction()
- assertGenerator()
- assertGeneratorFunction()
- assertHtmlElement()
- assertInfinite()
- assertInRange()
- assertInt16Array()
- assertInt32Array()
- assertInt8Array()
- assertInteger()
- assertIterable()
- assertMap()
- assertNan()
- assertNativePromise()
- assertNegativeNumber()
- assertNodeStream()
- assertNonEmptyArray()
- assertNonEmptyMap()
- assertNonEmptyObject()
- assertNonEmptySet()
- assertNonEmptyString()
- assertNonEmptyStringAndNotWhitespace()
- assertNull()
- assertNullOrUndefined()
- assertNumber()
- assertNumericString()
- assertObject()
- assertObservable()
- assertOddInteger()
- assertPlainObject()
- assertPositiveNumber()
- assertPrimitive()
- assertPromise()
- assertPropertyKey()
- assertRegExp()
- assertSafeInteger()
- assertSet()
- assertSharedArrayBuffer()
- assertString()
- assertSymbol()
- assertTruthy()
- assertTupleLike()
- assertTypedArray()
- assertUint16Array()
- assertUint32Array()
- assertUint8Array()
- assertUint8ClampedArray()
- assertUndefined()
- assertUrlInstance()
- assertUrlSearchParams()
- assertUrlString()
- assertValidDate()
- assertValidLength()
- assertWeakMap()
- assertWeakRef()
- assertWeakSet()
- assertWhitespaceString()
- detect()
- isAll()
- isAny()
- isArray()
- isArrayBuffer()
- isArrayLike()
- isAsyncFunction()
- isAsyncGenerator()
- isAsyncGeneratorFunction()
- isAsyncIterable()
- isBigint()
- isBigInt64Array()
- isBigUint64Array()
- isBlob()
- isBoolean()
- isBoundFunction()
- isBuffer()
- isClass()
- isDataView()
- isDate()
- isDirectInstanceOf()
- isEmptyArray()
- isEmptyMap()
- isEmptyObject()
- isEmptySet()
- isEmptyString()
- isEmptyStringOrWhitespace()
- isEnumCase()
- isError()
- isEvenInteger()
- isFalsy()
- isFloat32Array()
- isFloat64Array()
- isFormData()
- isFunction()
- isGenerator()
- isGeneratorFunction()
- isHtmlElement()
- isInfinite()
- isInRange()
- isInt16Array()
- isInt32Array()
- isInt8Array()
- isInteger()
- isIterable()
- isMap()
- isNan()
- isNativePromise()
- isNegativeNumber()
- isNodeStream()
- isNonEmptyArray()
- isNonEmptyMap()
- isNonEmptyObject()
- isNonEmptySet()
- isNonEmptyString()
- isNonEmptyStringAndNotWhitespace()
- isNull()
- isNullOrUndefined()
- isNumber()
- isNumericString()
- isObject()
- isObservable()
- isOddInteger()
- isPlainObject()
- isPositiveNumber()
- isPrimitive()
- isPromise()
- isPropertyKey()
- isRegExp()
- isSafeInteger()
- isSet()
- isSharedArrayBuffer()
- isString()
- isSymbol()
- isTruthy()
- isTupleLike()
- isTypedArray()
- isUint16Array()
- isUint32Array()
- isUint8Array()
- isUint8ClampedArray()
- isUndefined()
- isUrlInstance()
- isUrlSearchParams()
- isUrlString()
- isValidDate()
- isValidLength()
- isWeakMap()
- isWeakRef()
- isWeakSet()
- isWhitespaceString()
Type Aliases
Variables
variable assert
const assert: Assert;
variable assertionTypeDescriptions
const assertionTypeDescriptions: readonly [ 'positive number', 'negative number', 'Class', 'string with a number', 'null or undefined', 'Iterable', 'AsyncIterable', 'native Promise', 'EnumCase', 'string with a URL', 'truthy', 'falsy', 'primitive', 'integer', 'plain object', 'TypedArray', 'array-like', 'tuple-like', 'Node.js Stream', 'infinite number', 'empty array', 'non-empty array', 'empty string', 'empty string or whitespace', 'non-empty string', 'non-empty string and not whitespace', 'empty object', 'non-empty object', 'empty set', 'non-empty set', 'empty map', 'non-empty map', 'PropertyKey', 'even integer', 'odd integer', 'T', 'in range', 'predicate returns truthy for any value', 'predicate returns truthy for all values', 'valid Date', 'valid length', 'whitespace string', 'Function', 'Generator', 'AsyncGenerator', 'GeneratorFunction', 'AsyncGeneratorFunction', 'AsyncFunction', 'Observable', 'Array', 'Buffer', 'Blob', 'Object', 'RegExp', 'Date', 'Error', 'Map', 'Set', 'WeakMap', 'WeakSet', 'WeakRef', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Promise', 'URL', 'FormData', 'URLSearchParams', 'HTMLElement', 'NaN', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array', 'null', 'undefined', 'string', 'number', 'bigint', 'boolean', 'symbol'];
variable is
const is: ((value: unknown) => TypeName) & { all: typeof isAll; any: typeof isAny; array: typeof isArray; arrayBuffer: typeof isArrayBuffer; arrayLike: typeof isArrayLike; asyncFunction: typeof isAsyncFunction; asyncGenerator: typeof isAsyncGenerator; asyncGeneratorFunction: typeof isAsyncGeneratorFunction; asyncIterable: typeof isAsyncIterable; bigint: typeof isBigint; bigInt64Array: typeof isBigInt64Array; bigUint64Array: typeof isBigUint64Array; blob: typeof isBlob; boolean: typeof isBoolean; boundFunction: typeof isBoundFunction; buffer: typeof isBuffer; class: typeof isClass; dataView: typeof isDataView; date: typeof isDate; detect: typeof detect; directInstanceOf: typeof isDirectInstanceOf; emptyArray: typeof isEmptyArray; emptyMap: typeof isEmptyMap; emptyObject: typeof isEmptyObject; emptySet: typeof isEmptySet; emptyString: typeof isEmptyString; emptyStringOrWhitespace: typeof isEmptyStringOrWhitespace; enumCase: typeof isEnumCase; error: typeof isError; evenInteger: typeof isEvenInteger; falsy: typeof isFalsy; float32Array: typeof isFloat32Array; float64Array: typeof isFloat64Array; formData: typeof isFormData; function: typeof isFunction; generator: typeof isGenerator; generatorFunction: typeof isGeneratorFunction; htmlElement: typeof isHtmlElement; infinite: typeof isInfinite; inRange: typeof isInRange; int16Array: typeof isInt16Array; int32Array: typeof isInt32Array; int8Array: typeof isInt8Array; integer: typeof isInteger; iterable: typeof isIterable; map: typeof isMap; nan: typeof isNan; nativePromise: typeof isNativePromise; negativeNumber: typeof isNegativeNumber; nodeStream: typeof isNodeStream; nonEmptyArray: typeof isNonEmptyArray; nonEmptyMap: typeof isNonEmptyMap; nonEmptyObject: typeof isNonEmptyObject; nonEmptySet: typeof isNonEmptySet; nonEmptyString: typeof isNonEmptyString; nonEmptyStringAndNotWhitespace: typeof isNonEmptyStringAndNotWhitespace; null: typeof isNull; nullOrUndefined: typeof isNullOrUndefined; number: typeof isNumber; numericString: typeof isNumericString; object: typeof isObject; observable: typeof isObservable; oddInteger: typeof isOddInteger; plainObject: typeof isPlainObject; positiveNumber: typeof isPositiveNumber; primitive: typeof isPrimitive; promise: typeof isPromise; propertyKey: typeof isPropertyKey; regExp: typeof isRegExp; safeInteger: typeof isSafeInteger; set: typeof isSet; sharedArrayBuffer: typeof isSharedArrayBuffer; string: typeof isString; symbol: typeof isSymbol; truthy: typeof isTruthy; tupleLike: typeof isTupleLike; typedArray: typeof isTypedArray; uint16Array: typeof isUint16Array; uint32Array: typeof isUint32Array; uint8Array: typeof isUint8Array; uint8ClampedArray: typeof isUint8ClampedArray; undefined: typeof isUndefined; urlInstance: typeof isUrlInstance; urlSearchParams: typeof isUrlSearchParams; urlString: typeof isUrlString; validDate: typeof isValidDate; validLength: typeof isValidLength; weakMap: typeof isWeakMap; weakRef: typeof isWeakRef; weakSet: typeof isWeakSet; whitespaceString: typeof isWhitespaceString;};
variable objectTypeNames
const objectTypeNames: readonly [ 'Function', 'Generator', 'AsyncGenerator', 'GeneratorFunction', 'AsyncGeneratorFunction', 'AsyncFunction', 'Observable', 'Array', 'Buffer', 'Blob', 'Object', 'RegExp', 'Date', 'Error', 'Map', 'Set', 'WeakMap', 'WeakSet', 'WeakRef', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Promise', 'URL', 'FormData', 'URLSearchParams', 'HTMLElement', 'NaN', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array'];
variable primitiveTypeNames
const primitiveTypeNames: readonly [ 'null', 'undefined', 'string', 'number', 'bigint', 'boolean', 'symbol'];
Functions
function assertAll
assertAll: (predicate: Predicate, ...values: unknown[]) => void | never;
function assertAny
assertAny: ( predicate: Predicate | Predicate[], ...values: unknown[]) => void | never;
function assertArray
assertArray: <T = unknown>( value: unknown, assertion?: (element: unknown) => asserts element is T, message?: string) => asserts value is T[];
function assertArrayBuffer
assertArrayBuffer: ( value: unknown, message?: string) => asserts value is ArrayBuffer;
function assertArrayLike
assertArrayLike: <T = unknown>( value: unknown, message?: string) => asserts value is ArrayLike<T>;
function assertAsyncFunction
assertAsyncFunction: ( value: unknown, message?: string) => asserts value is Function;
function assertAsyncGenerator
assertAsyncGenerator: ( value: unknown, message?: string) => asserts value is AsyncGenerator<unknown, any, unknown>;
function assertAsyncGeneratorFunction
assertAsyncGeneratorFunction: ( value: unknown, message?: string) => asserts value is AsyncGeneratorFunction;
function assertAsyncIterable
assertAsyncIterable: <T = unknown>( value: unknown, message?: string) => asserts value is AsyncIterable<T>;
function assertBigint
assertBigint: (value: unknown, message?: string) => asserts value is bigint;
function assertBigInt64Array
assertBigInt64Array: ( value: unknown, message?: string) => asserts value is BigInt64Array;
function assertBigUint64Array
assertBigUint64Array: ( value: unknown, message?: string) => asserts value is BigUint64Array;
function assertBlob
assertBlob: (value: unknown, message?: string) => asserts value is Blob;
function assertBoolean
assertBoolean: (value: unknown, message?: string) => asserts value is boolean;
function assertBoundFunction
assertBoundFunction: ( value: unknown, message?: string) => asserts value is Function;
function assertBuffer
assertBuffer: (value: unknown, message?: string) => asserts value is never;
Note: [Prefer using
Uint8Array
instead ofBuffer
.](https://sindresorhus.com/blog/goodbye-nodejs-buffer)
function assertClass
assertClass: <T>( value: unknown, message?: string) => asserts value is Class<T, any[]>;
function assertDataView
assertDataView: (value: unknown, message?: string) => asserts value is DataView;
function assertDate
assertDate: (value: unknown, message?: string) => asserts value is Date;
function assertDirectInstanceOf
assertDirectInstanceOf: <T>( instance: unknown, class_: Class<T>, message?: string) => asserts instance is T;
function assertEmptyArray
assertEmptyArray: (value: unknown, message?: string) => asserts value is never[];
function assertEmptyMap
assertEmptyMap: ( value: unknown, message?: string) => asserts value is Map<never, never>;
function assertEmptyObject
assertEmptyObject: <Key extends string | number | symbol = string>( value: unknown, message?: string) => asserts value is Record<Key, never>;
function assertEmptySet
assertEmptySet: ( value: unknown, message?: string) => asserts value is Set<never>;
function assertEmptyString
assertEmptyString: (value: unknown, message?: string) => asserts value is '';
function assertEmptyStringOrWhitespace
assertEmptyStringOrWhitespace: ( value: unknown, message?: string) => asserts value is '' | ' ';
function assertEnumCase
assertEnumCase: <T = unknown>( value: unknown, targetEnum: T, message?: string) => asserts value is T[keyof T];
function assertError
assertError: (value: unknown, message?: string) => asserts value is Error;
function assertEvenInteger
assertEvenInteger: (value: number, message?: string) => asserts value is number;
function assertFalsy
assertFalsy: (value: unknown, message?: string) => asserts value is Falsy;
function assertFloat32Array
assertFloat32Array: ( value: unknown, message?: string) => asserts value is Float32Array;
function assertFloat64Array
assertFloat64Array: ( value: unknown, message?: string) => asserts value is Float64Array;
function assertFormData
assertFormData: (value: unknown, message?: string) => asserts value is FormData;
function assertFunction
assertFunction: (value: unknown, message?: string) => asserts value is Function;
function assertGenerator
assertGenerator: ( value: unknown, message?: string) => asserts value is Generator<unknown, any, unknown>;
function assertGeneratorFunction
assertGeneratorFunction: ( value: unknown, message?: string) => asserts value is GeneratorFunction;
function assertHtmlElement
assertHtmlElement: ( value: unknown, message?: string) => asserts value is HTMLElement;
function assertInfinite
assertInfinite: (value: unknown, message?: string) => asserts value is number;
function assertInRange
assertInRange: ( value: number, range: number | [number, number], message?: string) => asserts value is number;
function assertInt16Array
assertInt16Array: ( value: unknown, message?: string) => asserts value is Int16Array;
function assertInt32Array
assertInt32Array: ( value: unknown, message?: string) => asserts value is Int32Array;
function assertInt8Array
assertInt8Array: ( value: unknown, message?: string) => asserts value is Int8Array;
function assertInteger
assertInteger: (value: unknown, message?: string) => asserts value is number;
function assertIterable
assertIterable: <T = unknown>( value: unknown, message?: string) => asserts value is Iterable<T>;
function assertMap
assertMap: <Key = unknown, Value = unknown>( value: unknown, message?: string) => asserts value is Map<Key, Value>;
function assertNan
assertNan: (value: unknown, message?: string) => asserts value is number;
function assertNativePromise
assertNativePromise: <T = unknown>( value: unknown, message?: string) => asserts value is Promise<T>;
function assertNegativeNumber
assertNegativeNumber: ( value: unknown, message?: string) => asserts value is number;
function assertNodeStream
assertNodeStream: (value: unknown, message?: string) => asserts value is any;
function assertNonEmptyArray
assertNonEmptyArray: <T = unknown, Item = unknown>( value: T | Item[], message?: string) => asserts value is [Item, ...Item[]];
function assertNonEmptyMap
assertNonEmptyMap: <Key = unknown, Value = unknown>( value: unknown, message?: string) => asserts value is Map<Key, Value>;
function assertNonEmptyObject
assertNonEmptyObject: < Key extends string | number | symbol = string, Value = unknown>( value: unknown, message?: string) => asserts value is Record<Key, Value>;
function assertNonEmptySet
assertNonEmptySet: <T = unknown>( value: unknown, message?: string) => asserts value is Set<T>;
function assertNonEmptyString
assertNonEmptyString: ( value: unknown, message?: string) => asserts value is string;
function assertNonEmptyStringAndNotWhitespace
assertNonEmptyStringAndNotWhitespace: ( value: unknown, message?: string) => asserts value is string;
function assertNull
assertNull: (value: unknown, message?: string) => asserts value is null;
function assertNullOrUndefined
assertNullOrUndefined: ( value: unknown, message?: string) => asserts value is null;
function assertNumber
assertNumber: (value: unknown, message?: string) => asserts value is number;
function assertNumericString
assertNumericString: ( value: unknown, message?: string) => asserts value is `${number}`;
function assertObject
assertObject: (value: unknown, message?: string) => asserts value is object;
function assertObservable
assertObservable: ( value: unknown, message?: string) => asserts value is ObservableLike;
function assertOddInteger
assertOddInteger: (value: number, message?: string) => asserts value is number;
function assertPlainObject
assertPlainObject: <Value = unknown>( value: unknown, message?: string) => asserts value is Record<PropertyKey, Value>;
function assertPositiveNumber
assertPositiveNumber: ( value: unknown, message?: string) => asserts value is number;
function assertPrimitive
assertPrimitive: ( value: unknown, message?: string) => asserts value is Primitive;
function assertPromise
assertPromise: <T = unknown>( value: unknown, message?: string) => asserts value is Promise<T>;
function assertPropertyKey
assertPropertyKey: (value: unknown, message?: string) => asserts value is number;
function assertRegExp
assertRegExp: (value: unknown, message?: string) => asserts value is RegExp;
function assertSafeInteger
assertSafeInteger: (value: unknown, message?: string) => asserts value is number;
function assertSet
assertSet: <T = unknown>( value: unknown, message?: string) => asserts value is Set<T>;
function assertSharedArrayBuffer
assertSharedArrayBuffer: ( value: unknown, message?: string) => asserts value is SharedArrayBuffer;
function assertString
assertString: (value: unknown, message?: string) => asserts value is string;
function assertSymbol
assertSymbol: (value: unknown, message?: string) => asserts value is symbol;
function assertTruthy
assertTruthy: <T>(value: T | Falsy, message?: string) => asserts value is T;
function assertTupleLike
assertTupleLike: <T extends TypeGuard<unknown>[]>( value: unknown, guards: [...T], message?: string) => asserts value is ResolveTypesOfTypeGuardsTuple<T, []>;
function assertTypedArray
assertTypedArray: ( value: unknown, message?: string) => asserts value is TypedArray;
function assertUint16Array
assertUint16Array: ( value: unknown, message?: string) => asserts value is Uint16Array;
function assertUint32Array
assertUint32Array: ( value: unknown, message?: string) => asserts value is Uint32Array;
function assertUint8Array
assertUint8Array: ( value: unknown, message?: string) => asserts value is Uint8Array;
function assertUint8ClampedArray
assertUint8ClampedArray: ( value: unknown, message?: string) => asserts value is Uint8ClampedArray;
function assertUndefined
assertUndefined: ( value: unknown, message?: string) => asserts value is undefined;
function assertUrlInstance
assertUrlInstance: (value: unknown, message?: string) => asserts value is URL;
function assertUrlSearchParams
assertUrlSearchParams: ( value: unknown, message?: string) => asserts value is URLSearchParams;
function assertUrlString
assertUrlString: (value: unknown, message?: string) => asserts value is string;
function assertValidDate
assertValidDate: (value: unknown, message?: string) => asserts value is Date;
function assertValidLength
assertValidLength: (value: unknown, message?: string) => asserts value is number;
function assertWeakMap
assertWeakMap: <Key extends object = object, Value = unknown>( value: unknown, message?: string) => asserts value is WeakMap<Key, Value>;
function assertWeakRef
assertWeakRef: <T extends object = object>( value: unknown, message?: string) => asserts value is WeakRef<T>;
function assertWeakSet
assertWeakSet: <T extends object = object>( value: unknown, message?: string) => asserts value is WeakSet<T>;
function assertWhitespaceString
assertWhitespaceString: ( value: unknown, message?: string) => asserts value is string;
function detect
detect: (value: unknown) => TypeName;
function isAll
isAll: (predicate: Predicate, ...values: unknown[]) => boolean;
function isAny
isAny: (predicate: Predicate | Predicate[], ...values: unknown[]) => boolean;
function isArray
isArray: <T = unknown>( value: unknown, assertion?: (value: T) => value is T) => value is T[];
function isArrayBuffer
isArrayBuffer: (value: unknown) => value is ArrayBuffer;
function isArrayLike
isArrayLike: <T = unknown>(value: unknown) => value is ArrayLike<T>;
function isAsyncFunction
isAsyncFunction: <T = unknown>( value: unknown) => value is (...arguments_: any[]) => Promise<T>;
function isAsyncGenerator
isAsyncGenerator: ( value: unknown) => value is AsyncGenerator<unknown, any, unknown>;
function isAsyncGeneratorFunction
isAsyncGeneratorFunction: ( value: unknown) => value is (...arguments_: any[]) => Promise<unknown>;
function isAsyncIterable
isAsyncIterable: <T = unknown>(value: unknown) => value is AsyncIterable<T>;
function isBigint
isBigint: (value: unknown) => value is bigint;
function isBigInt64Array
isBigInt64Array: (value: unknown) => value is BigInt64Array;
function isBigUint64Array
isBigUint64Array: (value: unknown) => value is BigUint64Array;
function isBlob
isBlob: (value: unknown) => value is Blob;
function isBoolean
isBoolean: (value: unknown) => value is boolean;
function isBoundFunction
isBoundFunction: (value: unknown) => value is Function;
function isBuffer
isBuffer: (value: unknown) => value is never;
Note: [Prefer using
Uint8Array
instead ofBuffer
.](https://sindresorhus.com/blog/goodbye-nodejs-buffer)
function isClass
isClass: <T = unknown>(value: unknown) => value is Class<T, any[]>;
function isDataView
isDataView: (value: unknown) => value is DataView;
function isDate
isDate: (value: unknown) => value is Date;
function isDirectInstanceOf
isDirectInstanceOf: <T>(instance: unknown, class_: Class<T>) => instance is T;
function isEmptyArray
isEmptyArray: (value: unknown) => value is never[];
function isEmptyMap
isEmptyMap: (value: unknown) => value is Map<never, never>;
function isEmptyObject
isEmptyObject: <Key extends string | number | symbol = string>( value: unknown) => value is Record<Key, never>;
function isEmptySet
isEmptySet: (value: unknown) => value is Set<never>;
function isEmptyString
isEmptyString: (value: unknown) => value is '';
function isEmptyStringOrWhitespace
isEmptyStringOrWhitespace: (value: unknown) => value is '' | ' ';
function isEnumCase
isEnumCase: <T = unknown>(value: unknown, targetEnum: T) => value is T[keyof T];
function isError
isError: (value: unknown) => value is Error;
function isEvenInteger
isEvenInteger: (value: unknown) => value is number;
function isFalsy
isFalsy: (value: unknown) => value is Falsy;
function isFloat32Array
isFloat32Array: (value: unknown) => value is Float32Array;
function isFloat64Array
isFloat64Array: (value: unknown) => value is Float64Array;
function isFormData
isFormData: (value: unknown) => value is FormData;
function isFunction
isFunction: (value: unknown) => value is Function;
function isGenerator
isGenerator: (value: unknown) => value is Generator<unknown, any, unknown>;
function isGeneratorFunction
isGeneratorFunction: (value: unknown) => value is GeneratorFunction;
function isHtmlElement
isHtmlElement: (value: unknown) => value is HTMLElement;
function isInfinite
isInfinite: (value: unknown) => value is number;
function isInRange
isInRange: (value: number, range: number | [number, number]) => value is number;
function isInt16Array
isInt16Array: (value: unknown) => value is Int16Array;
function isInt32Array
isInt32Array: (value: unknown) => value is Int32Array;
function isInt8Array
isInt8Array: (value: unknown) => value is Int8Array;
function isInteger
isInteger: (value: unknown) => value is number;
function isIterable
isIterable: <T = unknown>(value: unknown) => value is Iterable<T>;
function isMap
isMap: <Key = unknown, Value = unknown>( value: unknown) => value is Map<Key, Value>;
function isNan
isNan: (value: unknown) => boolean;
function isNativePromise
isNativePromise: <T = unknown>(value: unknown) => value is Promise<T>;
function isNegativeNumber
isNegativeNumber: (value: unknown) => value is number;
function isNodeStream
isNodeStream: (value: unknown) => value is any;
function isNonEmptyArray
isNonEmptyArray: <T = unknown, Item = unknown>( value: T | Item[]) => value is [Item, ...Item[]];
function isNonEmptyMap
isNonEmptyMap: <Key = unknown, Value = unknown>( value: unknown) => value is Map<Key, Value>;
function isNonEmptyObject
isNonEmptyObject: < Key extends string | number | symbol = string, Value = unknown>( value: unknown) => value is Record<Key, Value>;
function isNonEmptySet
isNonEmptySet: <T = unknown>(value: unknown) => value is Set<T>;
function isNonEmptyString
isNonEmptyString: (value: unknown) => value is NonEmptyString;
function isNonEmptyStringAndNotWhitespace
isNonEmptyStringAndNotWhitespace: (value: unknown) => value is NonEmptyString;
function isNull
isNull: (value: unknown) => value is null;
function isNullOrUndefined
isNullOrUndefined: (value: unknown) => value is null;
function isNumber
isNumber: (value: unknown) => value is number;
function isNumericString
isNumericString: (value: unknown) => value is `${number}`;
function isObject
isObject: (value: unknown) => value is object;
function isObservable
isObservable: (value: unknown) => value is ObservableLike;
function isOddInteger
isOddInteger: (value: unknown) => value is number;
function isPlainObject
isPlainObject: <Value = unknown>( value: unknown) => value is Record<PropertyKey, Value>;
function isPositiveNumber
isPositiveNumber: (value: unknown) => value is number;
function isPrimitive
isPrimitive: (value: unknown) => value is Primitive;
function isPromise
isPromise: <T = unknown>(value: unknown) => value is Promise<T>;
function isPropertyKey
isPropertyKey: (value: unknown) => value is PropertyKey;
function isRegExp
isRegExp: (value: unknown) => value is RegExp;
function isSafeInteger
isSafeInteger: (value: unknown) => value is number;
function isSet
isSet: <T = unknown>(value: unknown) => value is Set<T>;
function isSharedArrayBuffer
isSharedArrayBuffer: (value: unknown) => value is SharedArrayBuffer;
function isString
isString: (value: unknown) => value is string;
function isSymbol
isSymbol: (value: unknown) => value is symbol;
function isTruthy
isTruthy: <T>(value: T | Falsy) => value is T;
function isTupleLike
isTupleLike: <T extends TypeGuard<unknown>[]>( value: unknown, guards: [...T]) => value is ResolveTypesOfTypeGuardsTuple<T, []>;
function isTypedArray
isTypedArray: (value: unknown) => value is TypedArray;
function isUint16Array
isUint16Array: (value: unknown) => value is Uint16Array;
function isUint32Array
isUint32Array: (value: unknown) => value is Uint32Array;
function isUint8Array
isUint8Array: (value: unknown) => value is Uint8Array;
function isUint8ClampedArray
isUint8ClampedArray: (value: unknown) => value is Uint8ClampedArray;
function isUndefined
isUndefined: (value: unknown) => value is undefined;
function isUrlInstance
isUrlInstance: (value: unknown) => value is URL;
function isUrlSearchParams
isUrlSearchParams: (value: unknown) => value is URLSearchParams;
function isUrlString
isUrlString: (value: unknown) => value is string;
function isValidDate
isValidDate: (value: unknown) => value is Date;
function isValidLength
isValidLength: (value: unknown) => value is number;
function isWeakMap
isWeakMap: <Key extends object = object, Value = unknown>( value: unknown) => value is WeakMap<Key, Value>;
function isWeakRef
isWeakRef: (value: unknown) => value is WeakRef<object>;
function isWeakSet
isWeakSet: (value: unknown) => value is WeakSet<object>;
function isWhitespaceString
isWhitespaceString: (value: unknown) => value is ' ';
Type Aliases
type ArrayLike
type ArrayLike<T> = { readonly [index: number]: T; readonly length: number;};
type AssertionTypeDescription
type AssertionTypeDescription = (typeof assertionTypeDescriptions)[number];
type Class
type Class<T, Arguments extends unknown[] = any[]> = Constructor<T, Arguments> & { prototype: T;};
Matches a [
class
](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
type NodeStream
type NodeStream = { pipe<T extends NodeJS.WritableStream>( destination: T, options?: { end?: boolean; } ): T;} & NodeJS.EventEmitter;
type ObservableLike
type ObservableLike = { subscribe(observer: (value: unknown) => void): void; [Symbol.observable](): ObservableLike;};
Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
type Predicate
type Predicate = (value: unknown) => boolean;
type Primitive
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
type TypedArray
type TypedArray = | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like
Uint8Array
orFloat64Array
.
type TypeName
type TypeName = ObjectTypeName | PrimitiveTypeName;
Package Files (2)
Dependencies (0)
No dependencies.
Dev Dependencies (14)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@sindresorhus/is
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@sindresorhus/is)
- HTML<a href="https://www.jsdocs.io/package/@sindresorhus/is"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6586 ms. - Missing or incorrect documentation? Open an issue for this package.