Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ramda

Package Overview
Dependencies
Maintainers
7
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ramda

A practical functional library for JavaScript programmers.

  • 0.24.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11M
increased by3.01%
Maintainers
7
Weekly downloads
 
Created

What is ramda?

Ramda is a functional programming library for JavaScript that makes it easy to create functional pipelines, without mutating data. It emphasizes a purer functional style, with functions that are automatically curried and composed of small, reusable, and combinable functions.

What are ramda's main functionalities?

Immutability and Side-Effect Free Functions

Ramda functions do not mutate the input data and do not cause side effects, making it easier to reason about code.

const increment = R.map(R.add(1));
const result = increment([1, 2, 3]); // [2, 3, 4]

Function Composition

Ramda provides compose and pipe functions for combining functions into new functions, facilitating functional composition.

const getNames = R.compose(R.map(R.prop('name')), R.filter(R.propEq('isActive', true)));
const users = [{name: 'Alice', isActive: true}, {name: 'Bob', isActive: false}];
const activeUserNames = getNames(users); // ['Alice']

Automatic Currying

Ramda functions are automatically curried, allowing you to easily create new functions by partially applying arguments.

const addFourNumbers = (a, b, c, d) => a + b + c + d;
const curriedAddFourNumbers = R.curry(addFourNumbers);
const f = curriedAddFourNumbers(1, 2);
const g = f(3);
const result = g(4); // 10

Data Transformation

Ramda provides a suite of tools for transforming data structures, such as arrays and objects, in a declarative and functional way.

const sortByAge = R.sortBy(R.prop('age'));
const people = [{name: 'John', age: 23}, {name: 'Jane', age: 21}];
const sortedPeople = sortByAge(people); // [{name: 'Jane', age: 21}, {name: 'John', age: 23}]

Other packages similar to ramda

FAQs

Package last updated on 02 Jun 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc