Skip to content

Commit 337c45b

Browse files
fix: remove setImmediate support check (#144)
setImmediate is available since Node.js v0.9.1 Co-authored-by: Wes Todd <[email protected]>
1 parent 08b6a32 commit 337c45b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

HISTORY.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
unreleased
22
==================
33

4+
* Remove `setImmediate` support check
45
* Restore `debug` dependency
56

67
2.1.0 / 2025-02-10

lib/route.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ const slice = Array.prototype.slice
2525
const flatten = Array.prototype.flat
2626
const methods = METHODS.map((method) => method.toLowerCase())
2727

28-
/* istanbul ignore next */
29-
const defer = typeof setImmediate === 'function'
30-
? setImmediate
31-
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
32-
3328
/**
3429
* Expose `Route`.
3530
*/
@@ -139,7 +134,7 @@ Route.prototype.dispatch = function dispatch (req, res, done) {
139134

140135
// max sync stack
141136
if (++sync > 100) {
142-
return defer(next, err)
137+
return setImmediate(next, err)
143138
}
144139

145140
let layer

0 commit comments

Comments
 (0)