es-toolkit

A modern JavaScript utility library that's 2-3x faster and up to 97% smaller than Lodash.

Library
npm
v1.52.0
11,378 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 100
Maintenance 100
Community 68
Maturity 48
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
91 /100 Excellent
Architecture 84
Code Quality 93
Innovation 88
Learning Curve 100

es-toolkit is a state-of-the-art JavaScript utility library built as a modern, high-performance alternative to Lodash. It ships hundreds of tree-shakable functions across arrays, objects, strings, promises, math, and more, each written in modern TypeScript with strict types and extensive JSDoc examples.

Beyond the core API, es-toolkit/compat provides a drop-in compatibility layer that mirrors Lodash’s exact behavior for teams migrating incrementally, while the core package stays lean, side-effect free, and optimized for bundlers. The project maintains extensive test coverage, cross-browser compatibility testing, and continuous benchmarking against Lodash to track its performance advantage.

What You Get

  • Hundreds of tree-shakable utility functions across array, object, string, function, promise, math, and predicate modules
  • A drop-in es-toolkit/compat layer that mirrors Lodash’s exact API and edge-case behavior
  • First-class TypeScript types and type-guard predicates (e.g. isNotNil) with no separate @types package needed
  • Verified performance improvements and a dramatically smaller bundle size versus Lodash, tracked by continuous benchmarks
  • Curried, data-last functional variants via the es-toolkit/fp entry point for composition-style pipelines

Common Use Cases

  • Replacing Lodash in a project to cut bundle size without rewriting call sites (via es-toolkit/compat)
  • Debouncing/throttling UI event handlers with debounce, throttle, and related function utilities
  • Array and object transformation pipelines (chunking, grouping, deep cloning, deep comparison) in data-processing code
  • Building typed utility layers in TypeScript applications that need strict null-safety and predicate helpers

Under The Hood

Architecture

The project is organized as a flat, modular collection of single-purpose functions grouped by domain (src/array, src/object, src/string, src/function, src/predicate, src/math, src/promise, src/map, src/set, src/iterator, src/bigint, src/error, src/util, src/types), each exported from a domain index.ts and re-exported from the root src/index.ts; the library has zero runtime dependencies, so the core discipline is a strict one-function-per-file convention (each implementation file sits beside its own spec file) that keeps tree-shaking trivial. A parallel src/compat tree, with its own internal helpers for exact Lodash string-manipulation and object-merging parity, re-implements the same domains with Lodash’s precise, sometimes idiosyncratic edge-case semantics, wired together via an Object.assign onto a callable placeholder to reproduce Lodash’s mixin-style default export. A third tree, src/fp, builds curried/data-last variants on top of the core functions and adds its own lazy-evaluation engine implementing a generator-free “push” pipeline so chains of map/filter/take/flatMap fuse into a single loop instead of allocating per-stage iterators. This three-tier split (core / compat / fp) is the central architectural decision, and changing a core function’s signature ripples into both the compat shims and the fp wrappers.

Tech Stack

es-toolkit is written entirely in TypeScript with zero runtime dependencies. It is built into dual ESM/CJS outputs plus a global browser bundle used by CDN distribution, and typed via hand-authored declaration files reachable through many fine-grained package.json subpath exports for the array, compat, fp, and platform-specific util entry points. The workspace is a Yarn Berry monorepo with docs, benchmarks, and dedicated type-testing and browser-compatibility-testing workspaces as siblings. Documentation is a dedicated static-site generator instance with per-function reference pages. Testing runs on a modern test runner with a coverage provider; type-level testing runs through a separate workspace layered on top of a package-export soundness checker, and a browser-compat harness exercises real browser engines via its own CI workflow.

Code Quality

Every exported function has a co-located spec file exercised under the project’s test runner with coverage instrumentation enabled and configured for extensive coverage, and property-based testing is present as a development dependency. Error handling is explicit and typed — functions throw plain, descriptively-messaged errors for invalid input rather than silently coercing it, and a dedicated error module centralizes custom error types. Naming stays consistently camelCase, matching Lodash conventions where the compat layer requires exact parity. Type safety is strict, backed by a dedicated typecheck script and a large lint configuration that layers compatibility-target linting, ECMAScript-version restriction rules, and a custom rule discouraging certain array-iteration patterns for performance reasons. Continuous integration runs linting, type-checking, tests, static security analysis, and an open-source security posture check as separate gates.

API Design The public API mirrors familiar Lodash-style free functions, so migrating existing code requires minimal relearning, and every function ships a documentation block with parameter, return, and throw annotations plus runnable examples that also power the reference site — so developer-facing documentation lives directly next to the implementation rather than drifting out of sync. Getting started requires zero configuration, with no polyfills needed, and the compat entry point removes even the burden of renaming call sites when migrating from Lodash. The fp entry point offers curried, data-last equivalents for teams that prefer functional composition without needing a separate library.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers