Guide · Open source
How to use You-Dont-Need-Lodash-Underscore: native JS alternatives
Updated · written with AI from the project's own documentation and checked against our catalogue data
You-Dont-Need-Lodash-Underscore is an MIT-licensed reference list that shows how common Lodash and Underscore helper functions can be written with plain JavaScript built into the language, such as Array and Object methods. It also includes an ESLint plugin that flags code where a native alternative may work. This guide explains how to read the list, when a native version is a safe swap, and how to install the plugin.
Quick start
- 1Decide your browser targets. Confirm that your project only needs modern browsers or engines that already support the ES5 and ES2015 methods you plan to use.
- 2Find the function in the list. Use the Quick Links section to locate the Lodash or Underscore helper you currently call.
- 3Compare the native version. Read the Underscore/Lodash example and the Native example, and check that the output matches your use case.
- 4Check null safety and options. Review whether your code relies on null-safe behaviour or extra Lodash options, and add guards where needed.
- 5Install the ESLint plugin. Run npm install --save-dev eslint-plugin-you-dont-need-lodash-underscore in a project that already uses ESLint.
- 6Update your ESLint config. Add plugin:you-dont-need-lodash-underscore/compatible to the extends setting, as shown in the README.
Check whether you need the library at all
The project is aimed at front-end developers who target modern browsers and want fewer dependencies. The README notes that many methods are already supported natively thanks to ECMAScript5 and ECMAScript2015, so you may not need Lodash or Underscore if you know your target browsers clearly.
- Good fit: teams trying to reduce bundle size by dropping small utility libraries.
- Good fit: developers learning which ES5 and ES2015 methods already exist natively.
- Poor fit: projects that must support old engines without es5-shim or polyfills, since many native methods are missing there.
Read a comparison entry
The list is organised by type: Array, Collection, Function, Lang, Object, String, Util and Number. Each entry shows the Underscore/Lodash call first, followed by a Native version with the same expected output, so you can compare them side by side. Many entries also include a browser support table for the native feature.
- Look up the function name in the Quick Links section, such as _.chunk or _.compact.
- Compare the library output with the native output shown in the example.
- Check the browser support table before relying on a native method.
// Underscore/Lodash
_.compact([0, 1, false, 2, '', 3]);
// output: [1, 2, 3]
// Native
[0, 1, false, 2, '', 3].filter(Boolean)
// output: [1, 2, 3]Understand the limits before swapping a call
The README says this list is not a 1:1 comparison. For some functions Lodash provides more options than native built-ins, so a native version may cover only the basic case. Lodash methods are often null safe, but their native equivalents are not necessarily null safe.
Most native equivalents are array methods and will not work with objects. The README suggests that if you need object handling and no object method is provided, Lodash or Underscore may be the better option. Iterable objects can be converted to an array with the spread operator first.
- Null safety: the README suggests using a guard such as Object.keys(value || {}) when null safety matters.
- Options: check the Lodash documentation for extra arguments before replacing a call.
- Objects: most native collection helpers only work on arrays.
Object.keys(value || {})Install the ESLint plugin
The ESLint plugin flags places in your codebase where you may not need Lodash or Underscore. You need Node.js and npm, plus ESLint, installed in your project. Install the plugin as a dev dependency with the command from the README.
- Prerequisites: Node.js and npm, and ESLint.
- Then update your ESLint config to extend the plugin's compatible configuration, as shown in the README.
- For more options, the README points to a separate configuring page.
npm install --save-dev eslint-plugin-you-dont-need-lodash-underscoreSupport older browsers when needed
If you must target a legacy JavaScript engine that lacks the ES5 methods, the README recommends es5-shim. Without it, or another polyfill, many of the native alternatives will fail in those environments.
- Use es5-shim for legacy engines that need ES5 methods.
- Test the target browsers you actually support before removing a library.
Contribute new entries
The README invites pull requests to add or modify entries. It asks contributors to send a PR directly and only open an issue for something large that needs discussion.
- Send a PR to add or change code examples.
- Open an issue only for large changes that need discussion.
What people use it for
- Finding native replacements for _.chunk, _.compact or _.uniqWith in a front-end codebase.
- Flagging unnecessary Lodash calls in a team project with the ESLint plugin.
- Learning which ES5 and ES2015 array and object methods exist natively.
- Planning a reduction of utility library dependencies to shrink a bundle.
Frequently asked questions
What is You-Dont-Need-Lodash-Underscore?
It is a reference list of JavaScript methods that can replace common Lodash and Underscore helpers using built-in language features. It also includes an ESLint plugin that flags code where a native alternative may work.
How do I install the ESLint plugin?
Run npm install --save-dev eslint-plugin-you-dont-need-lodash-underscore. You need Node.js, npm and ESLint in your project.
Is You-Dont-Need-Lodash-Underscore free to use?
The project is released under the MIT licence, as stated in its listing. Check the repository's licence file for the full terms.
Does it work in old browsers?
Not on its own. The README says that projects needing old engines should use es5-shim or polyfills, because many native methods are missing there.
Can I use native methods as a full replacement for Lodash?
Not always. The README says the list is not a 1:1 comparison, and native equivalents are not always null safe or as flexible as Lodash.
How does it compare to Ramda or es5-shim?
The listing names Ramda and es5-shim as comparable projects. es5-shim adds ES5 methods to legacy engines, while this project shows which native methods you can use instead of a utility library.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this project if you target modern browsers, want fewer utility dependencies, or want an ESLint rule that points out unnecessary Lodash or Underscore calls. Pick Lodash, Underscore or Ramda instead if you need null-safe behaviour, extra options, object-heavy helpers, or support for old engines without polyfills.
Install options & downloads