| 1 |
# es-errors <sup>[![Version Badge][npm-version-svg]][package-url]</sup> |
| 2 |
|
| 3 |
[![github actions][actions-image]][actions-url] |
| 4 |
[![coverage][codecov-image]][codecov-url] |
| 5 |
[![License][license-image]][license-url] |
| 6 |
[![Downloads][downloads-image]][downloads-url] |
| 7 |
|
| 8 |
[![npm badge][npm-badge-png]][package-url] |
| 9 |
|
| 10 |
A simple cache for a few of the JS Error constructors. |
| 11 |
|
| 12 |
## Example |
| 13 |
|
| 14 |
```js |
| 15 |
const assert = require('assert'); |
| 16 |
|
| 17 |
const Base = require('es-errors'); |
| 18 |
const Eval = require('es-errors/eval'); |
| 19 |
const Range = require('es-errors/range'); |
| 20 |
const Ref = require('es-errors/ref'); |
| 21 |
const Syntax = require('es-errors/syntax'); |
| 22 |
const Type = require('es-errors/type'); |
| 23 |
const URI = require('es-errors/uri'); |
| 24 |
|
| 25 |
assert.equal(Base, Error); |
| 26 |
assert.equal(Eval, EvalError); |
| 27 |
assert.equal(Range, RangeError); |
| 28 |
assert.equal(Ref, ReferenceError); |
| 29 |
assert.equal(Syntax, SyntaxError); |
| 30 |
assert.equal(Type, TypeError); |
| 31 |
assert.equal(URI, URIError); |
| 32 |
``` |
| 33 |
|
| 34 |
## Tests |
| 35 |
Simply clone the repo, `npm install`, and run `npm test` |
| 36 |
|
| 37 |
## Security |
| 38 |
|
| 39 |
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. |
| 40 |
|
| 41 |
[package-url]: https://npmjs.org/package/es-errors |
| 42 |
[npm-version-svg]: https://versionbadg.es/ljharb/es-errors.svg |
| 43 |
[deps-svg]: https://david-dm.org/ljharb/es-errors.svg |
| 44 |
[deps-url]: https://david-dm.org/ljharb/es-errors |
| 45 |
[dev-deps-svg]: https://david-dm.org/ljharb/es-errors/dev-status.svg |
| 46 |
[dev-deps-url]: https://david-dm.org/ljharb/es-errors#info=devDependencies |
| 47 |
[npm-badge-png]: https://nodei.co/npm/es-errors.png?downloads=true&stars=true |
| 48 |
[license-image]: https://img.shields.io/npm/l/es-errors.svg |
| 49 |
[license-url]: LICENSE |
| 50 |
[downloads-image]: https://img.shields.io/npm/dm/es-errors.svg |
| 51 |
[downloads-url]: https://npm-stat.com/charts.html?package=es-errors |
| 52 |
[codecov-image]: https://codecov.io/gh/ljharb/es-errors/branch/main/graphs/badge.svg |
| 53 |
[codecov-url]: https://app.codecov.io/gh/ljharb/es-errors/ |
| 54 |
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-errors |
| 55 |
[actions-url]: https://github.com/ljharb/es-errors/actions |