Socket
Socket
Sign inDemoInstall

just-curry-it

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-curry-it

return a curried function


Version published
Weekly downloads
323K
increased by13.76%
Maintainers
1
Weekly downloads
 
Created

What is just-curry-it?

The just-curry-it npm package is a utility for currying functions. Currying is a functional programming technique where a function with multiple arguments is transformed into a sequence of functions each taking a single argument. This package simplifies the process of currying functions in JavaScript.

What are just-curry-it's main functionalities?

Basic Currying

This feature allows you to transform a function that takes multiple arguments into a curried function. The curried function can then be called with one argument at a time, or with multiple arguments at once.

const curry = require('just-curry-it');

function add(a, b, c) {
  return a + b + c;
}

const curriedAdd = curry(add);
console.log(curriedAdd(1)(2)(3)); // 6
console.log(curriedAdd(1, 2)(3)); // 6
console.log(curriedAdd(1)(2, 3)); // 6

Partial Application

This feature allows for partial application of functions. You can fix some arguments of the function and get a new function that takes the remaining arguments.

const curry = require('just-curry-it');

function multiply(a, b, c) {
  return a * b * c;
}

const curriedMultiply = curry(multiply);
const multiplyBy2 = curriedMultiply(2);
console.log(multiplyBy2(3, 4)); // 24
console.log(multiplyBy2(3)(4)); // 24

Other packages similar to just-curry-it

Keywords

FAQs

Package last updated on 03 May 2021

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