main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
926 bytes
|
Line | |
---|
1 | var curryN =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curryN.js");
|
---|
4 | /**
|
---|
5 | * Takes a binary function `f`, a unary function `g`, and two values.
|
---|
6 | * Applies `g` to each value, then applies the result of each to `f`.
|
---|
7 | *
|
---|
8 | * Also known as the P combinator.
|
---|
9 | *
|
---|
10 | * @func
|
---|
11 | * @memberOf R
|
---|
12 | * @since v0.28.0
|
---|
13 | * @category Function
|
---|
14 | * @sig ((a, a) -> b) -> (c -> a) -> c -> c -> b
|
---|
15 | * @param {Function} f a binary function
|
---|
16 | * @param {Function} g a unary function
|
---|
17 | * @param {any} a any value
|
---|
18 | * @param {any} b any value
|
---|
19 | * @return {any} The result of `f`
|
---|
20 | * @example
|
---|
21 | *
|
---|
22 | * const eqBy = R.on((a, b) => a === b);
|
---|
23 | * eqBy(R.prop('a'), {b:0, a:1}, {a:1}) //=> true;
|
---|
24 | *
|
---|
25 | * const containsInsensitive = R.on(R.includes, R.toLower);
|
---|
26 | * containsInsensitive('o', 'FOO'); //=> true
|
---|
27 | * @symb R.on(f, g, a, b) = f(g(a), g(b))
|
---|
28 | */
|
---|
29 |
|
---|
30 |
|
---|
31 | var on =
|
---|
32 | /*#__PURE__*/
|
---|
33 | curryN(4, [], function on(f, g, a, b) {
|
---|
34 | return f(g(a), g(b));
|
---|
35 | });
|
---|
36 | module.exports = on; |
---|
Note:
See
TracBrowser
for help on using the repository browser.