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

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 - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

26

index.js
module.exports = curry;
/*
function add(a, b, c) {
return a + b + c;
}
curry(add)(1)(2)(3); // 6
curry(add)(1)(2)(2); // 5
curry(add)(2)(4, 3); // 9
function add(...args) {
return args.reduce((sum, n) => sum + n, 0)
}
var curryAdd4 = curry(add, 4)
curryAdd4(1)(2, 3)(4); // 10
function converter(ratio, input) {
return (input*ratio).toFixed(1);
}
var curriedConverter = curry(converter)
var milesToKm = curriedConverter(1.62);
const curriedConverter = curry(converter)
const milesToKm = curriedConverter(1.62);
milesToKm(35); // 56.7

@@ -13,9 +26,12 @@ milesToKm(10); // 16.2

function curry(fn) {
function curry(fn, arity) {
return function curried() {
if (arity == null) {
arity = fn.length;
}
var args = [].slice.call(arguments);
if (args.length >= fn.length) {
if (args.length >= arity) {
return fn.apply(this, args);
} else {
return function () {
return function() {
return curried.apply(this, args.concat([].slice.call(arguments)));

@@ -22,0 +38,0 @@ };

9

package.json
{
"name": "just-curry-it",
"version": "2.0.1",
"version": "3.0.0",
"description": "return a curried function",

@@ -10,8 +10,3 @@ "main": "index.js",

"repository": "https://github.com/angus-c/just",
"keywords": [
"function",
"curry",
"no-dependencies",
"just"
],
"keywords": ["function", "curry", "no-dependencies", "just"],
"author": "Angus Croll",

@@ -18,0 +13,0 @@ "license": "MIT",

@@ -11,8 +11,22 @@ ## just-curry-it

function add(a, b, c) {
return a + b + c;
}
curry(add)(1)(2)(3); // 6
curry(add)(1)(2)(2); // 5
curry(add)(2)(4, 3); // 9
function add(...args) {
return args.reduce((sum, n) => sum + n, 0)
}
var curryAdd4 = curry(add, 4)
curryAdd4(1)(2, 3)(4); // 10
function converter(ratio, input) {
return (input*ratio).toFixed(1);
}
const milesToKm = curry(converter)(1.62);
const curriedConverter = curry(converter)
const milesToKm = curriedConverter(1.62);
milesToKm(35); // 56.7
milesToKm(10); // 16.2
```
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