Registry / serialization / ramda

ramda

JSON →
library0.32.0jsnpmunverified

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.

serializationdata
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

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'`.

import * as R from 'ramda';

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.

import { map } from 'ramda';

This is the standard CommonJS import pattern for Node.js environments.

const R = require('ramda');

For Deno environments, import directly from the Deno.land URL, ensuring to specify the desired version to avoid unexpected breaking changes.

import * as R from "https://deno.land/x/ramda@v0.27.2/mod.ts";

Demonstrates Ramda's core features: piping, filtering, mapping, currying, and immutability to process and transform a list of user objects.

import * as R from 'ramda'; interface User { id: number; name: string; email: string; isActive: boolean; } const users: User[] = [ { id: 1, name: 'Alice', email: 'alice@example.com', isActive: true }, { id: 2, name: 'Bob', email: 'bob@example.com', isActive: false }, { id: 3, name: 'Charlie', email: 'charlie@example.com', isActive: true }, { id: 4, name: 'David', email: 'david@example.com', isActive: false }, ]; // Get active user names, sorted alphabetically const getActiveUserNames = R.pipe( R.filter(R.propEq('isActive', true)), R.map(R.prop('name')), R.sort(R.ascend(R.identity)) ); const activeNames = getActiveUserNames(users); console.log('Active users (names):', activeNames); // Create a curried function to update a user's status const deactivateUser = R.curry((userId: number, userList: User[]) => R.map((user: User) => R.when(R.propEq('id', userId), R.assoc('isActive', false))(user) )(userList) ); const updatedUsers = deactivateUser(1, users); console.log('Updated users (deactivated ID 1):', updatedUsers.find(u => u.id === 1)); // Example of partial application const getEmails = R.map(R.prop('email')); const allEmails = getEmails(users); console.log('All user emails:', allEmails);
Debug
Known footguns
breakingThe parameter order for `propEq` and `pathEq` functions changed in `v0.29.0`. This could lead to incorrect comparisons if not updated.
breakingRamda versions greater than `0.25` no longer provide a default export. Attempting `import R from 'ramda'` will cause a `TypeError`.
gotchaA 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.
gotchaRamda 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.
gotchaWhile 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.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources