Skip to main content
← Guides

Guide

es-toolkit vs remeda vs lodash 2026

Updated PkgPulse Team7 min read
0

Compare es-toolkit, remeda, and lodash for modern JavaScript and TypeScript utility functions. Bundle size, tree-shaking, TypeScript types, performance.

Contents

TL;DR

Try es-toolkit if you want named utilities and a compatibility layer for an existing Lodash migration. Pick Remeda for typed data pipelines that use pipe and data-last calls. Keep Lodash when matching existing behavior matters more than changing dependencies.

Key Takeaways

  • Start a Lodash migration with the es-toolkit/compat support table. Test the calls you use, including nulls and missing paths.
  • Use Remeda when you need to narrow types through several pipeline steps. Consecutive lazy functions in a pipe can stop after enough results are found.
  • When keeping Lodash in a browser project, try per-method imports or the separate lodash-es package. Check the result in your production build.
  • Native helpers such as structuredClone and Object.groupBy cover some use cases. Check their behavior against the call you plan to replace.

Do You Even Need a Utility Library in 2026?

// Many lodash functions are now NATIVE JavaScript:

// _.cloneDeep → structuredClone
const copy = structuredClone(original)

// _.groupBy → Object.groupBy (ES2024)
const grouped = Object.groupBy(users, user => user.role)

// _.get → optional chaining
const name = user?.profile?.name ?? "Anonymous"

// _.flatten → Array.prototype.flat
const flat = [[1, 2], [3, 4]].flat()

// _.uniq → Set
const unique = [...new Set(array)]

// _.isNil → nullish coalescing
const value = input ?? defaultValue

// BUT these still need a library:
// debounce, throttle, chunk, merge (deep), pick/omit (typed),
// difference, intersection, sortBy (stable multi-key)

es-toolkit

es-toolkit — high-performance utility library:

Installation

npm install es-toolkit

Core utilities

import { debounce, throttle, chunk, groupBy, uniqBy, difference } from "es-toolkit"

// Debounce calls to a search handler:
const handleSearch = debounce((query: string) => {
  fetchResults(query)
}, 300)

// throttle:
const handleScroll = throttle(() => {
  updateScrollPosition()
}, 100)

// chunk:
const pages = chunk([1, 2, 3, 4, 5, 6, 7], 3)
// → [[1, 2, 3], [4, 5, 6], [7]]

// groupBy:
const byRole = groupBy(users, (user) => user.role)
// → { admin: [...], user: [...] }

// uniqBy:
const unique = uniqBy(packages, (pkg) => pkg.name)

// difference:
const removed = difference(oldDeps, newDeps)

Object utilities

import { pick, omit, merge, cloneDeep, isEqual } from "es-toolkit"

interface Package {
  name: string
  version: string
  downloads: number
  deprecated: boolean
  internal: boolean
}

const pkg: Package = {
  name: "react",
  version: "19.0.0",
  downloads: 5_000_000,
  deprecated: false,
  internal: false,
}

// pick — fully typed, returns Pick<Package, "name" | "version">:
const summary = pick(pkg, ["name", "version"])

// omit — returns Omit<Package, "internal" | "deprecated">:
const publicData = omit(pkg, ["internal", "deprecated"])

// merge (deep):
const config = merge(defaults, userConfig, envConfig)

// isEqual (deep comparison):
if (isEqual(prevState, nextState)) {
  // skip re-render
}

Migrating a Lodash call

For supported functions, try replacing the import with a named import from es-toolkit/compat. This example preserves Lodash's fallback behavior for a missing path.

import { get } from "es-toolkit/compat"

get({}, "settings.theme", "default") // "default"
get({ settings: { theme: null } }, "settings.theme", "default") // null

remeda

remeda — TypeScript-first data utility library:

Data-first and data-last

import * as R from "remeda"

// Data-first (like lodash — pass data as first arg):
const sorted = R.sortBy(users, [(u) => u.name, "asc"])
const chunked = R.chunk([1, 2, 3, 4, 5], 2)
const unique = R.uniqueBy(packages, (p) => p.name)

// Data-last (for piping — pass data through a pipeline):
const result = R.pipe(
  packages,
  R.filter((pkg) => pkg.downloads > 100_000),
  R.sortBy([(pkg) => pkg.healthScore, "desc"]),
  R.take(10),
  R.map((pkg) => `${pkg.name}: ${pkg.healthScore}`),
)

Where lazy evaluation stops

Remeda's pipe reference lists which data-last functions can run lazily together. A filter followed by take can stop once it has enough matches. Putting sortBy in between requires sorting all filtered results before choosing the top items.

import { pipe, filter, take } from "remeda"

