UNPKG

1.02 kBJavaScriptView Raw
1var _arity =
2/*#__PURE__*/
3require("./internal/_arity");
4
5var _pipeP =
6/*#__PURE__*/
7require("./internal/_pipeP");
8
9var reduce =
10/*#__PURE__*/
11require("./reduce");
12
13var tail =
14/*#__PURE__*/
15require("./tail");
16/**
17 * Performs left-to-right composition of one or more Promise-returning
18 * functions. The first argument may have any arity; the remaining arguments
19 * must be unary.
20 *
21 * @func
22 * @memberOf R
23 * @since v0.10.0
24 * @category Function
25 * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z)
26 * @param {...Function} functions
27 * @return {Function}
28 * @see R.composeP
29 * @deprecated since v0.26.0
30 * @example
31 *
32 * // followersForUser :: String -> Promise [User]
33 * const followersForUser = R.pipeP(db.getUserById, db.getFollowers);
34 */
35
36
37function pipeP() {
38 if (arguments.length === 0) {
39 throw new Error('pipeP requires at least one argument');
40 }
41
42 return _arity(arguments[0].length, reduce(_pipeP, arguments[0], tail(arguments)));
43}
44
45module.exports = pipeP;
\No newline at end of file