@sindresorhus/is

  • Version 6.2.0
  • Published
  • 94.2 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

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;
      class_: typeof isClass;
      dataView: typeof isDataView;
      date: typeof isDate;
      detect: typeof detect;
      directInstanceOf: typeof isDirectInstanceOf;
      domElement: typeof isHtmlElement;
      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;
      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;
      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
                ) => asserts value is T[];

                  function assertArrayBuffer

                  assertArrayBuffer: (value: unknown) => asserts value is ArrayBuffer;

                    function assertArrayLike

                    assertArrayLike: <T = unknown>(value: unknown) => asserts value is ArrayLike<T>;

                      function assertAsyncFunction

                      assertAsyncFunction: (value: unknown) => asserts value is Function;

                        function assertAsyncGenerator

                        assertAsyncGenerator: (
                        value: unknown
                        ) => asserts value is AsyncGenerator<unknown, any, unknown>;

                          function assertAsyncGeneratorFunction

                          assertAsyncGeneratorFunction: (
                          value: unknown
                          ) => asserts value is AsyncGeneratorFunction;

                            function assertAsyncIterable

                            assertAsyncIterable: <T = unknown>(
                            value: unknown
                            ) => asserts value is AsyncIterable<T>;

                              function assertBigint

                              assertBigint: (value: unknown) => asserts value is bigint;

                                function assertBigInt64Array

                                assertBigInt64Array: (value: unknown) => asserts value is BigInt64Array;

                                  function assertBigUint64Array

                                  assertBigUint64Array: (value: unknown) => asserts value is BigUint64Array;

                                    function assertBlob

                                    assertBlob: (value: unknown) => asserts value is Blob;

                                      function assertBoolean

                                      assertBoolean: (value: unknown) => asserts value is boolean;

                                        function assertBoundFunction

                                        assertBoundFunction: (value: unknown) => asserts value is Function;

                                          function assertBuffer

                                          assertBuffer: (value: unknown) => asserts value is Buffer;

                                            function assertClass

                                            assertClass: (value: unknown) => asserts value is Class<unknown, any[]>;

                                              function assertDataView

                                              assertDataView: (value: unknown) => asserts value is DataView;

                                                function assertDate

                                                assertDate: (value: unknown) => asserts value is Date;

                                                  function assertDirectInstanceOf

                                                  assertDirectInstanceOf: <T>(
                                                  instance: unknown,
                                                  class_: Class<T>
                                                  ) => asserts instance is T;

                                                    function assertEmptyArray

                                                    assertEmptyArray: (value: unknown) => asserts value is never[];

                                                      function assertEmptyMap

                                                      assertEmptyMap: (value: unknown) => asserts value is Map<never, never>;

                                                        function assertEmptyObject

                                                        assertEmptyObject: <Key extends string | number | symbol = string>(
                                                        value: unknown
                                                        ) => asserts value is Record<Key, never>;

                                                          function assertEmptySet

                                                          assertEmptySet: (value: unknown) => asserts value is Set<never>;

                                                            function assertEmptyString

                                                            assertEmptyString: (value: unknown) => asserts value is '';

                                                              function assertEmptyStringOrWhitespace

                                                              assertEmptyStringOrWhitespace: (value: unknown) => asserts value is string;

                                                                function assertEnumCase

                                                                assertEnumCase: <T = unknown>(
                                                                value: unknown,
                                                                targetEnum: T
                                                                ) => asserts value is T[keyof T];

                                                                  function assertError

                                                                  assertError: (value: unknown) => asserts value is Error;

                                                                    function assertEvenInteger

                                                                    assertEvenInteger: (value: number) => asserts value is number;

                                                                      function assertFalsy

                                                                      assertFalsy: (value: unknown) => asserts value is Falsy;

                                                                        function assertFloat32Array

                                                                        assertFloat32Array: (value: unknown) => asserts value is Float32Array;

                                                                          function assertFloat64Array

                                                                          assertFloat64Array: (value: unknown) => asserts value is Float64Array;

                                                                            function assertFormData

                                                                            assertFormData: (value: unknown) => asserts value is FormData;

                                                                              function assertFunction

                                                                              assertFunction: (value: unknown) => asserts value is Function;

                                                                                function assertGenerator

                                                                                assertGenerator: (
                                                                                value: unknown
                                                                                ) => asserts value is Generator<unknown, any, unknown>;

                                                                                  function assertGeneratorFunction

                                                                                  assertGeneratorFunction: (value: unknown) => asserts value is GeneratorFunction;

                                                                                    function assertHtmlElement

                                                                                    assertHtmlElement: (value: unknown) => asserts value is HTMLElement;

                                                                                      function assertInfinite

                                                                                      assertInfinite: (value: unknown) => asserts value is number;

                                                                                        function assertInRange

                                                                                        assertInRange: (
                                                                                        value: number,
                                                                                        range: number | [number, number]
                                                                                        ) => asserts value is number;

                                                                                          function assertInt16Array

                                                                                          assertInt16Array: (value: unknown) => asserts value is Int16Array;

                                                                                            function assertInt32Array

                                                                                            assertInt32Array: (value: unknown) => asserts value is Int32Array;

                                                                                              function assertInt8Array

                                                                                              assertInt8Array: (value: unknown) => asserts value is Int8Array;

                                                                                                function assertInteger

                                                                                                assertInteger: (value: unknown) => asserts value is number;

                                                                                                  function assertIterable

                                                                                                  assertIterable: <T = unknown>(value: unknown) => asserts value is Iterable<T>;

                                                                                                    function assertMap

                                                                                                    assertMap: <Key = unknown, Value = unknown>(
                                                                                                    value: unknown
                                                                                                    ) => asserts value is Map<Key, Value>;

                                                                                                      function assertNan

                                                                                                      assertNan: (value: unknown) => asserts value is number;

                                                                                                        function assertNativePromise

                                                                                                        assertNativePromise: <T = unknown>(
                                                                                                        value: unknown
                                                                                                        ) => asserts value is Promise<T>;

                                                                                                          function assertNegativeNumber

                                                                                                          assertNegativeNumber: (value: unknown) => asserts value is number;

                                                                                                            function assertNodeStream

                                                                                                            assertNodeStream: (value: unknown) => asserts value is any;

                                                                                                              function assertNonEmptyArray

                                                                                                              assertNonEmptyArray: <T = unknown, Item = unknown>(
                                                                                                              value: T | Item[]
                                                                                                              ) => asserts value is [Item, ...Item[]];

                                                                                                                function assertNonEmptyMap

                                                                                                                assertNonEmptyMap: <Key = unknown, Value = unknown>(
                                                                                                                value: unknown
                                                                                                                ) => asserts value is Map<Key, Value>;

                                                                                                                  function assertNonEmptyObject

                                                                                                                  assertNonEmptyObject: <
                                                                                                                  Key extends string | number | symbol = string,
                                                                                                                  Value = unknown
                                                                                                                  >(
                                                                                                                  value: unknown
                                                                                                                  ) => asserts value is Record<Key, Value>;

                                                                                                                    function assertNonEmptySet

                                                                                                                    assertNonEmptySet: <T = unknown>(value: unknown) => asserts value is Set<T>;

                                                                                                                      function assertNonEmptyString

                                                                                                                      assertNonEmptyString: (value: unknown) => asserts value is string;

                                                                                                                        function assertNonEmptyStringAndNotWhitespace

                                                                                                                        assertNonEmptyStringAndNotWhitespace: (
                                                                                                                        value: unknown
                                                                                                                        ) => asserts value is string;

                                                                                                                          function assertNull

                                                                                                                          assertNull: (value: unknown) => asserts value is null;

                                                                                                                            function assertNullOrUndefined

                                                                                                                            assertNullOrUndefined: (value: unknown) => asserts value is null;

                                                                                                                              function assertNumber

                                                                                                                              assertNumber: (value: unknown) => asserts value is number;

                                                                                                                                function assertNumericString

                                                                                                                                assertNumericString: (value: unknown) => asserts value is `${number}`;

                                                                                                                                  function assertObject

                                                                                                                                  assertObject: (value: unknown) => asserts value is object;

                                                                                                                                    function assertObservable

                                                                                                                                    assertObservable: (value: unknown) => asserts value is ObservableLike;

                                                                                                                                      function assertOddInteger

                                                                                                                                      assertOddInteger: (value: number) => asserts value is number;

                                                                                                                                        function assertPlainObject

                                                                                                                                        assertPlainObject: <Value = unknown>(
                                                                                                                                        value: unknown
                                                                                                                                        ) => asserts value is Record<PropertyKey, Value>;

                                                                                                                                          function assertPositiveNumber

                                                                                                                                          assertPositiveNumber: (value: unknown) => asserts value is number;

                                                                                                                                            function assertPrimitive

                                                                                                                                            assertPrimitive: (value: unknown) => asserts value is Primitive;

                                                                                                                                              function assertPromise

                                                                                                                                              assertPromise: <T = unknown>(value: unknown) => asserts value is Promise<T>;

                                                                                                                                                function assertPropertyKey

                                                                                                                                                assertPropertyKey: (value: unknown) => asserts value is number;

                                                                                                                                                  function assertRegExp

                                                                                                                                                  assertRegExp: (value: unknown) => asserts value is RegExp;

                                                                                                                                                    function assertSafeInteger

                                                                                                                                                    assertSafeInteger: (value: unknown) => asserts value is number;

                                                                                                                                                      function assertSet

                                                                                                                                                      assertSet: <T = unknown>(value: unknown) => asserts value is Set<T>;

                                                                                                                                                        function assertSharedArrayBuffer

                                                                                                                                                        assertSharedArrayBuffer: (value: unknown) => asserts value is SharedArrayBuffer;

                                                                                                                                                          function assertString

                                                                                                                                                          assertString: (value: unknown) => asserts value is string;

                                                                                                                                                            function assertSymbol

                                                                                                                                                            assertSymbol: (value: unknown) => asserts value is symbol;

                                                                                                                                                              function assertTruthy

                                                                                                                                                              assertTruthy: <T>(value: T | Falsy) => asserts value is T;

                                                                                                                                                                function assertTupleLike

                                                                                                                                                                assertTupleLike: <T extends TypeGuard<unknown>[]>(
                                                                                                                                                                value: unknown,
                                                                                                                                                                guards: [...T]
                                                                                                                                                                ) => asserts value is ResolveTypesOfTypeGuardsTuple<T, []>;

                                                                                                                                                                  function assertTypedArray

                                                                                                                                                                  assertTypedArray: (value: unknown) => asserts value is TypedArray;

                                                                                                                                                                    function assertUint16Array

                                                                                                                                                                    assertUint16Array: (value: unknown) => asserts value is Uint16Array;

                                                                                                                                                                      function assertUint32Array

                                                                                                                                                                      assertUint32Array: (value: unknown) => asserts value is Uint32Array;

                                                                                                                                                                        function assertUint8Array

                                                                                                                                                                        assertUint8Array: (value: unknown) => asserts value is Uint8Array;

                                                                                                                                                                          function assertUint8ClampedArray

                                                                                                                                                                          assertUint8ClampedArray: (value: unknown) => asserts value is Uint8ClampedArray;

                                                                                                                                                                            function assertUndefined

                                                                                                                                                                            assertUndefined: (value: unknown) => asserts value is undefined;

                                                                                                                                                                              function assertUrlInstance

                                                                                                                                                                              assertUrlInstance: (value: unknown) => asserts value is URL;

                                                                                                                                                                                function assertUrlSearchParams

                                                                                                                                                                                assertUrlSearchParams: (value: unknown) => asserts value is URLSearchParams;

                                                                                                                                                                                  function assertUrlString

                                                                                                                                                                                  assertUrlString: (value: unknown) => asserts value is string;

                                                                                                                                                                                    function assertValidDate

                                                                                                                                                                                    assertValidDate: (value: unknown) => asserts value is Date;

                                                                                                                                                                                      function assertValidLength

                                                                                                                                                                                      assertValidLength: (value: unknown) => asserts value is number;

                                                                                                                                                                                        function assertWeakMap

                                                                                                                                                                                        assertWeakMap: <Key extends object = object, Value = unknown>(
                                                                                                                                                                                        value: unknown
                                                                                                                                                                                        ) => asserts value is WeakMap<Key, Value>;

                                                                                                                                                                                          function assertWeakRef

                                                                                                                                                                                          assertWeakRef: <T extends object = object>(
                                                                                                                                                                                          value: unknown
                                                                                                                                                                                          ) => asserts value is WeakRef<T>;

                                                                                                                                                                                            function assertWeakSet

                                                                                                                                                                                            assertWeakSet: <T extends object = object>(
                                                                                                                                                                                            value: unknown
                                                                                                                                                                                            ) => asserts value is WeakSet<T>;

                                                                                                                                                                                              function assertWhitespaceString

                                                                                                                                                                                              assertWhitespaceString: (value: unknown) => 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 (...args: any[]) => Promise<T>;

                                                                                                                                                                                                              function isAsyncGenerator

                                                                                                                                                                                                              isAsyncGenerator: (
                                                                                                                                                                                                              value: unknown
                                                                                                                                                                                                              ) => value is AsyncGenerator<unknown, any, unknown>;

                                                                                                                                                                                                                function isAsyncGeneratorFunction

                                                                                                                                                                                                                isAsyncGeneratorFunction: (
                                                                                                                                                                                                                value: unknown
                                                                                                                                                                                                                ) => value is (...args: 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 Buffer;

                                                                                                                                                                                                                                  function isClass

                                                                                                                                                                                                                                  isClass: (value: unknown) => value is Class<unknown, 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 string;

                                                                                                                                                                                                                                                      function isEnumCase

                                                                                                                                                                                                                                                      isEnumCase: <T = unknown>(value: unknown, targetEnum: T) => boolean;

                                                                                                                                                                                                                                                        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 string;

                                                                                                                                                                                                                                                                                                                                                                                      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 = unknown, Arguments extends any[] = any[]> = new (
                                                                                                                                                                                                                                                                                                                                                                                          ...arguments_: Arguments
                                                                                                                                                                                                                                                                                                                                                                                          ) => 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 or Float64Array.

                                                                                                                                                                                                                                                                                                                                                                                              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 onejsDocs.io badgeto 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>