How to use the curryN function from ramda

Find comprehensive JavaScript ramda.curryN code examples handpicked from public code repositorys.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
const createTx = require('./transaction');


module.exports = (locations = [], formatFn = require('pg-format'), isolationLevel) => {
  const SQL_EXT = '.sql';


  const join = R.curryN(2, path.join);


  const sqlFile = name => path.extname(name) === SQL_EXT;


  const readFile = R.partialRight(fs.readFileSync, [{ encoding: 'utf-8' }]);
fork icon1
star icon6
watch icon0

+ 3 other calls in file

107
108
109
110
111
112
113
114
115
116
117
118
119
  email,
  roles,
  exp,
})


const verify = curryN(2)(jwt.verify)


const isTheRightKid = (kid) => (publicKey) => publicKey.kid === kid


const findPublicKeyFromKid = (publicKey) => (kid) =>
fork icon12
star icon1
watch icon0

46
47
48
49
50
51
52
53
54
55
56
      return i
    }
  }
})


const getScenicScore = R.curryN(
  2,
  R.converge(R.unapply(R.reduce(R.multiply, 1)), [
    getViewDistance([0, 1]),
    getViewDistance([0, -1]),
fork icon0
star icon1
watch icon0

60
61
62
63
64
65
66
67
68
69
70
71
72
  }, `User ${context.userId} has none of [${checkPermissions.join(", ")}] permissions`);


  return false;
}


const hasPermissionCurried = curryN(3, hasPermission);


/**
 * @summary Get a `hasPermission` function bound to the current user context
 * @param {Object} context App context
fork icon0
star icon0
watch icon1

+ 2 other calls in file

46
47
48
49
50
51
52
53
54
55
    R.compose(R.objOf("list"), R.nthArg(0)),
    R.compose(R.objOf("searchValue"), R.nthArg(1)),
  ])
);


var binarySearch = R.curryN(2, binarySearch);


module.exports = binarySearch;
fork icon0
star icon0
watch icon0

1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
* @see R.curry
* @example
*
*      var sumArgs = (...args) => R.sum(args);
*
*      var curriedAddFourNumbers = R.curryN(4, sumArgs);
*      var f = curriedAddFourNumbers(1, 2);
*      var g = f(3);
*      g(4); //=> 10
*/
fork icon0
star icon0
watch icon0

+ 35 other calls in file

1
2
3
4
5
6
7
8
9
10
11
12


var DEFAULTS = {
    test: /^xmlns(Xlink)?$/
};


module.exports = R.curryN(2, function removeXmlnsProps (opts) {
    var options = R.merge(DEFAULTS, opts || {});
    var path    = this.path;
    var key     = path[path.length - 1];
    var isXmlns = options.test.test(key);
fork icon0
star icon0
watch icon0

12
13
14
15
16
17
18
19
20
        R.fromPairs(variables.map(([varname, expr]) => [varname, context.interpret(expr)]))
    )
        .interpret(fn)),

lambda: monad((context, [argNames, fn]) =>
    R.curryN(argNames.length, (...args) =>
        context.inherit(
            R.fromPairs(R.zip(argNames, args))
        ).interpret(fn))),
fork icon0
star icon0
watch icon0

34
35
36
37
38
39
40
41
42
43
  let h = R.curry(subtract)(_, 10)
  expect(h(5)).to.equal(-5)

  expect(sum(1, 2, 3)).to.equal(6)

  let i = R.curryN(2, sum)
  expect(i(4, 5)).to.equal(9)
},

"filtersFilterables": () => {
fork icon0
star icon0
watch icon0

+ 3 other calls in file

226
227
228
229
230
231
232
233
234
235
    name: `${NAME}./`,
    variadic,
  }
),
"//": makeFunction(
  curryN(2, (...args) => args.reduce((quot, arg) => Math.floor(quot / arg))),
  {
    name: `${NAME}.//`,
    variadic,
  }
fork icon0
star icon0
watch icon0

+ 47 other calls in file

2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
* @see R.curry
* @example
*
*      const sumArgs = (...args) => R.sum(args);
*
*      const curriedAddFourNumbers = R.curryN(4, sumArgs);
*      const f = curriedAddFourNumbers(1, 2);
*      const g = f(3);
*      g(4); //=> 10
*/
fork icon0
star icon0
watch icon2

+ 3 other calls in file

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)