Skip to content

Commit

Permalink
cleanup: remove setImmediate support check
Browse files Browse the repository at this point in the history
setImmediate is available since Node.js v0.9.1
  • Loading branch information
Phillip9587 committed Nov 5, 2024
1 parent 0d2cefc commit 130559f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
==================

* Remove `setImmediate` support check
* Remove `Object.setPrototypeOf` polyfill
* Use `Array.flat` instead of `array-flatten` package
* Replace `methods` dependency with standard library
Expand Down
7 changes: 1 addition & 6 deletions lib/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ const slice = Array.prototype.slice
const flatten = Array.prototype.flat
const methods = METHODS.map((method) => method.toLowerCase())

/* istanbul ignore next */
const defer = typeof setImmediate === 'function'
? setImmediate
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }

/**
* Expose `Route`.
*/
Expand Down Expand Up @@ -137,7 +132,7 @@ Route.prototype.dispatch = function dispatch (req, res, done) {

// max sync stack
if (++sync > 100) {
return defer(next, err)
return setImmediate(next, err)
}

let layer
Expand Down

0 comments on commit 130559f

Please sign in to comment.