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

Package Sidebar

Install

npm i is-error-constructor

Weekly Downloads

458

Version

3.0.0

License

MIT

Unpacked Size

2.91 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus