interface API {
    isCtorName(target: unknown, types: string | Set<string>): boolean;
    isDate(target: unknown): target is Date;
    isError(target: unknown): target is Error;
    isMap(target: unknown): target is Map<unknown, unknown>;
    isPromise(target: unknown): target is Promise<unknown>;
    isRegExp(target: unknown): target is RegExp;
    isSet(target: unknown): target is Set<unknown>;
}
Index
  • Provides basic type checking by constructor name(s) for objects. This can be useful when checking multiple constructor names against a provided Set.

    Parameters

    • target: unknown

      Object to test for constructor name.

    • types: string | Set<string>

      Specific constructor name or Set of constructor names to match.

    Returns boolean

    Does the provided object constructor name match the types provided.

  • Provides basic prototype string type checking if target is a Date.

    Parameters

    • target: unknown

      A potential Date to test.

    Returns target is Date

    Is target a Date.

  • Provides detection via Error.isError where available or basic prototype string type checking if target is an Error.

    Parameters

    • target: unknown

      A potential Error to test.

    Returns target is Error

    Is target an Error.

  • Provides basic prototype string type checking if target is a Map.

    Parameters

    • target: unknown

      A potential Map to test.

    Returns target is Map<unknown, unknown>

    Is target a Map.

  • Provides basic prototype string type checking if target is a Promise.

    Parameters

    • target: unknown

      A potential Promise to test.

    Returns target is Promise<unknown>

    Is target a Promise.

  • Provides basic prototype string type checking if target is a RegExp.

    Parameters

    • target: unknown

      A potential RegExp to test.

    Returns target is RegExp

    Is target a RegExp.

  • Provides basic prototype string type checking if target is a Set.

    Parameters

    • target: unknown

      A potential Set to test.

    Returns target is Set<unknown>

    Is target a Set.