A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
es-toolkit is a modern JavaScript utility library that provides high-performance implementations of common functions for manipulating arrays, objects, strings, and more. Built from the ground up for modern JavaScript runtimes (Node.js 18+, Bun, Deno, browsers), it leverages native language features to achieve significantly better performance than traditional utility libraries.
The library emerged as a response to the bundle size and performance limitations of older utility libraries like Lodash. While Lodash remains widely used, it was designed for JavaScript environments from a decade ago. es-toolkit takes advantage of modern ECMAScript features, native optimizations in V8 and other engines, and tree-shaking to deliver the same functionality with dramatically less overhead.
With over 10 million weekly downloads, es-toolkit has quickly gained adoption among developers building performance-sensitive applications. It offers 100% test coverage, first-class TypeScript support with built-in type definitions, and a familiar API surface that makes migration straightforward. Each utility is exported as a standalone module, ensuring you only ship the code you actually use.
The library is particularly popular in environments where bundle size matters—single-page applications, serverless functions, and edge computing. Its strong type annotations provide excellent IDE autocomplete and catch errors at compile time, making it a natural fit for TypeScript projects while remaining fully usable in plain JavaScript.
import { debounce, pick, uniq, isNotNil, groupBy } from 'es-toolkit';
// Debounced search handler for autocomplete
const searchAPI = async (query: string) => {
const response = await fetch(`/api/search?q=${query}`);
return response.json();
};
const debouncedSearch = debounce(searchAPI, 300);
// Type-safe object picking
interface User {
id: number;
username: string;
email: string;
password: string;
createdAt: Date;
}
const user: User = {
id: 1,
username: 'johndoe',
email: '[email protected]',
password: 'hashed_secret',
createdAt: new Date()
};
const publicUser = pick(user, ['id', 'username', 'email']);
// Type: { id: number; username: string; email: string }
// Remove duplicates and filter nullish values
const tags = [null, 'javascript', 'typescript', 'javascript', undefined, 'node'];
const uniqueTags = uniq(tags.filter(isNotNil));
// Result: ['javascript', 'typescript', 'node']
// Group array of objects
const orders = [
{ id: 1, status: 'pending', amount: 100 },
{ id: 2, status: 'completed', amount: 200 },
{ id: 3, status: 'pending', amount: 150 }
];
const ordersByStatus = groupBy(orders, order => order.status);
// Result: { pending: [...], completed: [...] }
console.log(ordersByStatus.pending.length); // 2Reducing bundle size in React/Vue/Svelte applications: Replace Lodash imports with es-toolkit to cut down on JavaScript payload. A typical SPA using 10-15 Lodash functions can save 50-80KB minified by switching to tree-shakable es-toolkit imports.
Building serverless functions with fast cold starts: In AWS Lambda or Cloudflare Workers where initialization time matters, es-toolkit's minimal footprint and faster execution reduce cold start latency compared to heavier utility libraries.
Implementing debounced search or throttled scroll handlers: Use the built-in debounce and throttle functions for responsive UI interactions without adding separate packages or writing custom implementations that might have edge case bugs.
Type-safe data transformation pipelines: Leverage type guards like isNotNil and strongly-typed functions like pick, omit, and groupBy to process API responses or user data with full TypeScript inference, catching type errors before runtime.
Array operations in data-heavy dashboards: Process large datasets efficiently with optimized uniq, difference, intersection, and chunk functions that outperform Lodash equivalents by 2-3x in modern browsers.
npm install es-toolkitpnpm add es-toolkitbun add es-toolkit