"use strict"; exports.__esModule = true; exports["default"] = void 0; var _ramda = require("ramda"); /** * Weaves a configuration into function returning the runnable monad like `Reader` or `Free`. * This allows us to pre-bind the configuration in advance and use the weaved function * without need to explicitly pass the configuration on every call. * * @func weave * @memberOf RA * @since {@link https://char0n.github.io/ramda-adjunct/1.7.0|v1.7.0} * @category Function * @sig (*... -> *) -> * -> (*... -> *) * @param {Function} fn The function to weave * @param {*} config The configuration to weave into fn * @return {Function} Auto-curried weaved function * @example * * const { Reader: reader } = require('monet'); * * const log = value => reader( * config => config.log(value) * ); * * // no weaving * log('test').run(console); //=> prints 'test' * * // weaving * const wlog = RA.weave(log, console); * wlog('test'); //=> prints 'test' */ var weave = (0, _ramda.curryN)(2, function (fn, config) { return (0, _ramda.curryN)(fn.length, function () { return fn.apply(void 0, arguments).run(config); }); }); var _default = weave; exports["default"] = _default;