JSPM

is-typeof-error

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 174
  • Score
    100M100P100Q72957F
  • License MIT

Check that given value is any type of error and instanceof Error.

Package Exports

  • is-typeof-error

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-typeof-error) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-typeof-error npmjs.com The MIT License

Check that given value is any type of error and instanceof Error.

code climate standard code style travis build status coverage status dependency status

Install

npm i is-typeof-error --save

Usage

For more use-cases see the tests

const isTypeofError = require('is-typeof-error')

isTypeofError

Check that val is error.

Params

  • val {Error}
  • returns {Boolean}

Example

const isTypeofError = require('is-typeof-error')
const PluginError = require('plugin-error')
const KindError = require('kind-error')

const CustomClass = function () {}
CustomClass.prototype.foo = function () {}

isTypeofError(new TypeError('test'))           // => true
isTypeofError(new KindError('test'))           // => true
isTypeofError(new SyntaxError('test'))         // => true
isTypeofError(new PluginError('test', 'msg'))  // => true

isTypeofError(new CustomClass('test'))         // => false
isTypeofError(new Object({a: 'b'}))            // => false
isTypeofError(new RegExp('test'))              // => false
isTypeofError(Object.create({a: 'b'}))         // => false
isTypeofError(/regex/)                         // => false
isTypeofError({a: 'b'})                        // => false

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github