diff --git a/HISTORY.md b/HISTORY.md index 5f69004..c70518f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 diff --git a/lib/route.js b/lib/route.js index ec98414..0b25910 100644 --- a/lib/route.js +++ b/lib/route.js @@ -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`. */ @@ -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