swc/crates/swc_bundler/tests/.cache/deno/623fbb7dfcc2ae9d17e57e8e3718418b47c80e4d.ts
2021-11-09 20:42:49 +09:00

35 lines
940 B
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/on.js
import curryN from './internal/_curryN.js';
/**
* Takes a binary function `f`, a unary function `g`, and two values.
* Applies `g` to each value, then applies the result of each to `f`.
*
* Also known as the P combinator.
*
* @func
* @memberOf R
* @category Function
* @sig ((a, a) -> b) -> (c -> a) -> c -> c -> b
* @param {Function} f a binary function
* @param {Function} g a unary function
* @param {any} a any value
* @param {any} b any value
* @return {any} The result of `f`
* @example
*
* const eqBy = R.on((a, b) => a === b);
* eqBy(R.prop('a'), {b:0, a:1}, {a:1}) //=> true;
*
* const containsInsensitive = R.on(R.contains, R.toLower);
* containsInsensitive('o', 'FOO'); //=> true
* @symb R.on(f, g, a, b) = f(g(a), g(b))
*/
var on = curryN(4, [], function on(f, g, a, b) {
return f(g(a), g(b));
});
export default on;