Started adding slash commands, doesn't work though

This commit is contained in:
ION606
2022-09-26 15:41:20 +00:00
parent b6495eb886
commit ec4c1200d5
2214 changed files with 159174 additions and 42761 deletions
+15
View File
@@ -1,3 +1,18 @@
2.0.0 / 2021-12-17
==================
* Drop support for Node.js 0.6
* Remove `I'mateapot` export; use `ImATeapot` instead
* Remove support for status being non-first argument
* Rename `UnorderedCollection` constructor to `TooEarly`
* deps: depd@2.0.0
- Replace internal `eval` usage with `Function` constructor
- Use instance methods on `process` to check for listeners
* deps: statuses@2.0.1
- Fix messaging casing of `418 I'm a Teapot`
- Remove code 306
- Rename `425 Unordered Collection` to standard `425 Too Early`
2021-11-14 / 1.8.1
==================
+2 -2
View File
@@ -14,7 +14,7 @@ This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```bash
```console
$ npm install http-errors
```
@@ -133,7 +133,7 @@ var err = new createError.NotFound()
|422 |UnprocessableEntity |
|423 |Locked |
|424 |FailedDependency |
|425 |UnorderedCollection |
|425 |TooEarly |
|426 |UpgradeRequired |
|428 |PreconditionRequired |
|429 |TooManyRequests |
+15 -25
View File
@@ -54,24 +54,18 @@ function createError () {
var props = {}
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i]
if (arg instanceof Error) {
var type = typeof arg
if (type === 'object' && arg instanceof Error) {
err = arg
status = err.status || err.statusCode || status
continue
}
switch (typeof arg) {
case 'string':
msg = arg
break
case 'number':
status = arg
if (i !== 0) {
deprecate('non-first-argument status code; replace with createError(' + arg + ', ...)')
}
break
case 'object':
props = arg
break
} else if (type === 'number' && i === 0) {
status = arg
} else if (type === 'string') {
msg = arg
} else if (type === 'object') {
props = arg
} else {
throw new TypeError('argument #' + (i + 1) + ' unsupported type ' + type)
}
}
@@ -80,7 +74,7 @@ function createError () {
}
if (typeof status !== 'number' ||
(!statuses[status] && (status < 400 || status >= 600))) {
(!statuses.message[status] && (status < 400 || status >= 600))) {
status = 500
}
@@ -91,7 +85,7 @@ function createError () {
// create error
err = HttpError
? new HttpError(msg)
: new Error(msg || statuses[status])
: new Error(msg || statuses.message[status])
Error.captureStackTrace(err, createError)
}
@@ -135,7 +129,7 @@ function createClientErrorConstructor (HttpError, name, code) {
function ClientError (message) {
// create the error object
var msg = message != null ? message : statuses[code]
var msg = message != null ? message : statuses.message[code]
var err = new Error(msg)
// capture a stack trace to the construction point
@@ -204,7 +198,7 @@ function createServerErrorConstructor (HttpError, name, code) {
function ServerError (message) {
// create the error object
var msg = message != null ? message : statuses[code]
var msg = message != null ? message : statuses.message[code]
var err = new Error(msg)
// capture a stack trace to the construction point
@@ -264,7 +258,7 @@ function nameFunc (func, name) {
function populateConstructorExports (exports, codes, HttpError) {
codes.forEach(function forEachCode (code) {
var CodeError
var name = toIdentifier(statuses[code])
var name = toIdentifier(statuses.message[code])
switch (codeClass(code)) {
case 400:
@@ -281,10 +275,6 @@ function populateConstructorExports (exports, codes, HttpError) {
exports[name] = CodeError
}
})
// backwards-compatibility
exports["I'mateapot"] = deprecate.function(exports.ImATeapot,
'"I\'mateapot"; use "ImATeapot" instead')
}
/**
+7 -6
View File
@@ -1,7 +1,7 @@
{
"name": "http-errors",
"description": "Create HTTP error objects",
"version": "1.8.1",
"version": "2.0.0",
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
"contributors": [
"Alan Plum <me@pluma.io>",
@@ -10,10 +10,10 @@
"license": "MIT",
"repository": "jshttp/http-errors",
"dependencies": {
"depd": "~1.1.2",
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": ">= 1.5.0 < 2",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
},
"devDependencies": {
@@ -22,19 +22,20 @@
"eslint-plugin-import": "2.25.3",
"eslint-plugin-markdown": "2.2.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "5.1.1",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-standard": "4.1.0",
"mocha": "9.1.3",
"nyc": "15.1.0"
},
"engines": {
"node": ">= 0.6"
"node": ">= 0.8"
},
"scripts": {
"lint": "eslint . && node ./scripts/lint-readme-list.js",
"test": "mocha --reporter spec --bail",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
"test-cov": "nyc --reporter=html --reporter=text npm test",
"version": "node scripts/version-history.js && git add HISTORY.md"
},
"keywords": [
"http",