source: node_modules/ramda-adjunct/lib/liftF.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[d24f17c]1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6var _liftFN = _interopRequireDefault(require("./liftFN"));
7function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
8/**
9 * "lifts" a function to be the specified arity, so that it may "map over" objects that satisfy
10 * the fantasy land Apply spec of algebraic structures.
11 *
12 * Lifting is specific for {@link https://github.com/scalaz/scalaz|scalaz} and {@link http://functionaljava.org/|function Java} implementations.
13 * Old version of fantasy land spec were not compatible with this approach,
14 * but as of fantasy land 1.0.0 Apply spec also adopted this approach.
15 *
16 * This function acts as interop for ramda <= 0.23.0 and {@link https://monet.github.io/monet.js/|monet.js}.
17 *
18 * More info {@link https://github.com/fantasyland/fantasy-land/issues/50|here}.
19 *
20 * @func liftF
21 * @memberOf RA
22 * @since {@link https://char0n.github.io/ramda-adjunct/1.2.0|v1.2.0}
23 * @category Function
24 * @sig Apply a => (a... -> a) -> (a... -> a)
25 * @param {Function} fn The function to lift into higher context
26 * @return {Function} The lifted function
27 * @see {@link RA.liftFN|liftFN}
28 * @example
29 *
30 * const { Maybe } = require('monet');
31 *
32 * const add3 = (a, b, c) => a + b + c;
33 * const madd3 = RA.liftF(add3);
34 *
35 * madd3(Maybe.Some(10), Maybe.Some(15), Maybe.Some(17)); //=> Maybe.Some(42)
36 * madd3(Maybe.Some(10), Maybe.Nothing(), Maybe.Some(17)); //=> Maybe.Nothing()
37 */
38var liftF = (0, _ramda.curryN)(1, function (fn) {
39 return (0, _liftFN["default"])(fn.length, fn);
40});
41var _default = liftF;
42exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.