source: node_modules/ramda/es/on.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 906 bytes
Line 
1import curryN from "./internal/_curryN.js";
2/**
3 * Takes a binary function `f`, a unary function `g`, and two values.
4 * Applies `g` to each value, then applies the result of each to `f`.
5 *
6 * Also known as the P combinator.
7 *
8 * @func
9 * @memberOf R
10 * @since v0.28.0
11 * @category Function
12 * @sig ((a, a) -> b) -> (c -> a) -> c -> c -> b
13 * @param {Function} f a binary function
14 * @param {Function} g a unary function
15 * @param {any} a any value
16 * @param {any} b any value
17 * @return {any} The result of `f`
18 * @example
19 *
20 * const eqBy = R.on((a, b) => a === b);
21 * eqBy(R.prop('a'), {b:0, a:1}, {a:1}) //=> true;
22 *
23 * const containsInsensitive = R.on(R.includes, R.toLower);
24 * containsInsensitive('o', 'FOO'); //=> true
25 * @symb R.on(f, g, a, b) = f(g(a), g(b))
26 */
27
28var on =
29/*#__PURE__*/
30curryN(4, [], function on(f, g, a, b) {
31 return f(g(a), g(b));
32});
33export default on;
Note: See TracBrowser for help on using the repository browser.