Negatively Proportional Model
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

is-error-constructor

2.1.0 • Public • Published

is-error-constructor Build Status

Check if a value is an error constructor

Install

$ npm install is-error-constructor

Usage

const isErrorConstructor = require('is-error-constructor');
 
isErrorConstructor(Error);
//=> true
 
isErrorConstructor(RangeError);
//=> true
 
function FakeError() {}
isErrorConstructor(FakeError);
//=> false
 
class UnicornError extends Error {}
isErrorConstructor(UnicornError);
//=> true

License

MIT © Sindre Sorhus

Install

npm i is-error-constructor

DownloadsWeekly Downloads

193

Version

2.1.0

License

MIT

Unpacked Size

3.35 kB

Total Files

5

Last publish

Collaborators

  • avatar