es-toolkit 1.21.0-dev.681 → 1.21.0-dev.683

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,6 +57,7 @@ export { unary } from '../function/unary.mjs';
57
57
  export { partial } from '../function/partial.mjs';
58
58
  export { partialRight } from '../function/partialRight.mjs';
59
59
  export { flow } from '../function/flow.mjs';
60
+ export { flowRight } from '../function/flowRight.mjs';
60
61
  export { mean } from '../math/mean.mjs';
61
62
  export { meanBy } from '../math/meanBy.mjs';
62
63
  export { randomInt } from '../math/randomInt.mjs';
@@ -57,6 +57,7 @@ export { unary } from '../function/unary.js';
57
57
  export { partial } from '../function/partial.js';
58
58
  export { partialRight } from '../function/partialRight.js';
59
59
  export { flow } from '../function/flow.js';
60
+ export { flowRight } from '../function/flowRight.js';
60
61
  export { mean } from '../math/mean.js';
61
62
  export { meanBy } from '../math/meanBy.js';
62
63
  export { randomInt } from '../math/randomInt.js';
@@ -4,7 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const zipWith = require('../_chunk/zipWith-EOU_KZ.js');
6
6
  const promise_index = require('../_chunk/index-BGZDR9.js');
7
- const flow = require('../_chunk/flow-Au34h2.js');
7
+ const flowRight = require('../_chunk/flowRight-BzdOZX.js');
8
8
  const range = require('../_chunk/range-BXlMmn.js');
9
9
  const randomInt = require('../_chunk/randomInt-CF7bZK.js');
10
10
  const toMerged = require('../_chunk/toMerged-2WPeoI.js');
@@ -794,7 +794,7 @@ function ary(func, n = func.length, guard) {
794
794
  if (Number.isNaN(n) || n < 0) {
795
795
  n = 0;
796
796
  }
797
- return flow.ary(func, n);
797
+ return flowRight.ary(func, n);
798
798
  }
799
799
 
800
800
  function bind(func, thisObj, ...partialArgs) {
@@ -861,7 +861,7 @@ function rest(func, start = func.length - 1) {
861
861
  if (Number.isNaN(start) || start < 0) {
862
862
  start = func.length - 1;
863
863
  }
864
- return flow.rest(func, start);
864
+ return flowRight.rest(func, start);
865
865
  }
866
866
 
867
867
  function spread(func, argsIndex = 0) {
@@ -969,7 +969,7 @@ function debounce(func, debounceMs = 0, options = {}) {
969
969
  }
970
970
  let result = undefined;
971
971
  let pendingAt = null;
972
- const _debounced = flow.debounce(function (...args) {
972
+ const _debounced = flowRight.debounce(function (...args) {
973
973
  result = func.apply(this, args);
974
974
  pendingAt = null;
975
975
  }, debounceMs, { signal, edges });
@@ -1281,7 +1281,7 @@ function mergeWithDeep(target, source, merge, stack) {
1281
1281
  }
1282
1282
 
1283
1283
  function merge(object, ...sources) {
1284
- return mergeWith(object, ...sources, flow.noop);
1284
+ return mergeWith(object, ...sources, flowRight.noop);
1285
1285
  }
1286
1286
 
1287
1287
  function isArrayLike(value) {
@@ -1771,16 +1771,17 @@ exports.TimeoutError = promise_index.TimeoutError;
1771
1771
  exports.delay = promise_index.delay;
1772
1772
  exports.timeout = promise_index.timeout;
1773
1773
  exports.withTimeout = promise_index.withTimeout;
1774
- exports.after = flow.after;
1775
- exports.before = flow.before;
1776
- exports.flow = flow.flow;
1777
- exports.memoize = flow.memoize;
1778
- exports.negate = flow.negate;
1779
- exports.noop = flow.noop;
1780
- exports.once = flow.once;
1781
- exports.partial = flow.partial;
1782
- exports.partialRight = flow.partialRight;
1783
- exports.unary = flow.unary;
1774
+ exports.after = flowRight.after;
1775
+ exports.before = flowRight.before;
1776
+ exports.flow = flowRight.flow;
1777
+ exports.flowRight = flowRight.flowRight;
1778
+ exports.memoize = flowRight.memoize;
1779
+ exports.negate = flowRight.negate;
1780
+ exports.noop = flowRight.noop;
1781
+ exports.once = flowRight.once;
1782
+ exports.partial = flowRight.partial;
1783
+ exports.partialRight = flowRight.partialRight;
1784
+ exports.unary = flowRight.unary;
1784
1785
  exports.mean = range.mean;
1785
1786
  exports.meanBy = range.meanBy;
1786
1787
  exports.range = range.range;
@@ -57,6 +57,7 @@ export { unary } from '../function/unary.mjs';
57
57
  export { partial } from '../function/partial.mjs';
58
58
  export { partialRight } from '../function/partialRight.mjs';
59
59
  export { flow } from '../function/flow.mjs';
60
+ export { flowRight } from '../function/flowRight.mjs';
60
61
  export { mean } from '../math/mean.mjs';
61
62
  export { meanBy } from '../math/meanBy.mjs';
62
63
  export { randomInt } from '../math/randomInt.mjs';
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
2
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
3
+ *
4
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
3
5
  *
4
6
  * @param {() => R} f The function to invoke.
5
7
  * @returns {() => R} Returns the new composite function.
@@ -14,7 +16,9 @@
14
16
  */
15
17
  declare function flow<R>(f: () => R): () => R;
16
18
  /**
17
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
19
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
20
+ *
21
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
18
22
  *
19
23
  * @param {(...args: A) => R} f1 The function to invoke.
20
24
  * @returns {(...args: A) => R} Returns the new composite function.
@@ -29,7 +33,9 @@ declare function flow<R>(f: () => R): () => R;
29
33
  */
30
34
  declare function flow<A extends any[], R>(f1: (...args: A) => R): (...args: A) => R;
31
35
  /**
32
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
36
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
37
+ *
38
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
33
39
  *
34
40
  * @param {(...args: A) => R1} f1 The function to invoke.
35
41
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -44,7 +50,9 @@ declare function flow<A extends any[], R>(f1: (...args: A) => R): (...args: A) =
44
50
  */
45
51
  declare function flow<A extends any[], R1, R2>(f1: (...args: A) => R1, f2: (a: R1) => R2): (...args: A) => R2;
46
52
  /**
47
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
53
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
54
+ *
55
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
48
56
  *
49
57
  * @param {(...args: A) => R1} f1 The function to invoke.
50
58
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -61,7 +69,9 @@ declare function flow<A extends any[], R1, R2>(f1: (...args: A) => R1, f2: (a: R
61
69
  */
62
70
  declare function flow<A extends any[], R1, R2, R3>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: A) => R3;
63
71
  /**
64
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
72
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
73
+ *
74
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
65
75
  *
66
76
  * @param {(...args: A) => R1} f1 The function to invoke.
67
77
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -80,7 +90,9 @@ declare function flow<A extends any[], R1, R2, R3>(f1: (...args: A) => R1, f2: (
80
90
  */
81
91
  declare function flow<A extends any[], R1, R2, R3, R4>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: A) => R4;
82
92
  /**
83
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
93
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
94
+ *
95
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
84
96
  *
85
97
  * @param {(...args: A) => R1} f1 The function to invoke.
86
98
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -101,7 +113,9 @@ declare function flow<A extends any[], R1, R2, R3, R4>(f1: (...args: A) => R1, f
101
113
  */
102
114
  declare function flow<A extends any[], R1, R2, R3, R4, R5>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: A) => R5;
103
115
  /**
104
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
116
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
117
+ *
118
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
105
119
  *
106
120
  * @param {Array<(...args: any[]) => any>} funcs The functions to invoke.
107
121
  * @returns {(...args: any[]) => any} Returns the new composite function.
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
2
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
3
+ *
4
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
3
5
  *
4
6
  * @param {() => R} f The function to invoke.
5
7
  * @returns {() => R} Returns the new composite function.
@@ -14,7 +16,9 @@
14
16
  */
15
17
  declare function flow<R>(f: () => R): () => R;
16
18
  /**
17
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
19
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
20
+ *
21
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
18
22
  *
19
23
  * @param {(...args: A) => R} f1 The function to invoke.
20
24
  * @returns {(...args: A) => R} Returns the new composite function.
@@ -29,7 +33,9 @@ declare function flow<R>(f: () => R): () => R;
29
33
  */
30
34
  declare function flow<A extends any[], R>(f1: (...args: A) => R): (...args: A) => R;
31
35
  /**
32
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
36
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
37
+ *
38
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
33
39
  *
34
40
  * @param {(...args: A) => R1} f1 The function to invoke.
35
41
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -44,7 +50,9 @@ declare function flow<A extends any[], R>(f1: (...args: A) => R): (...args: A) =
44
50
  */
45
51
  declare function flow<A extends any[], R1, R2>(f1: (...args: A) => R1, f2: (a: R1) => R2): (...args: A) => R2;
46
52
  /**
47
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
53
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
54
+ *
55
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
48
56
  *
49
57
  * @param {(...args: A) => R1} f1 The function to invoke.
50
58
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -61,7 +69,9 @@ declare function flow<A extends any[], R1, R2>(f1: (...args: A) => R1, f2: (a: R
61
69
  */
62
70
  declare function flow<A extends any[], R1, R2, R3>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: A) => R3;
63
71
  /**
64
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
72
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
73
+ *
74
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
65
75
  *
66
76
  * @param {(...args: A) => R1} f1 The function to invoke.
67
77
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -80,7 +90,9 @@ declare function flow<A extends any[], R1, R2, R3>(f1: (...args: A) => R1, f2: (
80
90
  */
81
91
  declare function flow<A extends any[], R1, R2, R3, R4>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: A) => R4;
