Skip to content

Commit

Permalink
Replace methods dependency with standard library
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Koops <[email protected]>
  • Loading branch information
jonkoops committed Oct 21, 2024
1 parent 2e7fb67 commit f9b8d77
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
unreleased
=========================

* Replace `methods` dependency with standard library

2.0.0 / 2024-09-09
==================

Expand Down
5 changes: 4 additions & 1 deletion lib/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

const flatten = require('array-flatten').flatten
const Layer = require('./layer')
const methods = require('methods')
const { METHODS } = require('node:http')

/**
* Module variables.
Expand Down Expand Up @@ -215,6 +215,9 @@ Route.prototype.all = function all (handler) {
return this
}


const methods = METHODS.map((method) => method.toLowerCase())

methods.forEach(function (method) {
Route.prototype[method] = function (handler) {
const callbacks = flatten(slice.call(arguments))
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"dependencies": {
"array-flatten": "3.0.0",
"is-promise": "4.0.0",
"methods": "~1.1.2",
"parseurl": "~1.3.3",
"path-to-regexp": "^8.0.0",
"setprototypeof": "1.2.0",
Expand Down

0 comments on commit f9b8d77

Please sign in to comment.