Is it advisable to use libraries like lodash or manually implement required functionality when developing an npm package?

I’ve noticed that some open-source packages are marketed as having ‘no dependencies’, which seems appealing because it alleviates concerns about transitive dependencies. However, I often question the methods behind achieving this ‘zero dependencies’ status. There are numerous utility functions that I’d typically resort to libraries for, which I could recreate, but it often seems impractical. For instance, handling camel casing involves various nuanced scenarios that warrant reliance on a robust library. Conversely, if I choose to depend on reliable packages with minimal code, could I simply integrate their code directly into my project? This would give me the quality code while maintaining a ‘zero dependencies’ claim, yet it feels somewhat unethical. Each choice (relying on existing packages, redoing the functionality, or copying code) presents significant trade-offs. I’m curious to hear your thoughts, whether you’re a creator or consumer in the open-source community: How significant is ‘zero dependencies’ for you? Is it advisable to copy code to attain it?

In my experience, maintaining a balance between using libraries like lodash and implementing functionality manually depends heavily on the scope and goals of your npm package. If you aim for lightweight and dependency-free code, re-implementing essential functionality can make sense, especially for smaller projects. Though, for more intricate tasks like camel casing, leveraging well-tested libraries is often practical as it saves time and ensures reliability. Copying code from libraries can sometimes be done ethically if licensing allows, but it often complicates maintenance and the code’s integrity. Ultimately, the decision should weigh factors such as code complexity, maintenance burden, and performance impact.

it depends a lot on what ur npm package needs to do. using lodash or sumthing similar is usually fine if it simplifies dev and maintainence. Makes a diff whether u want a super light package or more focused on functionality. just weigh convenience vs. custom work!