Skip to content

Commit 5d12e07

Browse files
committed
Decrease package size
1 parent b0112b3 commit 5d12e07

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151
},
5252
"dependencies": {
5353
"is-plain-obj": "^4.1.0",
54-
"safe-json-value": "^1.8.0",
55-
"statuses": "^2.0.1"
54+
"safe-json-value": "^1.8.0"
5655
},
5756
"devDependencies": {
5857
"@ehmicky/dev-tasks": "^1.0.99",

src/options.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import isPlainObj from 'is-plain-obj'
2-
import statuses from 'statuses'
32

43
// Normalize and validate options
54
export const getOptions = function (options = {}) {
@@ -34,12 +33,21 @@ const validateStatus = function (optValue, optName) {
3433
throw new TypeError(`"${optName}" must be an integer: ${optValue}`)
3534
}
3635

37-
if (!STATUSES.has(optValue)) {
36+
if (!HTTP_STATUSES.has(optValue)) {
3837
throw new TypeError(`"${optName}" must be an HTTP status code: ${optValue}`)
3938
}
4039
}
4140

42-
const STATUSES = new Set(statuses.codes)
41+
// TODO: replace with `statuses` package once they become a pure ES module
42+
/* eslint-disable no-magic-numbers */
43+
const HTTP_STATUSES = new Set([
44+
100, 101, 102, 103, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300,
45+
301, 302, 303, 304, 305, 307, 308, 400, 401, 402, 403, 404, 405, 406, 407,
46+
408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 421, 422, 423, 424,
47+
425, 426, 428, 429, 431, 451, 500, 501, 502, 503, 504, 505, 506, 507, 508,
48+
509, 510, 511,
49+
])
50+
/* eslint-enable no-magic-numbers */
4351

4452
const validateURI = function (optValue, optName) {
4553
validateString(optValue, optName)

0 commit comments

Comments
 (0)