Skip to content

Guide · Open source

How to use es-toolkit: install, import and common helpers

Updated · written with AI from the project's own documentation and checked against our catalogue data

es-toolkit is a JavaScript and TypeScript utility library of everyday helper functions such as debounce, chunk, pick and sum. It is a code dependency you add to a project, not a standalone app. This guide shows you how to install it, import functions, and know when a compatibility layer for lodash makes sense.

es-toolkittoss/es-toolkit · ★ 11.4k · MIT

Quick start

  1. 1Check prerequisites. Make sure you have Node.js or a JavaScript project that uses a package manager.
  2. 2Install the package. Run npm install es-toolkit in your project folder.
  3. 3Import the functions you need. Import named helpers such as chunk or debounce from 'es-toolkit' so only those functions are included.
  4. 4Call a helper. Use the function as documented on the reference pages, for example chunk(array, 2) to split an array into pairs.
  5. 5Check types. Rely on the built-in TypeScript types and type guards such as isNotNil.
  6. 6Plan a lodash migration. If you use lodash, review the es-toolkit/compat layer and test your existing behaviour before switching.

What es-toolkit is and who it is for

es-toolkit is a modern utility library with a small bundle size and strong type annotations. Its README lists helpers such as debounce, delay, chunk, sum and pick, and describes them as having modern implementations.

It suits JavaScript or TypeScript developers who want common helper functions, teams moving an existing lodash codebase toward a smaller and faster library, and front-end projects where bundle size matters.

  • Good fit: developers working in JavaScript or TypeScript projects
  • Good fit: teams migrating away from lodash
  • Not a fit: non-developers, since it is code you import rather than an app you open
  • Not a fit: projects that need helpers outside JavaScript and TypeScript

Install es-toolkit in your project

You need Node.js or a JavaScript project that uses a package manager. The README installs the package from npm with the command below.

npm install es-toolkit

Import and use a helper function

Import only the functions you need. The README notes that es-toolkit supports tree shaking out of the box, which keeps the code added to your app small. The example below debounces a log call and splits an array into chunks of two.

debounce delays the call, so the logged message only runs after the wait. chunk splits the array into groups of the given size.

import { chunk, debounce } from 'es-toolkit'; const debouncedLog = debounce(message => { console.log(message); }, 300); debouncedLog('Hello, world!'); const array = [1, 2, 3, 4, 5, 6]; const chunkedArray = chunk(array, 2); console.log(chunkedArray); // Output: [[1, 2], [3, 4], [5, 6]]

Use TypeScript types and type guards

es-toolkit includes built-in TypeScript support with straightforward types. It also provides type guards, such as isNotNil, which narrow a value's type after a check. Check the reference pages on es-toolkit.dev for the exact signature of each function.

  • Types ship with the library, so no separate type package is named in the README
  • Use type guards such as isNotNil to narrow values in conditional code

Move from lodash with the compatibility layer

If your project already uses lodash, es-toolkit provides a compatibility layer, available as es-toolkit/compat, intended to replace Lodash. This lets teams move toward a smaller, faster library.

The README does not document edge-case differences from specific lodash versions. Test the parts of your code that rely on lodash behaviour before you switch.

  • Read the compatibility page on es-toolkit.dev before replacing lodash imports
  • Run your existing test suite after switching

Optional: AI coding tool integration

es-toolkit provides Agent Skills for AI coding tools such as Claude Code, Cursor and Copilot. The README gives an npx command to add them. For Claude Code, it also lists plugin marketplace commands. The AI Integration guide on es-toolkit.dev has more detail.

npx skills add toss/es-toolkit

What people use it for

  • Splitting a list into fixed-size batches with chunk before sending requests
  • Debouncing a function call, such as a handler that runs on user input, with debounce
  • Picking specific keys from an object with pick
  • Summing numeric arrays with sum
  • Moving a lodash-based front-end toward a smaller bundle using es-toolkit/compat

Frequently asked questions

How do I install es-toolkit?

Install it from npm with npm install es-toolkit in a project that has Node.js and a package manager. The README lists this as the install method. Then import the functions you need from 'es-toolkit'.

Is es-toolkit free to use?

es-toolkit is released under the MIT licence. The README states MIT © Viva Republica, Inc. Check the LICENSE file in the repository for the full terms.

Does es-toolkit work with TypeScript?

Yes. The README says es-toolkit includes built-in TypeScript support with straightforward yet robust types, and it provides type guards such as isNotNil.

Can I replace lodash with es-toolkit?

es-toolkit offers a compatibility layer, available as es-toolkit/compat, to replace Lodash. The README does not document every edge-case difference, so test the behaviour your code depends on before switching.

How does es-toolkit compare to lodash, Underscore.js or remeda?

The README claims 2-3 times better performance and up to 97% less JavaScript code than other libraries. It does not provide a direct comparison table with Underscore.js or remeda, so check the performance and bundle size pages on es-toolkit.dev and benchmark your own project.

Why is my import not working?

The README examples import from 'es-toolkit' and the package is installed with npm install es-toolkit. Confirm the package is installed in the same project you are running. The README does not list specific troubleshooting steps, so consult the homepage at es-toolkit.dev for more help.

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

es-toolkit suits JavaScript and TypeScript developers who want small, typed helper functions and a path away from lodash. It is not a good choice for non-developers or for projects that need helpers outside JavaScript, and teams relying on exact lodash edge-case behaviour should test carefully before switching.

Install options & downloads