Skip to content

yurkimus/curry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Curry

JavaScript curry utility.

Table of Contents

Installation

npm

npm install @yurkimus/curry

urls

"@yurkimus/curry": "npm:@yurkimus/curry"
"@yurkimus/curry": "github:yurkimus/curry"
"@yurkimus/curry": "https://raw.githubusercontent.com/yurkimus/curry/main/source/index.js"

Exports

curry

Definition:

curry :: Function -> Number -> Function

Example:

curry(
  // predicate, no need to specify length unless using variadic function parameters
  (a, b) => a + b,
)(1)(2) // => 3

curry(
  // predicate
  (a, ...numbers) => a + numbers.reduce((x, a) => x + a, 0),
  // specified length to handle variadic function parameters
  2,
)(1)(2, 3) // => 6

License

MIT