You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to see this happen. I took a look at the current dependency tree and here's what I found regarding what could be simplified by dropping older Node.js versions:
Dependencies that could be removed/inlined:
setprototypeof — On any Node.js version with native Object.setPrototypeOf (v4+), this package already just re-exports the native function. With a higher minimum Node.js target, this can be replaced with Object.setPrototypeOf directly.
inherits — Resolves to util.inherits on Node.js, which itself just does Object.setPrototypeOf(ctor.prototype, superCtor.prototype). Could be replaced with ES6 class extends syntax or a direct Object.setPrototypeOf call. This would also align with the ES6 class extension discussion in Allow HttpError extension by ES6 classes #98.
toidentifier — A ~6 line function that converts a string to PascalCase. Small enough to inline directly.
Dependencies that would likely stay:
depd — Provides runtime deprecation warnings with caller site info. Not trivially replaceable without losing functionality, though process.emitWarning() (Node.js 6+) could be an alternative worth exploring.
statuses — Core functionality (HTTP status code → message mapping). Would stay as a dependency.
So targeting something like Node.js >= 18 (current oldest LTS) would allow dropping 3 of 5 dependencies, and potentially using modern syntax throughout (class, const/let, etc.).
Happy to help with a PR if there's agreement on the minimum Node.js version to target.
One more thought — if we're targeting modern Node.js for v3, using ES6 classes would also naturally solve #98 (ES6 class extension support). The entire codebase could become significantly simpler:
This would drop inherits and setprototypeof naturally, fix the instanceof issues with subclassing (#98), and make the whole codebase more readable. toidentifier could just be inlined as a 6-line helper.
That would take the dependency count from 5 down to 2 (depd + statuses).
Activity
mahmoodhamdi commentedon Mar 29, 2026
I'd love to see this happen. I took a look at the current dependency tree and here's what I found regarding what could be simplified by dropping older Node.js versions:
Dependencies that could be removed/inlined:
setprototypeof— On any Node.js version with nativeObject.setPrototypeOf(v4+), this package already just re-exports the native function. With a higher minimum Node.js target, this can be replaced withObject.setPrototypeOfdirectly.inherits— Resolves toutil.inheritson Node.js, which itself just doesObject.setPrototypeOf(ctor.prototype, superCtor.prototype). Could be replaced with ES6class extendssyntax or a directObject.setPrototypeOfcall. This would also align with the ES6 class extension discussion in Allow HttpError extension by ES6 classes #98.toidentifier— A ~6 line function that converts a string to PascalCase. Small enough to inline directly.Dependencies that would likely stay:
depd— Provides runtime deprecation warnings with caller site info. Not trivially replaceable without losing functionality, thoughprocess.emitWarning()(Node.js 6+) could be an alternative worth exploring.statuses— Core functionality (HTTP status code → message mapping). Would stay as a dependency.So targeting something like Node.js >= 18 (current oldest LTS) would allow dropping 3 of 5 dependencies, and potentially using modern syntax throughout (
class,const/let, etc.).Happy to help with a PR if there's agreement on the minimum Node.js version to target.
mahmoodhamdi commentedon Mar 29, 2026
One more thought — if we're targeting modern Node.js for v3, using ES6 classes would also naturally solve #98 (ES6 class extension support). The entire codebase could become significantly simpler:
This would drop
inheritsandsetprototypeofnaturally, fix theinstanceofissues with subclassing (#98), and make the whole codebase more readable.toidentifiercould just be inlined as a 6-line helper.That would take the dependency count from 5 down to 2 (
depd+statuses).