just-curry-it
return a curried function
Last updated 4 years ago by angus-c .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install just-curry-it 
SYNC missed versions from official npm registry.

just-curry-it

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

???? Try it

npm install just-curry-it
yarn add just-curry-it

Return a curried function

import curry from '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 curriedConverter = curry(converter)
const milesToKm = curriedConverter(1.62);
milesToKm(35); // 56.7
milesToKm(10); // 16.2

Current Tags

  • 5.0.1                                ...           latest (4 years ago)

17 Versions

  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.1.1                                ...           4 years ago
  • 4.1.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.2.1                                ...           5 years ago
  • 3.2.0                                ...           5 years ago
  • 3.1.0                                ...           8 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.1                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.1.22                                ...           10 years ago
  • 1.1.21                                ...           10 years ago
  • 1.1.20                                ...           10 years ago
  • 1.1.19                                ...           10 years ago
  • 1.1.18                                ...           10 years ago
  • 1.1.17                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 13
This Month 13
Last Day 0
Last Week 0
Last Month 7
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |