Arkhe
ἀρχή - "origin"
Modern, lightweight alternative to lodash. Data manipulation, type guards, and function utilities with TypeScript-first design and optimal tree-shaking.
Arkhe provides a curated set of utility functions for everyday TypeScript development. Unlike Lodash, every function is written in TypeScript from the ground up, with strict type inference and no runtime type checks. The library ships as ES modules with granular entry points, so bundlers can eliminate unused code automatically.
Quick Example
Each import targets a single function for optimal tree-shaking. Your bundler only includes the code you actually use, keeping your production bundle minimal:
import { chunk } from "pithos/arkhe/array/chunk";
import { groupBy } from "pithos/arkhe/array/group-by";
import { get } from "pithos/arkhe/object/get";
import { debounce } from "pithos/arkhe/function/debounce";
const users = [{ name: "Alice", role: "admin" }, { name: "Bob", role: "user" }];
chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
groupBy(users, (u) => u.role); // { admin: [...], user: [...] }
get(users[0], "name", "Anonymous"); // "Alice"
debounce(handleSearch, 300); // Rate-limited function
chunk splits an array into groups of a given size. groupBy categorizes items by a key function. get safely accesses deeply nested properties with a fallback value, avoiding runtime errors on missing paths. debounce limits how often a function fires, which is useful for search inputs or resize handlers.
When to Use
Arkhe covers the most common data manipulation needs in TypeScript projects. Whether you are transforming collections, reshaping objects, formatting strings, or controlling function execution, Arkhe provides a type-safe, immutable utility for the job:
- Arrays: chunk, groupBy, partition, difference, intersection, orderBy...
- Objects: get, set, merge, pick, omit, evolve...
- Strings: camelCase, kebabCase, capitalize, template...
- Functions: debounce, throttle, memoize, pipe, curry...
- Async: retry, parallel, defer, sleep...
- Types: Nullable, Arrayable, PartialKeys, type guards...
When NOT to Use
Arkhe focuses on general-purpose data utilities. For specialized needs, other Pithos modules are a better fit:
Migrating from Lodash
Step 1: Install Pithos
- npm
- pnpm
- yarn
- bun
npm install @pithos/core
pnpm install @pithos/core
yarn add @pithos/core
bun add @pithos/core
Step 2: Replace imports incrementally
You don't need to migrate everything at once. Replace one function at a time:
// Before
import { chunk, groupBy } from "lodash-es";
// After: replace one at a time
import { chunk } from "pithos/arkhe/array/chunk";
import { groupBy } from "lodash-es"; // migrate later
Step 3: Check the equivalence table
Not every Lodash function has an Arkhe equivalent. Some have native JavaScript replacements, and some are intentionally excluded. See the full equivalence table for a complete mapping.
Step 4: Run your tests
Arkhe aims for behavioral compatibility on common use cases, but edge cases may differ, especially around:
- Handling of
null/undefinedarguments (Arkhe validates inputs, Lodash often silently returns defaults) - Deep cloning behavior
- Prototype chain handling
For functions that have been superseded by native JavaScript, Taphos provides IDE-guided migration paths with deprecation warnings pointing you to the right replacement.
Related Resources
- When to use Arkhe — Compare Arkhe with alternatives and find when it's the right choice
- Arkhe bundle size & performance — Detailed bundle size comparison with Lodash and es-toolkit
- Arkhe API Reference — Complete API documentation for all Arkhe utilities