Skip to content

fix: remove lodash dependency and replace with native utilities#339

Merged
MarshallOfSound merged 2 commits intomainfrom
claude/remove-lodash-dependency-hJoj7
Apr 8, 2026
Merged

fix: remove lodash dependency and replace with native utilities#339
MarshallOfSound merged 2 commits intomainfrom
claude/remove-lodash-dependency-hJoj7

Conversation

@MarshallOfSound
Copy link
Copy Markdown
Member

This PR removes the lodash dependency from the codebase and replaces all lodash utility functions with native JavaScript equivalents or custom implementations.

Summary

Lodash has been completely removed as a dependency. All lodash function calls have been replaced with:

  • Native JavaScript methods (e.g., _.repeat()String.prototype.repeat(), _.trimEnd()String.prototype.trimEnd())
  • Custom utility functions defined in utils.ts (e.g., upperFirst, lowerFirst, camelCase)
  • Native Node.js utilities (e.g., isDeepStrictEqual from node:util)
  • Modern JavaScript features (e.g., spread operators, structuredClone(), Object.entries())

Key Changes

  • Removed lodash imports from all source files
  • Added custom string utilities to utils.ts:
    • upperFirst(): Capitalizes first character
    • lowerFirst(): Lowercases first character
    • camelCase(): Converts strings to camelCase format
  • Replaced lodash functions:
    • _.upperFirst()upperFirst()
    • _.lowerFirst()lowerFirst()
    • _.camelCase()camelCase()
    • _.repeat()String.prototype.repeat()
    • _.trimEnd()String.prototype.trimEnd()
    • _.concat() → spread operator [...]
    • _.cloneDeep()structuredClone()
    • _.isEqual()isDeepStrictEqual() from node:util
    • _.forIn()Object.entries() with for-of loop
    • _.map()Array.prototype.map()
    • _.assign()Object.assign()
  • Updated dependencies in package.json:
    • Removed lodash and @types/lodash

Implementation Details

  • The custom camelCase() implementation handles word boundaries and maintains compatibility with the original lodash behavior
  • isDeepStrictEqual() from Node.js util module provides deep equality checking previously done by _.isEqual()
  • Array operations now use native spread operators and array methods instead of lodash utilities
  • All functionality is preserved while reducing external dependencies

https://preview.claude.ai/code/session_0169kyjeRxGb9JNHUwqTHgTf

Replace lodash usage with native equivalents (structuredClone,
isDeepStrictEqual, String#trimEnd/repeat, Object.assign/entries,
array spread/flatMap) and small local helpers for upperFirst,
lowerFirst, and camelCase.
@MarshallOfSound MarshallOfSound requested review from a team as code owners April 8, 2026 22:48
@MarshallOfSound MarshallOfSound changed the title Remove lodash dependency and replace with native utilities fix: remove lodash dependency and replace with native utilities Apr 8, 2026
Copy link
Copy Markdown
Member

@dsanders11 dsanders11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests for the helpers added to src/utils.ts?

@MarshallOfSound MarshallOfSound merged commit 906aff6 into main Apr 8, 2026
10 checks passed
@MarshallOfSound MarshallOfSound deleted the claude/remove-lodash-dependency-hJoj7 branch April 8, 2026 23:10
@electron-npm-package-publisher
Copy link
Copy Markdown

🎉 This PR is included in version 9.1.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants