UNPKG

eris-keys

Version:

a JavaScript client library for eris-keys

38 lines (35 loc) 1.23 kB
var curry = require('./curry'); /** * Returns the result of calling its first argument with the remaining * arguments. This is occasionally useful as a converging function for * `R.converge`: the left branch can produce a function while the right branch * produces a value to be passed to that function as an argument. * * @func * @memberOf R * @since v0.9.0 * @category Function * @sig (*... -> a),*... -> a * @param {Function} fn The function to apply to the remaining arguments. * @param {...*} args Any number of positional arguments. * @return {*} * @see R.apply * @example * * R.call(R.add, 1, 2); //=> 3 * * var indentN = R.pipe(R.times(R.always(' ')), * R.join(''), * R.replace(/^(?!$)/gm)); * * var format = R.converge(R.call, [ * R.pipe(R.prop('indent'), indentN), * R.prop('value') * ]); * * format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' * @symb R.call(f, a, b) = f(a, b) */ module.exports = curry(function call(fn) { return fn.apply(this, Array.prototype.slice.call(arguments, 1)); });