pax_global_header 0000666 0000000 0000000 00000000064 14560113330 0014506 g ustar 00root root 0000000 0000000 52 comment=5599cf0ebe75cc3685445f83ca80207a357fdb12
ljharb-es-errors-ff7be42/ 0000775 0000000 0000000 00000000000 14560113330 0015370 5 ustar 00root root 0000000 0000000 ljharb-es-errors-ff7be42/.eslintrc 0000664 0000000 0000000 00000000053 14560113330 0017212 0 ustar 00root root 0000000 0000000 {
"root": true,
"extends": "@ljharb",
}
ljharb-es-errors-ff7be42/.github/ 0000775 0000000 0000000 00000000000 14560113330 0016730 5 ustar 00root root 0000000 0000000 ljharb-es-errors-ff7be42/.github/FUNDING.yml 0000664 0000000 0000000 00000001053 14560113330 0020544 0 ustar 00root root 0000000 0000000 # These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/es-errors
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with a single custom sponsorship URL
ljharb-es-errors-ff7be42/.github/workflows/ 0000775 0000000 0000000 00000000000 14560113330 0020765 5 ustar 00root root 0000000 0000000 ljharb-es-errors-ff7be42/.github/workflows/node-aught.yml 0000664 0000000 0000000 00000000565 14560113330 0023551 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js < 10'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '< 10'
type: minors
command: npm run tests-only
skip-ls-check: true
node:
name: 'node < 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
ljharb-es-errors-ff7be42/.github/workflows/node-pretest.yml 0000664 0000000 0000000 00000000245 14560113330 0024122 0 ustar 00root root 0000000 0000000 name: 'Tests: pretest/posttest'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
ljharb-es-errors-ff7be42/.github/workflows/node-tens.yml 0000664 0000000 0000000 00000000536 14560113330 0023410 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js >= 10'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 10'
type: minors
command: npm run tests-only
node:
name: 'node >= 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: true
ljharb-es-errors-ff7be42/.github/workflows/rebase.yml 0000664 0000000 0000000 00000000700 14560113330 0022746 0 ustar 00root root 0000000 0000000 name: Automatic Rebase
on: [pull_request_target]
permissions:
contents: read
jobs:
_:
permissions:
contents: write # for ljharb/rebase to push code to rebase
pull-requests: read # for ljharb/rebase to get info about PR
name: "Automatic Rebase"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ljharb-es-errors-ff7be42/.github/workflows/require-allow-edits.yml 0000664 0000000 0000000 00000000515 14560113330 0025407 0 ustar 00root root 0000000 0000000 name: Require “Allow Edits”
on: [pull_request_target]
permissions:
contents: read
jobs:
_:
permissions:
pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR
name: "Require “Allow Edits”"
runs-on: ubuntu-latest
steps:
- uses: ljharb/require-allow-edits@main
ljharb-es-errors-ff7be42/.gitignore 0000664 0000000 0000000 00000004136 14560113330 0017364 0 ustar 00root root 0000000 0000000 # Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
.npmignore
ljharb-es-errors-ff7be42/.npmrc 0000664 0000000 0000000 00000000067 14560113330 0016513 0 ustar 00root root 0000000 0000000 package-lock=false
allow-same-version=true
message=v%s
ljharb-es-errors-ff7be42/CHANGELOG.md 0000664 0000000 0000000 00000003451 14560113330 0017204 0 ustar 00root root 0000000 0000000 # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.3.0](https://github.com/ljharb/es-errors/compare/v1.2.1...v1.3.0) - 2024-02-05
### Commits
- [New] add `EvalError` and `URIError` [`1927627`](https://github.com/ljharb/es-errors/commit/1927627ba68cb6c829d307231376c967db53acdf)
## [v1.2.1](https://github.com/ljharb/es-errors/compare/v1.2.0...v1.2.1) - 2024-02-04
### Commits
- [Fix] add missing `exports` entry [`5bb5f28`](https://github.com/ljharb/es-errors/commit/5bb5f280f98922701109d6ebb82eea2257cecc7e)
## [v1.2.0](https://github.com/ljharb/es-errors/compare/v1.1.0...v1.2.0) - 2024-02-04
### Commits
- [New] add `ReferenceError` [`6d8cf5b`](https://github.com/ljharb/es-errors/commit/6d8cf5bbb6f3f598d02cf6f30e468ba2caa8e143)
## [v1.1.0](https://github.com/ljharb/es-errors/compare/v1.0.0...v1.1.0) - 2024-02-04
### Commits
- [New] add base Error [`2983ab6`](https://github.com/ljharb/es-errors/commit/2983ab65f7bc5441276cb021dc3aa03c78881698)
## v1.0.0 - 2024-02-03
### Commits
- Initial implementation, tests, readme, type [`8f47631`](https://github.com/ljharb/es-errors/commit/8f476317e9ad76f40ad648081829b1a1a3a1288b)
- Initial commit [`ea5d099`](https://github.com/ljharb/es-errors/commit/ea5d099ef18e550509ab9e2be000526afd81c385)
- npm init [`6f5ebf9`](https://github.com/ljharb/es-errors/commit/6f5ebf9cead474dadd72b9e63dad315820a089ae)
- Only apps should have lockfiles [`e1a0aeb`](https://github.com/ljharb/es-errors/commit/e1a0aeb7b80f5cfc56be54d6b2100e915d47def8)
- [meta] add `sideEffects` flag [`a9c7d46`](https://github.com/ljharb/es-errors/commit/a9c7d460a492f1d8a241c836bc25a322a19cc043)
ljharb-es-errors-ff7be42/LICENSE 0000664 0000000 0000000 00000002057 14560113330 0016401 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2024 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
ljharb-es-errors-ff7be42/README.md 0000664 0000000 0000000 00000004102 14560113330 0016644 0 ustar 00root root 0000000 0000000 # es-errors [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
A simple cache for a few of the JS Error constructors.
## Example
```js
const assert = require('assert');
const Base = require('es-errors');
const Eval = require('es-errors/eval');
const Range = require('es-errors/range');
const Ref = require('es-errors/ref');
const Syntax = require('es-errors/syntax');
const Type = require('es-errors/type');
const URI = require('es-errors/uri');
assert.equal(Base, Error);
assert.equal(Eval, EvalError);
assert.equal(Range, RangeError);
assert.equal(Ref, ReferenceError);
assert.equal(Syntax, SyntaxError);
assert.equal(Type, TypeError);
assert.equal(URI, URIError);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
## Security
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
[package-url]: https://npmjs.org/package/es-errors
[npm-version-svg]: https://versionbadg.es/ljharb/es-errors.svg
[deps-svg]: https://david-dm.org/ljharb/es-errors.svg
[deps-url]: https://david-dm.org/ljharb/es-errors
[dev-deps-svg]: https://david-dm.org/ljharb/es-errors/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/es-errors#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/es-errors.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/es-errors.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/es-errors.svg
[downloads-url]: https://npm-stat.com/charts.html?package=es-errors
[codecov-image]: https://codecov.io/gh/ljharb/es-errors/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/es-errors/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-errors
[actions-url]: https://github.com/ljharb/es-errors/actions
ljharb-es-errors-ff7be42/eval.d.ts 0000664 0000000 0000000 00000000104 14560113330 0017104 0 ustar 00root root 0000000 0000000 declare const EvalError: EvalErrorConstructor;
export = EvalError;
ljharb-es-errors-ff7be42/eval.js 0000664 0000000 0000000 00000000113 14560113330 0016650 0 ustar 00root root 0000000 0000000 'use strict';
/** @type {import('./eval')} */
module.exports = EvalError;
ljharb-es-errors-ff7be42/index.d.ts 0000664 0000000 0000000 00000000070 14560113330 0017266 0 ustar 00root root 0000000 0000000 declare const Error: ErrorConstructor;
export = Error;
ljharb-es-errors-ff7be42/index.js 0000664 0000000 0000000 00000000102 14560113330 0017026 0 ustar 00root root 0000000 0000000 'use strict';
/** @type {import('.')} */
module.exports = Error;
ljharb-es-errors-ff7be42/package.json 0000664 0000000 0000000 00000004176 14560113330 0017666 0 ustar 00root root 0000000 0000000 {
"name": "es-errors",
"version": "1.3.0",
"description": "A simple cache for a few of the JS Error constructors.",
"main": "index.js",
"exports": {
".": "./index.js",
"./eval": "./eval.js",
"./range": "./range.js",
"./ref": "./ref.js",
"./syntax": "./syntax.js",
"./type": "./type.js",
"./uri": "./uri.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "nyc tape 'test/**/*.js'",
"posttest": "aud --production",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc -p . && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/ljharb/es-errors.git"
},
"keywords": [
"javascript",
"ecmascript",
"error",
"typeerror",
"syntaxerror",
"rangeerror"
],
"author": "Jordan Harband ",
"license": "MIT",
"bugs": {
"url": "https://github.com/ljharb/es-errors/issues"
},
"homepage": "https://github.com/ljharb/es-errors#readme",
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"@types/tape": "^5.6.4",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"eclint": "^2.8.1",
"eslint": "^8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.4",
"typescript": "next"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"engines": {
"node": ">= 0.4"
}
}
ljharb-es-errors-ff7be42/range.d.ts 0000664 0000000 0000000 00000000107 14560113330 0017254 0 ustar 00root root 0000000 0000000 declare const RangeError: RangeErrorConstructor;
export = RangeError;
ljharb-es-errors-ff7be42/range.js 0000664 0000000 0000000 00000000115 14560113330 0017017 0 ustar 00root root 0000000 0000000 'use strict';
/** @type {import('./range')} */
module.exports = RangeError;
ljharb-es-errors-ff7be42/ref.d.ts 0000664 0000000 0000000 00000000123 14560113330 0016732 0 ustar 00root root 0000000 0000000 declare const ReferenceError: ReferenceErrorConstructor;
export = ReferenceError;
ljharb-es-errors-ff7be42/ref.js 0000664 0000000 0000000 00000000117 14560113330 0016501 0 ustar 00root root 0000000 0000000 'use strict';
/** @type {import('./ref')} */
module.exports = ReferenceError;
ljharb-es-errors-ff7be42/syntax.d.ts 0000664 0000000 0000000 00000000112 14560113330 0017502 0 ustar 00root root 0000000 0000000 declare const SyntaxError: SyntaxErrorConstructor;
export = SyntaxError;
ljharb-es-errors-ff7be42/syntax.js 0000664 0000000 0000000 00000000117 14560113330 0017253 0 ustar 00root root 0000000 0000000 'use strict';
/** @type {import('./syntax')} */
module.exports = SyntaxError;
ljharb-es-errors-ff7be42/test/ 0000775 0000000 0000000 00000000000 14560113330 0016347 5 ustar 00root root 0000000 0000000 ljharb-es-errors-ff7be42/test/index.js 0000664 0000000 0000000 00000000544 14560113330 0020017 0 ustar 00root root 0000000 0000000 'use strict';
var test = require('tape');
var E = require('../');
var R = require('../range');
var Ref = require('../ref');
var S = require('../syntax');
var T = require('../type');
test('errors', function (t) {
t.equal(E, Error);
t.equal(R, RangeError);
t.equal(Ref, ReferenceError);
t.equal(S, SyntaxError);
t.equal(T, TypeError);
t.end();
});
ljharb-es-errors-ff7be42/tsconfig.json 0000664 0000000 0000000 00000006142 14560113330 0020102 0 ustar 00root root 0000000 0000000 {
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Projects */
/* Language and Environment */
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
"useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */
"resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
/* JavaScript Support */
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
"maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
/* Emit */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declarationMap": true, /* Create sourcemaps for d.ts files. */
"noEmit": true, /* Disable emitting files from a compilation. */
/* Interop Constraints */
"allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
/* Completeness */
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": [
"coverage",
],
}
ljharb-es-errors-ff7be42/type.d.ts 0000664 0000000 0000000 00000000103 14560113330 0017135 0 ustar 00root root 0000000 0000000 declare const TypeError: TypeErrorConstructor
export = TypeError;
ljharb-es-errors-ff7be42/type.js 0000664 0000000 0000000 00000000113 14560113330 0016702 0 ustar 00root root 0000000 0000000 'use strict';
/** @type {import('./type')} */
module.exports = TypeError;
ljharb-es-errors-ff7be42/uri.d.ts 0000664 0000000 0000000 00000000101 14560113330 0016751 0 ustar 00root root 0000000 0000000 declare const URIError: URIErrorConstructor;
export = URIError;
ljharb-es-errors-ff7be42/uri.js 0000664 0000000 0000000 00000000111 14560113330 0016516 0 ustar 00root root 0000000 0000000 'use strict';
/** @type {import('./uri')} */
module.exports = URIError;