Skip to content

Commit

Permalink
refactor: replace methods dependency with standard library (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops authored Oct 23, 2024
1 parent 36ae18f commit 878b0e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ unreleased

* Remove `Object.setPrototypeOf` polyfill
* Use `Array.flat` instead of `array-flatten` package
* 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 @@ -13,7 +13,7 @@
*/

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.call(slice.call(arguments), Infinity)
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"repository": "pillarjs/router",
"dependencies": {
"is-promise": "4.0.0",
"methods": "~1.1.2",
"parseurl": "~1.3.3",
"path-to-regexp": "^8.0.0",
"utils-merge": "1.0.1"
Expand Down

0 comments on commit 878b0e0

Please sign in to comment.