{"id":11934,"library":"remeda","title":"Remeda Utility Library","description":"Remeda is a modern, tree-shakable utility library for JavaScript and TypeScript, focusing on a functional programming paradigm with both \"data-first\" and \"data-last\" execution styles. It is currently at version 2.33.7 and receives frequent updates, often multiple bug-fix releases per month, with minor feature releases occurring periodically. Key differentiators include its robust, first-class TypeScript support, providing highly specific and accurate types for its extensive collection of utilities. Unlike older libraries, Remeda is designed from the ground up to support lazy evaluation through `pipe` and `piped`, offers full CJS and ESM compatibility, and ensures full code coverage with comprehensive runtime and type tests. It aims to provide a reliable and type-safe alternative to libraries like Lodash and Ramda, offering migration guides for users transitioning from those ecosystems.","status":"active","version":"2.33.7","language":"javascript","source_language":"en","source_url":"https://github.com/remeda/remeda","tags":["javascript","algo","algorithm","curried","fp","functional","generics","lodash","ramda","typescript"],"install":[{"cmd":"npm install remeda","lang":"bash","label":"npm"},{"cmd":"yarn add remeda","lang":"bash","label":"yarn"},{"cmd":"pnpm add remeda","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Remeda primarily uses named ESM imports. CommonJS require is supported but less common for new projects.","wrong":"const pipe = require('remeda').pipe;","symbol":"pipe","correct":"import { pipe } from 'remeda';"},{"note":"Individual functions are imported directly from the 'remeda' package, not from subpaths. Remeda v2 changed module output structure.","wrong":"import map from 'remeda/map';","symbol":"map","correct":"import { map } from 'remeda';"},{"note":"Some functions were renamed in v2 for better alignment with ECMAScript standards and clearer terminology (e.g., `uniq` became `unique`).","wrong":"import { uniq } from 'remeda';","symbol":"unique","correct":"import { unique } from 'remeda';"}],"quickstart":{"code":"import { pipe, forEach, unique, take } from 'remeda';\n\nconst numbers = [1, 2, 2, 3, 3, 4, 5, 6];\n\nconst processedNumbers = pipe(\n  numbers,\n  forEach((value) => console.log(`Processing: ${value}`)), // Side effect\n  unique(), // Removes duplicates\n  take(3) // Takes the first 3 elements after uniqueness\n);\n\nconsole.log('Result:', processedNumbers);\n// Expected console output:\n// Processing: 1\n// Processing: 2\n// Processing: 2\n// Processing: 3\n// Processing: 3\n// Processing: 4\n// Processing: 5\n// Processing: 6\n// Result: [1, 2, 3]","lang":"typescript","description":"Demonstrates `pipe` for chaining multiple functional operations (forEach, unique, take) on an array in a data-first manner."},"warnings":[{"fix":"Consult the official Remeda v2 migration guide for specific function changes. For example, `map.indexed(DATA, ...)` becomes `map(DATA, (item, index) => ...)`.","message":"Starting from Remeda v2, many functions that previously offered 'variants' (like `.indexed` or `.strict`) have merged these into the base implementation, changing default behaviors or callback signatures. Users migrating from v1 will need to adjust calls, especially for functions like `map` where the indexed variant is now always available.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update function calls to use the new names as specified in the v2 migration guide. For instance, replace `uniq` with `unique`.","message":"Remeda v2 introduced several renames for functions to align with ECMAScript standards and improve clarity (e.g., `uniq` to `unique`, `fromPairs` to `fromEntries`, `createPipe` to `pipe`). Code using old names will break.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure single-parameter functions are invoked with `()` if intended for data-last application (e.g., `pipe(data, keys())` instead of `pipe(data, keys)`). Type guards (e.g., `isString`) are exceptions and remain 'headless'.","message":"In v2, all single-parameter functions should now be called with no parameters to get their data-last (curried) implementation when used outside of a `pipe` context. Previously, some could be called 'headless' directly. This affects functions like `keys()` or `identity()` when curried.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Carefully review TypeScript errors. Adjust your data types or use type assertions (`as Type`) if you are confident in the data's structure. Consider enabling stricter TypeScript flags incrementally.","message":"Remeda is TypeScript-first and provides very strict types. This is a feature but can lead to TypeScript errors if your data shapes or function arguments do not precisely match the expected types, especially when `exactOptionalPropertyTypes` is enabled (v2.33.1).","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consult the official migration guides for Lodash and Ramda on remedajs.com for detailed function-by-function comparison and migration steps. Expect to refactor code rather than simply renaming functions.","message":"Migrating from Lodash or Ramda requires understanding Remeda's distinct \"data-first\" and \"data-last\" philosophy and specific function signatures. Direct drop-in replacements may not work as expected, and some Lodash/Ramda features (like Lodash's mutable `forEach` early exit) are intentionally not replicated.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace `mapToObj` with `pullObject` or a composition of `fromEntries(map(array, fn))` to achieve similar results, which are generally more performant and idiomatic.","message":"The `mapToObj` function is explicitly marked as deprecated and will be removed in future versions. It's advised against its usage unless for specific performance constraints with huge inputs.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure your data types and function signatures align with Remeda's strict typings. You may need to refine your own type definitions, or use type assertions if you are certain of the type.","cause":"Remeda's types are highly specific, and this error indicates a mismatch between your input data's type or a callback's signature and what the Remeda function expects.","error":"Argument of type '(...)' is not assignable to parameter of type '(...)'"},{"fix":"Confirm you are using `import { someFunction } from 'remeda';` for named exports in an ESM context. Check your `tsconfig.json` and `package.json` for correct module resolution settings if using TypeScript or Node.js ESM.","cause":"This usually means you are attempting to use a CommonJS `require` call or an incorrect import path for a named ESM export in a context where the module resolution expects a different format or an incorrect name.","error":"TypeError: (0 , remeda_1.someFunction) is not a function"},{"fix":"Consider narrowing the type before using `prop`, or explicitly type the object being accessed if the type inference is failing. For known issues, check Remeda's GitHub issues for workarounds or future fixes. You might need to use `as any` as a last resort, but this reduces type safety.","cause":"When using `prop` (or similar accessors) in complex type scenarios, especially with unions or recursive objects, TypeScript might struggle to infer the exact type, leading to this error. There's an open issue related to `prop` and recursive objects.","error":"Property 'prop' does not exist on type '...' (when using `prop` in pipes with strict type configurations)"}],"ecosystem":"npm"}