{"id":11624,"library":"ramda","title":"Ramda: A Practical Functional Programming Library","description":"Ramda is a JavaScript library designed explicitly for a functional programming style, emphasizing immutability and side-effect-free operations. Unlike general-purpose toolkits, Ramda focuses on enabling easy creation of functional pipelines. Its functions are automatically curried, allowing for the composition of new functions by partially applying parameters, and parameters are consistently arranged with the data-to-be-operated-on supplied last. This design makes it highly suitable for point-free style programming. The current stable version is 0.32.0, with minor releases occurring every few months, often including breaking changes outlined in detailed upgrade guides. Ramda's core philosophy is practical functional JavaScript, using plain JavaScript objects and arrays, and prioritizing a clean API and performance over strict purity enforcement.","status":"active","version":"0.32.0","language":"javascript","source_language":"en","source_url":"git://github.com/ramda/ramda","tags":["javascript","ramda","functional","utils","utilities","toolkit","fp","tacit","point-free"],"install":[{"cmd":"npm install ramda","lang":"bash","label":"npm"},{"cmd":"yarn add ramda","lang":"bash","label":"yarn"},{"cmd":"pnpm add ramda","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Since v0.25, Ramda no longer has a default export; `import R from 'ramda'` will result in a TypeError. The recommended approach for bundling the entire library with tree-shaking support is `import * as R from 'ramda'`.","wrong":"import R from 'ramda';","symbol":"R","correct":"import * as R from 'ramda';"},{"note":"Named imports are supported and often preferred for tree-shaking. Directly importing from `ramda/src/map` is generally discouraged as it bypasses build optimizations and might break with internal changes.","wrong":"import map from 'ramda/src/map';","symbol":"map","correct":"import { map } from 'ramda';"},{"note":"This is the standard CommonJS import pattern for Node.js environments.","symbol":"R","correct":"const R = require('ramda');"},{"note":"For Deno environments, import directly from the Deno.land URL, ensuring to specify the desired version to avoid unexpected breaking changes.","symbol":"R (Deno)","correct":"import * as R from \"https://deno.land/x/ramda@v0.27.2/mod.ts\";"}],"quickstart":{"code":"import * as R from 'ramda';\n\ninterface User {\n  id: number;\n  name: string;\n  email: string;\n  isActive: boolean;\n}\n\nconst users: User[] = [\n  { id: 1, name: 'Alice', email: 'alice@example.com', isActive: true },\n  { id: 2, name: 'Bob', email: 'bob@example.com', isActive: false },\n  { id: 3, name: 'Charlie', email: 'charlie@example.com', isActive: true },\n  { id: 4, name: 'David', email: 'david@example.com', isActive: false },\n];\n\n// Get active user names, sorted alphabetically\nconst getActiveUserNames = R.pipe(\n  R.filter(R.propEq('isActive', true)),\n  R.map(R.prop('name')),\n  R.sort(R.ascend(R.identity))\n);\n\nconst activeNames = getActiveUserNames(users);\nconsole.log('Active users (names):', activeNames);\n\n// Create a curried function to update a user's status\nconst deactivateUser = R.curry((userId: number, userList: User[]) =>\n  R.map((user: User) =>\n    R.when(R.propEq('id', userId), R.assoc('isActive', false))(user)\n  )(userList)\n);\n\nconst updatedUsers = deactivateUser(1, users);\nconsole.log('Updated users (deactivated ID 1):', updatedUsers.find(u => u.id === 1));\n\n// Example of partial application\nconst getEmails = R.map(R.prop('email'));\nconst allEmails = getEmails(users);\nconsole.log('All user emails:', allEmails);\n","lang":"typescript","description":"Demonstrates Ramda's core features: piping, filtering, mapping, currying, and immutability to process and transform a list of user objects."},"warnings":[{"fix":"Review calls to `R.propEq` and `R.pathEq`. The correct order is now `(propertyName, value, object)` for `propEq` and `(pathArray, value, object)` for `pathEq`.","message":"The parameter order for `propEq` and `pathEq` functions changed in `v0.29.0`. This could lead to incorrect comparisons if not updated.","severity":"breaking","affected_versions":">=0.29.0"},{"fix":"Use named imports (`import { func } from 'ramda'`) or import the entire library as a namespace (`import * as R from 'ramda'`).","message":"Ramda versions greater than `0.25` no longer provide a default export. Attempting `import R from 'ramda'` will cause a `TypeError`.","severity":"breaking","affected_versions":">=0.25.0"},{"fix":"Upgrade to `ramda@0.27.2` or newer to incorporate the security patch.","message":"A security vulnerability related to the `trim` function was patched in `v0.27.2`. Users on `v0.27.0` or `v0.27.1` are advised to upgrade immediately.","severity":"gotcha","affected_versions":"0.27.0, 0.27.1"},{"fix":"Always provide arguments in the order expected by Ramda (data last), or explicitly curry/partial apply functions as needed. Familiarize yourself with `R.curry`, `R.partial`, and `R.pipe`/`R.compose`.","message":"Ramda functions are automatically curried and expect data to be the last argument. Misunderstanding this paradigm can lead to incorrect function application, argument order issues, and unexpected behavior, especially when composing functions.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Be mindful of `undefined` and `null` when working with types. For example, `R.head('')` returns `undefined`, which might require non-null assertions or explicit checks (`R.isNil`, `R.isNotNil`) depending on `types-ramda` version. Ensure `@types/ramda` is kept in sync with the Ramda library version.","message":"While Ramda supports TypeScript typings (often via `@types/ramda` or `types-ramda`), some types, especially for complex curried functions or conditional types, might require explicit assertions or careful usage, particularly around `undefined` or `null` values.","severity":"gotcha","affected_versions":">=0.27.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change your import statement to `import * as R from 'ramda';` for a namespace import, or `import { map } from 'ramda';` for specific functions.","cause":"Attempting to use `R.map` or other Ramda functions after importing the library as a default export (`import R from 'ramda';`) instead of a namespace import.","error":"TypeError: R.map is not a function"},{"fix":"Ensure `const R = require('ramda');` (CommonJS) or `import * as R from 'ramda';` (ESM) is at the top of your file, or that the `<script>` tag is loaded in a browser environment.","cause":"The Ramda library (or its global variable `R`) was not correctly imported or loaded into the current scope.","error":"ReferenceError: R is not defined"},{"fix":"Review the function call chain to ensure that intermediate results are not `undefined` or `null` before being passed to functions expecting a valid collection. Use `R.when`, `R.unless`, `R.defaultTo`, or `R.isNil` to handle potentially missing values defensively.","cause":"A Ramda function expecting a collection (like `map`, `filter`, `reduce`) received `undefined` or `null` as its data argument, often due to incorrect currying or argument order in a pipeline.","error":"TypeError: Cannot read properties of undefined (reading 'length')"},{"fix":"Explicitly manage arity using `R.unary`, `R.nAry`, or `R.curryN` if you encounter issues with argument counts. Sometimes, explicitly wrapping a function (e.g., `const mult = (a) => (b) => a * b;`) can resolve such ambiguities, or debugging with logging tools (`R_.log` from `ramda-extension`) to inspect intermediate values in a pipe/compose chain.","cause":"Ramda's 'magical currying' can sometimes lead to unexpected arity behavior or issues when combining functions with differing argument counts, especially with functions like `R.converge` where the arity of the resulting function depends on the maximum arity of the transforming functions.","error":"Incorrect arity or argument handling in complex compositions (e.g., `R.converge`)"}],"ecosystem":"npm"}