Skip to content

chore(deps): replace some Lodash functions with vanilla JS#1202

Open
kytta wants to merge 4 commits intoC2FO:mainfrom
kytta:replace-lodash
Open

chore(deps): replace some Lodash functions with vanilla JS#1202
kytta wants to merge 4 commits intoC2FO:mainfrom
kytta:replace-lodash

Conversation

@kytta
Copy link
Copy Markdown

@kytta kytta commented Mar 14, 2026

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully ran tests with your changes locally?

Heya, I have noticed that fast-csv pulls quite a lot of dependencies and got curious. I saw all of them are Lodash functions. I first wanted to propose replacing them with just Lodash (or, if you'd ask me, es-toolkit), but Jordan's reasoning in #761 made me reconsider this.

I then noticed, however, that some Lodash functions you use are way too simple and could be replaced with vanilla JS. So, I did. See also #1038

  • _.isNil => == null
    • yes, two equal signs, not three. This way it's also true for undefined, which is Lodash behaviour
    • in one place, I could replace it with nullish coalescing operator
  • _.isUndefined => == undefined
  • _.isBoolean => typeof ... === 'boolean'
  • _.isFunction => typeof ... === 'function'

This removes three dependencies from each @fast-csv/format and @fast-csv/parse. According to pkg-size, the removed packages attributed to 7.3% of the package's install size.

The replacements were taken from es-toolkit documentation, es-toolkit source code, or from common sense :) I haven't replaced other functions because they're not one-liners

@c2fo-cibot c2fo-cibot bot added the size/M Denotes a PR that changes 30-99 lines label Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant