JSPM

is-typeof-error

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 180
  • Score
    100M100P100Q72969F
  • 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
npm test

Usage

For more use-cases see the tests

var isError = require('is-typeof-error')
var KindError = require('kind-error')
var PluginError = require('plugin-error')

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

isError(new TypeError('test')) //=> true
isError(new SyntaxError('test')) //=> true
isError(new SyntaxError('test')) //=> true
isError(new PluginError('test', 'msg')) //=> true
isError(new CustomClass('test')) //=> false
isError(new Object({a: 'b'})) //=> false
isError(new RegExp('test')) //=> false
isError(Object.create({a: 'b'})) //=> false
isError(/regex/) //=> false
isError({a: 'b'}) //=> false
  • is-kindof: Check type of given javascript value. Support promises, generators, streams, and native types. Thin wrapper around kind-of module.
  • is-missing: Check that given name or user/repo exists in npm registry or in github as user repository.
  • kind-error: Correct inheriting from Error. Supports constructing from an object of properties - focused on assertion.
  • kind-of-extra: Extends kind-of type check utility with support for promises, generators, streams and errors. Like kindof(Promise.resolve(1)) === 'promise' and etc.
  • kind-of-types: List of all javascript types. Used and useful for checking, validation, sanitizing and testing. Like isStream, isPromise, isWeakset and etc.

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