3.0.0 • Published 3 years ago

is-error-constructor v3.0.0

Weekly downloads
294
License
MIT
Repository
github
Last release
3 years ago

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