is-error-constructor
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

is-error-constructor

Check if a value is an error constructor

Install

$ npm install is-error-constructor

Usage

import isErrorConstructor from 'is-error-constructor';

isErrorConstructor(Error);
//=> true

isErrorConstructor(RangeError);
//=> true

function FakeError() {}
isErrorConstructor(FakeError);
//=> false

class UnicornError extends Error {}
isErrorConstructor(UnicornError);
//=> true

Related

  • is - Type check values

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i is-error-constructor

    Weekly Downloads

    806

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    2.91 kB

    Total Files

    5

    Last publish

    Collaborators

    • sindresorhus