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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.017latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.017
2.1.0395
2.0.00
1.0.1171
1.0.00

Package Sidebar

Install

npm i is-error-constructor

Weekly Downloads

566

Version

3.0.0

License

MIT

Unpacked Size

2.91 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus