mirror of
https://github.com/swc-project/swc.git
synced 2024-12-29 16:42:28 +03:00
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/partial.js
|
|
|
|
|
|
import _concat from './internal/_concat.js';
|
|
import _createPartialApplicator from './internal/_createPartialApplicator.js';
|
|
|
|
|
|
/**
|
|
* Takes a function `f` and a list of arguments, and returns a function `g`.
|
|
* When applied, `g` returns the result of applying `f` to the arguments
|
|
* provided initially followed by the arguments provided to `g`.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.10.0
|
|
* @category Function
|
|
* @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x)
|
|
* @param {Function} f
|
|
* @param {Array} args
|
|
* @return {Function}
|
|
* @see R.partialRight, R.curry
|
|
* @example
|
|
*
|
|
* const multiply2 = (a, b) => a * b;
|
|
* const double = R.partial(multiply2, [2]);
|
|
* double(3); //=> 6
|
|
*
|
|
* const greet = (salutation, title, firstName, lastName) =>
|
|
* salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
|
|
*
|
|
* const sayHello = R.partial(greet, ['Hello']);
|
|
* const sayHelloToMs = R.partial(sayHello, ['Ms.']);
|
|
* sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!'
|
|
* @symb R.partial(f, [a, b])(c, d) = f(a, b, c, d)
|
|
*/
|
|
var partial = _createPartialApplicator(_concat);
|
|
export default partial;
|