Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Remeda is a utility library for JavaScript and TypeScript that provides a collection of functions for working with arrays, objects, and other data types. It is designed to be a modern, functional alternative to libraries like Lodash, with a focus on immutability and type safety.
Array Manipulation
Remeda provides a variety of functions for manipulating arrays, such as `filter`, `map`, and `reduce`. These functions can be composed using `R.pipe` to create complex transformations in a readable and functional style.
const arr = [1, 2, 3, 4, 5];
const result = R.pipe(
arr,
R.filter(x => x % 2 === 0),
R.map(x => x * 2)
);
console.log(result); // [4, 8]
Object Manipulation
Remeda includes functions for working with objects, such as `omit`, `pick`, and `merge`. These functions allow you to create new objects with specific properties removed, selected, or combined.
const obj = { a: 1, b: 2, c: 3 };
const result = R.omit(obj, ['b']);
console.log(result); // { a: 1, c: 3 }
Functional Programming
Remeda supports functional programming techniques, such as partial application and currying. The `partial` function allows you to create new functions with some arguments pre-filled, making it easier to create reusable and composable functions.
const add = (a, b) => a + b;
const add10 = R.partial(add, 10);
console.log(add10(5)); // 15
Type Safety
Remeda is designed with TypeScript in mind, providing type-safe functions that help catch errors at compile time. This ensures that your code is more robust and less prone to runtime errors.
const arr: number[] = [1, 2, 3, 4, 5];
const result = R.map(arr, x => x * 2);
console.log(result); // [2, 4, 6, 8, 10]
Lodash is a popular utility library that provides a wide range of functions for working with arrays, objects, and other data types. While Lodash is more widely used and has a larger community, Remeda offers a more modern and functional approach with better TypeScript support.
Ramda is a functional programming library for JavaScript that emphasizes immutability and function composition. Like Remeda, Ramda provides a collection of functions for working with data in a functional style. However, Remeda is designed to be more type-safe and user-friendly for TypeScript users.
fp-ts is a library for functional programming in TypeScript. It provides a comprehensive set of tools for working with functional programming concepts, such as monads and functors. While fp-ts is more powerful and flexible, it has a steeper learning curve compared to Remeda.
The first "data-first" and "data-last" utility library designed especially for TypeScript.
Read the full docs and API reference on remedajs.com/docs.
Migrating from other libraries? Check out our migration guides for Lodash and Ramda!
Interested in contributing? Read the contributing guide.
R.filter(array, fn)
) and data-last (R.filter(fn)(array)
) approaches.pipe
and piped
.npm install remeda
pnpm add remeda
yarn add remeda
bun install remeda
// Import everything:
import * as R from "remeda";
// Or import methods individually:
// import { pipe, tap, unique, take } from "remeda";
R.pipe(
[1, 2, 2, 3, 3, 4, 5, 6],
R.tap((value) => console.log(`Got ${value}`)),
R.unique(),
R.take(3),
); // => [1, 2, 3]
// Console output:
// Got 1
// Got 2
// Got 2
// Got 3
Questions, bug reports, and feature requests are tracked in GitHub issues.
Made with contrib.rocks.
FAQs
A utility library for JavaScript and Typescript.
The npm package remeda receives a total of 294,715 weekly downloads. As such, remeda popularity was classified as popular.
We found that remeda demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.