mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
31 lines
880 B
TypeScript
31 lines
880 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/apply.js
|
|
|
|
|
|
import _curry2 from './internal/_curry2.js';
|
|
|
|
|
|
/**
|
|
* Applies function `fn` to the argument list `args`. This is useful for
|
|
* creating a fixed-arity function from a variadic function. `fn` should be a
|
|
* bound function if context is significant.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.7.0
|
|
* @category Function
|
|
* @sig (*... -> a) -> [*] -> a
|
|
* @param {Function} fn The function which will be called with `args`
|
|
* @param {Array} args The arguments to call `fn` with
|
|
* @return {*} result The result, equivalent to `fn(...args)`
|
|
* @see R.call, R.unapply
|
|
* @example
|
|
*
|
|
* const nums = [1, 2, 3, -99, 42, 6, 7];
|
|
* R.apply(Math.max, nums); //=> 42
|
|
* @symb R.apply(f, [a, b, c]) = f(a, b, c)
|
|
*/
|
|
var apply = _curry2(function apply(fn, args) {
|
|
return fn.apply(this, args);
|
|
});
|
|
export default apply;
|