let visited = 0
const firstMatches = pipe(
  [1, 2, 3, 4, 5, 6],
  filter((n) => {
    visited++
    return n % 2 === 0
  }),
  take(2),
)
// firstMatches is [2, 4] and visited is 4

TypeScript narrowing

import * as R from "remeda"

interface Package {
  name: string
  downloads: number | null
  deprecated?: boolean
}

const packages: Package[] = fetchPackages()

// remeda's filter narrows types:
const active = R.pipe(
  packages,
  R.filter((pkg): pkg is Package & { deprecated: false } =>
    pkg.deprecated !== true
  ),
  R.filter(R.isNonNull),  // Built-in type guard
  // TypeScript now knows: deprecated is false, no nulls
)

// isDefined, isNonNull, isString, isNumber — all type guards:
const withDownloads = R.pipe(
  packages,
  R.map((pkg) => pkg.downloads),
  R.filter(R.isNonNull),
  // Type is now number[] (not (number | null)[])
)

Object manipulation

import * as R from "remeda"

// pick/omit with strict TypeScript types:
const summary = R.pick(pkg, ["name", "version"])  // { name: string; version: string }
const public_ = R.omit(pkg, ["internal"])          // Omit<Package, "internal">

// mapKeys / mapValues:
const uppercased = R.mapValues(config, (value) => value.toUpperCase())

// merge (deep):
const merged = R.mergeDeep(defaults, overrides)

// groupBy:
const byCategory = R.groupBy(packages, (pkg) => pkg.category)
// → Record<string, Package[]>

lodash

lodash — the classic utility library:

// Load just the methods this module uses:
import debounce from "lodash/debounce"
import merge from "lodash/merge"
import groupBy from "lodash/groupBy"

// Or use lodash-es for ESM tree-shaking:
import { debounce, merge, groupBy } from "lodash-es"

Still useful in 2026

import debounce from "lodash/debounce"
import merge from "lodash/merge"
import get from "lodash/get"

// Deep merge — still better than native spread for nested objects:
const config = merge(
  { server: { port: 3000, host: "localhost" } },
  { server: { port: 8080 } },
)
// → { server: { port: 8080, host: "localhost" } }

// Safe nested access with default (legacy code):
const name = get(data, "user.profile.name", "Anonymous")
// In modern code: data?.user?.profile?.name ?? "Anonymous"

// debounce with leading/trailing options:
const save = debounce(saveDocument, 1000, { leading: false, trailing: true })

Feature Comparison

PackageImportsTypeScriptPipeline style
es-toolkitNamed exports and a Lodash-compatible subpathBuilt-in typesStandalone utility functions
RemedaNamed exportsBuilt-in typesData-first or data-last calls, with lazy pipe stages where supported
LodashPer-method imports from lodash or named imports from lodash-es@types/lodashChaining with _.chain

When to Use Each

Choose es-toolkit if: You want standalone utilities or need to migrate Lodash call sites one at a time.

Choose Remeda if: You need to combine filters and transforms with type inference across each stage.

Choose Lodash if: You rely on an existing chain or on exact behavior you have yet to test in a replacement.

Use native JavaScript when it preserves the behavior you need. For example, optional chaining with ?? also replaces a null result, while Lodash get only uses the default for undefined.


TypeScript Integration and Type Inference

One of the sharpest distinctions among these three libraries lies in how deeply they integrate with the TypeScript type system. Lodash ships types via @types/lodash, a community-maintained package that lags behind TypeScript's evolving capabilities and often produces overly broad return types. For example, _.pick(obj, ["a", "b"]) returns a partial of the original type but loses literal key information in many scenarios. es-toolkit ships its own TypeScript types and nails the pick and omit signatures — the return type is exactly Pick<T, K> or Omit<T, K>. Remeda pushes this furthest: its pipe() function correctly narrows types through each transformation step, so if you filter with a type guard the downstream operations know the narrower type. For teams running strict mode with noUncheckedIndexedAccess, remeda's type inference catches more potential runtime errors at compile time than either of its competitors.

Migration Path from Lodash

Start with a module whose behavior you can verify. Use es-toolkit/compat for supported functions and compare outputs on missing values and edge cases. If you're moving to Remeda, rewrite implicit chains as explicit pipeline steps and let your TypeScript checks flag changed types.

Measure Performance and Bundle Size

Build the same application entry point with the imports you intend to ship. Compare compressed output with the same bundler mode and settings. For runtime performance, time the same operations on representative inputs and check that each library returns the same result before you compare timings.

Use npm explain lodash if it remains installed after you've changed your imports. A different dependency can still require it. Registry downloads combine npm activity and cannot identify which applications chose a library directly.

Compare utility and data manipulation packages on PkgPulse →

See also: Lodash vs Underscore and Lodash vs Ramda, acorn vs @babel/parser vs espree.