Replace lodash with native JS equivalents#522
Open
Frank3K wants to merge 3 commits intofirebase:masterfrom
Open
Replace lodash with native JS equivalents#522Frank3K wants to merge 3 commits intofirebase:masterfrom
Frank3K wants to merge 3 commits intofirebase:masterfrom
Conversation
Removes lodash (and @types/lodash) as a dependency. All usages are replaced with native ES2020 equivalents: optional chaining, Array methods, Object.entries/spread, and typeof checks. A shared isPlainObject helper is extracted to src/utils/objectutils.js.
Frank3K
commented
Feb 26, 2026
| ].forEach((name) => { | ||
| exports[name] = function (spec, config) { | ||
| const mware = require("./" + _.kebabCase(name))(spec, config); | ||
| const mware = require("./" + name)(spec, config); |
Author
There was a problem hiding this comment.
All names in the array are unchanged when passed through kebabCase.
bkendall
reviewed
Feb 26, 2026
src/utils/objectutils.js
Outdated
| ); | ||
| } | ||
|
|
||
| module.exports = { isPlainObject }; |
Collaborator
There was a problem hiding this comment.
Can this be done in Typescript instead?
Collaborator
|
I've slowly tilted at this similarly before - honestly, a nice PR :) Looks like something will need adjustment for the license check, but this is great! |
Replaces the CommonJS module with a typed ES module export. Adds a `val is Record<string, unknown>` type predicate so callers get proper type narrowing when using `isPlainObject`.
Author
Thanks! I've added the license in 5a1c257. |
Author
Created #524. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes
lodash(and@types/lodash) as a dependency. All usages are replaced with native ES2020 equivalents: optional chaining, Array methods, Object.entries/spread, and typeof checks. A sharedisPlainObjecthelper is extracted tosrc/utils/objectutils.js.Why
Lodash was a sensible utility belt in the Node.js 4.x era, but the language has long since caught up. Every lodash function used in this codebase now has a direct, readable native equivalent available in Node 20+ (which is already the minimum required by our engines field).
Reasons to drop it:
What changed
All lodash calls replaced with native equivalents across all files.
A shared
isPlainObjecthelper is extracted tosrc/utils/objectutils.jsto avoid duplication betweensrc/responder.jsandsrc/loaders/config-file.js.Bundle size
Lodash itself remains in
node_modulesas a transitive dependency via glob-slasher, so the production install footprint is unchanged for now. I'm planning on creating a separate PR to replace glob-slasher, which is unmaintained for about 12 years, also to take a second look at #249.@types/lodashis fully removed.Verification
Tests are passing.