swc/bundler/tests/.cache/deno/45324c0f4edb746a00b6b785537bf663118d4762.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

35 lines
1003 B
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/thunkify.js
import curryN from './curryN.js';
import _curry1 from './internal/_curry1.js';
/**
* Creates a thunk out of a function. A thunk delays a calculation until
* its result is needed, providing lazy evaluation of arguments.
*
* @func
* @memberOf R
* @since v0.26.0
* @category Function
* @sig ((a, b, ..., j) -> k) -> (a, b, ..., j) -> (() -> k)
* @param {Function} fn A function to wrap in a thunk
* @return {Function} Expects arguments for `fn` and returns a new function
* that, when called, applies those arguments to `fn`.
* @see R.partial, R.partialRight
* @example
*
* R.thunkify(R.identity)(42)(); //=> 42
* R.thunkify((a, b) => a + b)(25, 17)(); //=> 42
*/
var thunkify = _curry1(function thunkify(fn) {
return curryN(fn.length, function createThunk() {
var fnArgs = arguments;
return function invokeThunk() {
return fn.apply(this, fnArgs);
};
});
});
export default thunkify;