82
92
  /**
83
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
93
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
94
+ *
95
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
84
96
  *
85
97
  * @param {(...args: A) => R1} f1 The function to invoke.
86
98
  * @param {(a: R1) => R2} f2 The function to invoke.
@@ -101,7 +113,9 @@ declare function flow<A extends any[], R1, R2, R3, R4>(f1: (...args: A) => R1, f
101
113
  */
102
114
  declare function flow<A extends any[], R1, R2, R3, R4, R5>(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: A) => R5;
103
115
  /**
104
- * Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive invocation is supplied the return value of the previous.
116
+ * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function.
117
+ *
118
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
105
119
  *
106
120
  * @param {Array<(...args: any[]) => any>} funcs The functions to invoke.
107
121
  * @returns {(...args: any[]) => any} Returns the new composite function.
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
3
+ *
4
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
5
+ *
6
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
7
+ *
8
+ * @param {() => R} f The function to invoke.
9
+ * @returns {() => R} Returns the new composite function.
10
+ *
11
+ * @example
12
+ * function noArgFunc() {
13
+ * return 42;
14
+ * }
15
+ * const combined = flowRight(noArgFunc);
16
+ * console.log(combined()); // 42
17
+ */
18
+ declare function flowRight<R>(f: () => R): () => R;
19
+ /**
20
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
21
+ *
22
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
23
+ *
24
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
25
+ *
26
+ * @param {(...args: A) => R} f1 The function to invoke.
27
+ * @returns {(...args: A) => R} Returns the new composite function.
28
+ *
29
+ * @example
30
+ * function oneArgFunc(a: number) {
31
+ * return a * 2;
32
+ * }
33
+ * const combined = flowRight(oneArgFunc);
34
+ * console.log(combined(5)); // 10
35
+ */
36
+ declare function flowRight<A extends any[], R>(f1: (...args: A) => R): (...args: A) => R;
37
+ /**
38
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
39
+ *
40
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
41
+ *
42
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
43
+ *
44
+ * @param {(a: R1) => R2} f2 The function to invoke.
45
+ * @param {(...args: A) => R1} f1 The function to invoke.
46
+ * @returns {(...args: A) => R2} Returns the new composite function.
47
+ *
48
+ * @example
49
+ * const add = (x: number, y: number) => x + y;
50
+ * const square = (n: number) => n * n;
51
+ *
52
+ * const combined = flowRight(square, add);
53
+ * console.log(combined(1, 2)); // 9
54
+ */
55
+ declare function flowRight<A extends any[], R1, R2>(f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R2;
56
+ /**
57
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
58
+ *
59
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
60
+ *
61
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
62
+ *
63
+ * @param {(a: R2) => R3} f3 The function to invoke.
64
+ * @param {(a: R1) => R2} f2 The function to invoke.
65
+ * @param {(...args: A) => R1} f1 The function to invoke.
66
+ * @returns {(...args: A) => R3} Returns the new composite function.
67
+ *
68
+ * @example
69
+ * const add = (x: number, y: number) => x + y;
70
+ * const square = (n: number) => n * n;
71
+ * const double = (n: number) => n * 2;
72
+ *
73
+ * const combined = flowRight(double, square, add);
74
+ * console.log(combined(1, 2)); // 18
75
+ */
76
+ declare function flowRight<A extends any[], R1, R2, R3>(f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R3;
77
+ /**
78
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
79
+ *
80
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
81
+ *
82
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
83
+ *
84
+ * @param {(a: R3) => R4} f4 The function to invoke.
85
+ * @param {(a: R2) => R3} f3 The function to invoke.
86
+ * @param {(a: R1) => R2} f2 The function to invoke.
87
+ * @param {(...args: A) => R1} f1 The function to invoke.
88
+ * @returns {(...args: A) => R4} Returns the new composite function.
89
+ *
90
+ * @example
91
+ * const add = (x: number, y: number) => x + y;
92
+ * const square = (n: number) => n * n;
93
+ * const double = (n: number) => n * 2;
94
+ * const toStr = (n: number) => n.toString();
95
+ *
96
+ * const combined = flowRight(toStr, double, square, add);
97
+ * console.log(combined(1, 2)); // '18'
98
+ */
99
+ declare function flowRight<A extends any[], R1, R2, R3, R4>(f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R4;
100
+ /**
101
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
102
+ *
103
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
104
+ *
105
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
106
+ *
107
+ * @param {(a: R4) => R5} f5 The function to invoke.
108
+ * @param {(a: R3) => R4} f4 The function to invoke.
109
+ * @param {(a: R2) => R3} f3 The function to invoke.
110
+ * @param {(a: R1) => R2} f2 The function to invoke.
111
+ * @param {(...args: A) => R1} f1 The function to invoke.
112
+ * @returns {(...args: A) => R5} Returns the new composite function.
113
+ *
114
+ * @example
115
+ * const add = (x: number, y: number) => x + y;
116
+ * const square = (n: number) => n * n;
117
+ * const double = (n: number) => n * 2;
118
+ * const toStr = (n: number) => n.toString();
119
+ * const split = (s: string) => s.split('');
120
+ *
121
+ * const combined = flowRight(split, toStr, double, square, add);
122
+ * console.log(combined(1, 2)); // ['1', '8']
123
+ */
124
+ declare function flowRight<A extends any[], R1, R2, R3, R4, R5>(f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R5;
125
+ /**
126
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
127
+ *
128
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
129
+ *
130
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
131
+ *
132
+ * @param {(...args: any[]) => any} funcs The functions to invoke.
133
+ * @returns {(...args: any[]) => any} Returns the new composite function.
134
+ *
135
+ * @example
136
+ * const add = (x: number, y: number) => x + y;
137
+ * const square = (n: number) => n * n;
138
+ *
139
+ * const combined = flowRight(square, add);
140
+ * console.log(combined(1, 2)); // 9
141
+ */
142
+ declare function flowRight(...funcs: Array<(...args: any[]) => any>): (...args: any[]) => any;
143
+
144
+ export { flowRight };
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
3
+ *
4
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
5
+ *
6
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
7
+ *
8
+ * @param {() => R} f The function to invoke.
9
+ * @returns {() => R} Returns the new composite function.
10
+ *
11
+ * @example
12
+ * function noArgFunc() {
13
+ * return 42;
14
+ * }
15
+ * const combined = flowRight(noArgFunc);
16
+ * console.log(combined()); // 42
17
+ */
18
+ declare function flowRight<R>(f: () => R): () => R;
19
+ /**
20
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
21
+ *
22
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
23
+ *
24
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
25
+ *
26
+ * @param {(...args: A) => R} f1 The function to invoke.
27
+ * @returns {(...args: A) => R} Returns the new composite function.
28
+ *
29
+ * @example
30
+ * function oneArgFunc(a: number) {
31
+ * return a * 2;
32
+ * }
33
+ * const combined = flowRight(oneArgFunc);
34
+ * console.log(combined(5)); // 10
35
+ */
36
+ declare function flowRight<A extends any[], R>(f1: (...args: A) => R): (...args: A) => R;
37
+ /**
38
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
39
+ *
40
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
41
+ *
42
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
43
+ *
44
+ * @param {(a: R1) => R2} f2 The function to invoke.
45
+ * @param {(...args: A) => R1} f1 The function to invoke.
46
+ * @returns {(...args: A) => R2} Returns the new composite function.
47
+ *
48
+ * @example
49
+ * const add = (x: number, y: number) => x + y;
50
+ * const square = (n: number) => n * n;
51
+ *
52
+ * const combined = flowRight(square, add);
53
+ * console.log(combined(1, 2)); // 9
54
+ */
55
+ declare function flowRight<A extends any[], R1, R2>(f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R2;
56
+ /**
57
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
58
+ *
59
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
60
+ *
61
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
62
+ *
63
+ * @param {(a: R2) => R3} f3 The function to invoke.
64
+ * @param {(a: R1) => R2} f2 The function to invoke.
65
+ * @param {(...args: A) => R1} f1 The function to invoke.
66
+ * @returns {(...args: A) => R3} Returns the new composite function.
67
+ *
68
+ * @example
69
+ * const add = (x: number, y: number) => x + y;
70
+ * const square = (n: number) => n * n;
71
+ * const double = (n: number) => n * 2;
72
+ *
73
+ * const combined = flowRight(double, square, add);
74
+ * console.log(combined(1, 2)); // 18
75
+ */
76
+ declare function flowRight<A extends any[], R1, R2, R3>(f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R3;
77
+ /**
78
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
79
+ *
80
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
81
+ *
82
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
83
+ *
84
+ * @param {(a: R3) => R4} f4 The function to invoke.
85
+ * @param {(a: R2) => R3} f3 The function to invoke.
86
+ * @param {(a: R1) => R2} f2 The function to invoke.
87
+ * @param {(...args: A) => R1} f1 The function to invoke.
88
+ * @returns {(...args: A) => R4} Returns the new composite function.
89
+ *
90
+ * @example
91
+ * const add = (x: number, y: number) => x + y;
92
+ * const square = (n: number) => n * n;
93
+ * const double = (n: number) => n * 2;
94
+ * const toStr = (n: number) => n.toString();
95
+ *
96
+ * const combined = flowRight(toStr, double, square, add);
97
+ * console.log(combined(1, 2)); // '18'
98
+ */
99
+ declare function flowRight<A extends any[], R1, R2, R3, R4>(f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R4;
100
+ /**
101
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
102
+ *
103
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
104
+ *
105
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
106
+ *
107
+ * @param {(a: R4) => R5} f5 The function to invoke.
108
+ * @param {(a: R3) => R4} f4 The function to invoke.
109
+ * @param {(a: R2) => R3} f3 The function to invoke.
110
+ * @param {(a: R1) => R2} f2 The function to invoke.
111
+ * @param {(...args: A) => R1} f1 The function to invoke.
112
+ * @returns {(...args: A) => R5} Returns the new composite function.
113
+ *
114
+ * @example
115
+ * const add = (x: number, y: number) => x + y;
116
+ * const square = (n: number) => n * n;
117
+ * const double = (n: number) => n * 2;
118
+ * const toStr = (n: number) => n.toString();
119
+ * const split = (s: string) => s.split('');
120
+ *
121
+ * const combined = flowRight(split, toStr, double, square, add);
122
+ * console.log(combined(1, 2)); // ['1', '8']
123
+ */
124
+ declare function flowRight<A extends any[], R1, R2, R3, R4, R5>(f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R5;
125
+ /**
126
+ * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function.
127
+ *
128
+ * The `this` context of the returned function is also passed to the functions provided as parameters.
129
+ *
130
+ * This method is like `flow` except that it creates a function that invokes the given functions from right to left.
131
+ *
132
+ * @param {(...args: any[]) => any} funcs The functions to invoke.
133
+ * @returns {(...args: any[]) => any} Returns the new composite function.
134
+ *
135
+ * @example
136
+ * const add = (x: number, y: number) => x + y;
137
+ * const square = (n: number) => n * n;
138
+ *
139
+ * const combined = flowRight(square, add);
140
+ * console.log(combined(1, 2)); // 9
141
+ */
142
+ declare function flowRight(...funcs: Array<(...args: any[]) => any>): (...args: any[]) => any;
143
+
144
+ export { flowRight };
@@ -0,0 +1,7 @@
1
+ import { flow } from './flow.mjs';
2
+
3
+ function flowRight(...funcs) {
4
+ return flow(...funcs.reverse());
5
+ }
6
+
7
+ export { flowRight };
@@ -14,3 +14,4 @@ export { rest } from './rest.mjs';
14
14
  export { curry } from './curry.mjs';
15
15
  export { spread } from './spread.mjs';
16
16
  export { flow } from './flow.mjs';
17
+ export { flowRight } from './flowRight.mjs';
@@ -14,3 +14,4 @@ export { rest } from './rest.js';
14
14
  export { curry } from './curry.js';
15
15
  export { spread } from './spread.js';
16
16
  export { flow } from './flow.js';
17
+ export { flowRight } from './flowRight.js';
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const flow = require('../_chunk/flow-Au34h2.js');
5
+ const flowRight = require('../_chunk/flowRight-BzdOZX.js');
6
6
 
7
7
  function throttle(func, throttleMs, { signal, edges = ['leading', 'trailing'] } = {}) {
8
8
  let pendingAt = null;
9
- const debounced = flow.debounce(func, throttleMs, { signal, edges });
9
+ const debounced = flowRight.debounce(func, throttleMs, { signal, edges });
10
10
  const throttled = function (...args) {
11
11
  if (pendingAt == null) {
12
12
  pendingAt = Date.now();
@@ -51,19 +51,20 @@ function spread(func) {
51
51
  };
52
52
  }
53
53
 
54
- exports.after = flow.after;
55
- exports.ary = flow.ary;
56
- exports.before = flow.before;
57
- exports.debounce = flow.debounce;
58
- exports.flow = flow.flow;
59
- exports.memoize = flow.memoize;
60
- exports.negate = flow.negate;
61
- exports.noop = flow.noop;
62
- exports.once = flow.once;
63
- exports.partial = flow.partial;
64
- exports.partialRight = flow.partialRight;
65
- exports.rest = flow.rest;
66
- exports.unary = flow.unary;
54
+ exports.after = flowRight.after;
55
+ exports.ary = flowRight.ary;
56
+ exports.before = flowRight.before;
57
+ exports.debounce = flowRight.debounce;
58
+ exports.flow = flowRight.flow;
59
+ exports.flowRight = flowRight.flowRight;
60
+ exports.memoize = flowRight.memoize;
61
+ exports.negate = flowRight.negate;
62
+ exports.noop = flowRight.noop;
63
+ exports.once = flowRight.once;
64
+ exports.partial = flowRight.partial;
65
+ exports.partialRight = flowRight.partialRight;
66
+ exports.rest = flowRight.rest;
67
+ exports.unary = flowRight.unary;
67
68
  exports.curry = curry;
68
69
  exports.spread = spread;
69
70
  exports.throttle = throttle;
@@ -14,3 +14,4 @@ export { rest } from './rest.mjs';
14
14
  export { curry } from './curry.mjs';
15
15
  export { spread } from './spread.mjs';
16
16
  export { flow } from './flow.mjs';
17
+ export { flowRight } from './flowRight.mjs';
package/dist/index.d.mts CHANGED
@@ -72,6 +72,7 @@ export { rest } from './function/rest.mjs';
72
72
  export { curry } from './function/curry.mjs';
73
73
  export { spread } from './function/spread.mjs';
74
74
  export { flow } from './function/flow.mjs';
75
+ export { flowRight } from './function/flowRight.mjs';
75
76
  export { clamp } from './math/clamp.mjs';
76
77
  export { inRange } from './math/inRange.mjs';
77
78
  export { mean } from './math/mean.mjs';
package/dist/index.d.ts CHANGED
@@ -72,6 +72,7 @@ export { rest } from './function/rest.js';
72
72
  export { curry } from './function/curry.js';
73
73
  export { spread } from './function/spread.js';
74
74
  export { flow } from './function/flow.js';
75
+ export { flowRight } from './function/flowRight.js';
75
76
  export { clamp } from './math/clamp.js';
76
77
  export { inRange } from './math/inRange.js';
77
78
  export { mean } from './math/mean.js';