es-toolkit 1.35.0 → 1.36.0-dev.1215

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/_chunk/{isPromise-ByAybB.js → isPromise-CxqI1v.js} +122 -36
  3. package/dist/_chunk/{reverseString-D-wK2p.js → reverseString-BixeGz.js} +84 -13
  4. package/dist/_chunk/toSnakeCaseKeys-DZO2eB.js +4901 -0
  5. package/dist/_chunk/{unary-BsNWRM.js → unary-EIEhcF.js} +46 -0
  6. package/dist/_chunk/{zip-_HttSl.js → zip-BJSrRi.js} +38 -57
  7. package/dist/array/index.js +55 -6
  8. package/dist/array/pullAt.d.mts +0 -2
  9. package/dist/array/pullAt.d.ts +0 -2
  10. package/dist/array/take.d.mts +1 -1
  11. package/dist/array/take.d.ts +1 -1
  12. package/dist/array/take.mjs +4 -1
  13. package/dist/array/takeRight.d.mts +1 -1
  14. package/dist/array/takeRight.d.ts +1 -1
  15. package/dist/array/takeRight.mjs +5 -2
  16. package/dist/browser.global.js +1 -1
  17. package/dist/browser.global.js.map +1 -1
  18. package/dist/compat/_internal/copyArray.mjs +12 -0
  19. package/dist/compat/_internal/mapToEntries.mjs +11 -0
  20. package/dist/compat/_internal/setToEntries.mjs +11 -0
  21. package/dist/compat/_internal/toKey.mjs +2 -2
  22. package/dist/compat/array/find.mjs +3 -3
  23. package/dist/compat/array/findLast.mjs +2 -2
  24. package/dist/compat/array/flatMap.d.mts +20 -0
  25. package/dist/compat/array/flatMap.d.ts +20 -0
  26. package/dist/compat/array/flatMap.mjs +13 -0
  27. package/dist/compat/array/forEachRight.d.mts +106 -0
  28. package/dist/compat/array/forEachRight.d.ts +106 -0
  29. package/dist/compat/array/forEachRight.mjs +21 -0
  30. package/dist/compat/array/groupBy.d.mts +55 -0
  31. package/dist/compat/array/groupBy.d.ts +55 -0
  32. package/dist/compat/array/groupBy.mjs +15 -0
  33. package/dist/compat/array/partition.d.mts +65 -0
  34. package/dist/compat/array/partition.d.ts +65 -0
  35. package/dist/compat/array/partition.mjs +24 -0
  36. package/dist/compat/array/pullAllWith.d.mts +59 -0
  37. package/dist/compat/array/pullAllWith.d.ts +59 -0
  38. package/dist/compat/array/pullAllWith.mjs +33 -0
  39. package/dist/compat/array/pullAt.d.mts +32 -0
  40. package/dist/compat/array/pullAt.d.ts +32 -0
  41. package/dist/compat/array/pullAt.mjs +34 -0
  42. package/dist/compat/compat.d.mts +310 -0
  43. package/dist/compat/compat.d.ts +310 -0
  44. package/dist/compat/compat.mjs +312 -0
  45. package/dist/compat/function/partial.d.mts +575 -0
  46. package/dist/compat/function/partial.d.ts +575 -0
  47. package/dist/compat/function/partial.mjs +8 -0
  48. package/dist/compat/function/partialRight.d.mts +651 -0
  49. package/dist/compat/function/partialRight.d.ts +651 -0
  50. package/dist/compat/function/partialRight.mjs +8 -0
  51. package/dist/compat/index.d.mts +16 -7
  52. package/dist/compat/index.d.ts +16 -7
  53. package/dist/compat/index.js +290 -3771
  54. package/dist/compat/index.mjs +19 -8
  55. package/dist/compat/object/defaults.mjs +7 -1
  56. package/dist/compat/object/forIn.d.mts +58 -0
  57. package/dist/compat/object/forIn.d.ts +58 -0
  58. package/dist/compat/object/forIn.mjs +16 -0
  59. package/dist/compat/object/forInRight.d.mts +58 -0
  60. package/dist/compat/object/forInRight.d.ts +58 -0
  61. package/dist/compat/object/forInRight.mjs +21 -0
  62. package/dist/compat/object/forOwn.d.mts +54 -0
  63. package/dist/compat/object/forOwn.d.ts +54 -0
  64. package/dist/compat/object/forOwn.mjs +19 -0
  65. package/dist/compat/object/forOwnRight.d.mts +54 -0
  66. package/dist/compat/object/forOwnRight.d.ts +54 -0
  67. package/dist/compat/object/forOwnRight.mjs +19 -0
  68. package/dist/compat/object/hasIn.d.mts +40 -0
  69. package/dist/compat/object/hasIn.d.ts +40 -0
  70. package/dist/compat/object/hasIn.mjs +34 -0
  71. package/dist/compat/object/toPairs.mjs +7 -2
  72. package/dist/compat/object/toPairsIn.mjs +7 -2
  73. package/dist/compat/string/repeat.d.mts +1 -1
  74. package/dist/compat/string/repeat.d.ts +1 -1
  75. package/dist/compat/string/repeat.mjs +12 -2
  76. package/dist/compat/string/words.d.mts +1 -1
  77. package/dist/compat/string/words.d.ts +1 -1
  78. package/dist/compat/string/words.mjs +2 -1
  79. package/dist/compat/toolkit.d.mts +9 -0
  80. package/dist/compat/toolkit.d.ts +9 -0
  81. package/dist/compat/toolkit.mjs +10 -0
  82. package/dist/compat/util/overEvery.d.mts +67 -0
  83. package/dist/compat/util/overEvery.d.ts +67 -0
  84. package/dist/compat/util/overEvery.mjs +23 -0
  85. package/dist/compat/util/overSome.d.mts +69 -0
  86. package/dist/compat/util/overSome.d.ts +69 -0
  87. package/dist/compat/util/overSome.mjs +23 -0
  88. package/dist/function/index.js +3 -5
  89. package/dist/function/partial.d.mts +3 -3
  90. package/dist/function/partial.d.ts +3 -3
  91. package/dist/function/partial.mjs +17 -19
  92. package/dist/function/partialRight.d.mts +3 -3
  93. package/dist/function/partialRight.d.ts +3 -3
  94. package/dist/function/partialRight.mjs +18 -20
  95. package/dist/function/throttle.mjs +0 -1
  96. package/dist/index.js +39 -42
  97. package/dist/object/index.js +15 -15
  98. package/dist/object/toCamelCaseKeys.mjs +3 -0
  99. package/dist/object/toSnakeCaseKeys.mjs +3 -0
  100. package/dist/predicate/index.js +4 -5
  101. package/dist/string/index.js +7 -8
  102. package/package.json +1 -1
  103. package/dist/_chunk/isPlainObject-Xaozpc.js +0 -93
  104. package/dist/_chunk/partialRight-B0_CSB.js +0 -50
  105. package/dist/_chunk/snakeCase-BtVEeB.js +0 -75
  106. package/dist/_chunk/toSnakeCaseKeys-BNpS71.js +0 -569
@@ -0,0 +1,651 @@
1
+ /**
2
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
3
+ *
4
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
5
+ *
6
+ * Note: This method doesn't set the `length` property of partially applied functions.
7
+ *
8
+ * @template R The return type of the function.
9
+ * @param {() => R} func The function to invoke.
10
+ * @returns {() => R} Returns the new function.
11
+ * @example
12
+ * const getValue = () => 42;
13
+ * const getValueFunc = partialRight(getValue);
14
+ * console.log(getValueFunc()); // => 42
15
+ */
16
+ declare function partialRight<R>(func: () => R): () => R;
17
+ /**
18
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
19
+ *
20
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
21
+ *
22
+ * Note: This method doesn't set the `length` property of partially applied functions.
23
+ *
24
+ * @template T1 The type of the first argument.
25
+ * @template R The return type of the function.
26
+ * @param {(arg1: T1) => R} func The function to partially apply arguments to.
27
+ * @param {T1} arg1 The first argument to be partially applied.
28
+ * @returns {() => R} Returns the new partially applied function.
29
+ * @example
30
+ * const addOne = (num: number) => num + 1;
31
+ * const addOneFunc = partialRight(addOne, 1);
32
+ * console.log(addOneFunc()); // => 2
33
+ */
34
+ declare function partialRight<T1, R>(func: (arg1: T1) => R, arg1: T1): () => R;
35
+ /**
36
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
37
+ *
38
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
39
+ *
40
+ * Note: This method doesn't set the `length` property of partially applied functions.
41
+ *
42
+ * @template T1 The type of the first argument.
43
+ * @template R The return type of the function.
44
+ * @param {(arg1: T1) => R} func The function to partially apply arguments to.
45
+ * @returns {(arg1: T1) => R} Returns the new partially applied function.
46
+ * @example
47
+ * const multiplyBy = (factor: number) => (num: number) => num * factor;
48
+ * const double = partialRight(multiplyBy(2));
49
+ * console.log(double(5)); // => 10
50
+ */
51
+ declare function partialRight<T1, R>(func: (arg1: T1) => R): (arg1: T1) => R;
52
+ /**
53
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
54
+ *
55
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
56
+ *
57
+ * Note: This method doesn't set the `length` property of partially applied functions.
58
+ *
59
+ * @template T1 The type of the first argument.
60
+ * @template R The return type of the function.
61
+ * @param {(arg1: T1) => R} func The function to partially apply arguments to.
62
+ * @param {T1} arg1 The first argument to be partially applied.
63
+ * @returns {() => R} Returns the new partially applied function.
64
+ * @example
65
+ * const greet = (name: string) => `Hello, ${name}!`;
66
+ * const greetJohn = partialRight(greet, 'John');
67
+ * console.log(greetJohn()); // => 'Hello, John!'
68
+ */
69
+ declare function partialRight<T1, R>(func: (arg1: T1) => R, arg1: T1): () => R;
70
+ /**
71
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
72
+ *
73
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
74
+ *
75
+ * Note: This method doesn't set the `length` property of partially applied functions.
76
+ *
77
+ * @template T1 The type of the first argument.
78
+ * @template T2 The type of the second argument.
79
+ * @template R The return type of the function.
80
+ * @param {(arg1: T1, arg2: T2) => R} func The function to partially apply arguments to.
81
+ * @returns {(arg1: T1, arg2: T2) => R} Returns the new partially applied function.
82
+ * @example
83
+ * const subtract = (a: number, b: number) => a - b;
84
+ * const subtractFive = partialRight(subtract);
85
+ * console.log(subtractFive(10, 5)); // => 5
86
+ */
87
+ declare function partialRight<T1, T2, R>(func: (arg1: T1, arg2: T2) => R): (arg1: T1, arg2: T2) => R;
88
+ /**
89
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
90
+ *
91
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
92
+ *
93
+ * Note: This method doesn't set the `length` property of partially applied functions.
94
+ *
95
+ * @template T1 The type of the first argument.
96
+ * @template T2 The type of the second argument.
97
+ * @template R The return type of the function.
98
+ * @param {(arg1: T1, arg2: T2) => R} func The function to partially apply arguments to.
99
+ * @param {T1} arg1 The first argument to be partially applied.
100
+ * @param {Placeholder} arg2 The placeholder for the second argument.
101
+ * @returns {(arg2: T2) => R} Returns the new partially applied function.
102
+ * @example
103
+ * const concat = (a: string, b: string) => a + b;
104
+ * const concatWithHello = partialRight(concat, 'Hello', partialRight.placeholder);
105
+ * console.log(concatWithHello(' World!')); // => 'Hello World!'
106
+ */
107
+ declare function partialRight<T1, T2, R>(func: (arg1: T1, arg2: T2) => R, arg1: T1, arg2: Placeholder): (arg2: T2) => R;
108
+ /**
109
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
110
+ *
111
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
112
+ *
113
+ * Note: This method doesn't set the `length` property of partially applied functions.
114
+ *
115
+ * @template T1 The type of the first argument.
116
+ * @template T2 The type of the second argument.
117
+ * @template R The return type of the function.
118
+ * @param {(arg1: T1, arg2: T2) => R} func The function to partially apply arguments to.
119
+ * @param {T2} arg2 The second argument to be partially applied.
120
+ * @returns {(arg1: T1) => R} Returns the new partially applied function.
121
+ * @example
122
+ * const divide = (a: number, b: number) => a / b;
123
+ * const divideByTwo = partialRight(divide, 2);
124
+ * console.log(divideByTwo(10)); // => 5
125
+ */
126
+ declare function partialRight<T1, T2, R>(func: (arg1: T1, arg2: T2) => R, arg2: T2): (arg1: T1) => R;
127
+ /**
128
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
129
+ *
130
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
131
+ *
132
+ * Note: This method doesn't set the `length` property of partially applied functions.
133
+ *
134
+ * @template T1 The type of the first argument.
135
+ * @template T2 The type of the second argument.
136
+ * @template R The return type of the function.
137
+ * @param {(arg1: T1, arg2: T2) => R} func The function to partially apply arguments to.
138
+ * @param {T1} arg1 The first argument to be partially applied.
139
+ * @param {T2} arg2 The second argument to be partially applied.
140
+ * @returns {() => R} Returns the new partially applied function.
141
+ * @example
142
+ * const multiply = (a: number, b: number) => a * b;
143
+ * const multiplyByThreeAndFour = partialRight(multiply, 3, 4);
144
+ * console.log(multiplyByThreeAndFour()); // => 12
145
+ */
146
+ declare function partialRight<T1, T2, R>(func: (arg1: T1, arg2: T2) => R, arg1: T1, arg2: T2): () => R;
147
+ /**
148
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
149
+ *
150
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
151
+ *
152
+ * Note: This method doesn't set the `length` property of partially applied functions.
153
+ *
154
+ * @template T1 The type of the first argument.
155
+ * @template T2 The type of the second argument.
156
+ * @template T3 The type of the third argument.
157
+ * @template R The return type of the function.
158
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
159
+ * @returns {(arg1: T1, arg2: T2, arg3: T3) => R} Returns the new partially applied function.
160
+ * @example
161
+ * const sumThree = (a: number, b: number, c: number) => a + b + c;
162
+ * const sumWithFive = partialRight(sumThree);
163
+ * console.log(sumWithFive(1, 2, 5)); // => 8
164
+ */
165
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R): (arg1: T1, arg2: T2, arg3: T3) => R;
166
+ /**
167
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
168
+ *
169
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
170
+ *
171
+ * Note: This method doesn't set the `length` property of partially applied functions.
172
+ *
173
+ * @template T1 The type of the first argument.
174
+ * @template T2 The type of the second argument.
175
+ * @template T3 The type of the third argument.
176
+ * @template R The return type of the function.
177
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
178
+ * @param {T1} arg1 The first argument to be partially applied.
179
+ * @param {Placeholder} arg2 The placeholder for the second argument.
180
+ * @param {Placeholder} arg3 The placeholder for the third argument.
181
+ * @returns {(arg2: T2, arg3: T3) => R} Returns the new partially applied function.
182
+ * @example
183
+ * const formatDate = (day: number, month: number, year: number) => `${day}/${month}/${year}`;
184
+ * const formatDateWithDay = partialRight(formatDate, 1, partialRight.placeholder, partialRight.placeholder);
185
+ * console.log(formatDateWithDay(12, 2023)); // => '1/12/2023'
186
+ */
187
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: Placeholder, arg3: Placeholder): (arg2: T2, arg3: T3) => R;
188
+ /**
189
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
190
+ *
191
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
192
+ *
193
+ * Note: This method doesn't set the `length` property of partially applied functions.
194
+ *
195
+ * @template T1 The type of the first argument.
196
+ * @template T2 The type of the second argument.
197
+ * @template T3 The type of the third argument.
198
+ * @template R The return type of the function.
199
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
200
+ * @param {Placeholder} arg1 The placeholder for the first argument.
201
+ * @param {T2} arg2 The second argument to be partially applied.
202
+ * @param {Placeholder} arg3 The placeholder for the third argument.
203
+ * @returns {(arg1: T1, arg3: T3) => R} Returns a new function that takes the first and third arguments and returns the result of the original function.
204
+ * @example
205
+ * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`;
206
+ * const greetWithPlaceholder = partialRight(greet, 'Hello', partialRight.placeholder);
207
+ * console.log(greetWithPlaceholder('John')); // => 'Hello, John!'
208
+ */
209
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: Placeholder, arg2: T2, arg3: Placeholder): (arg1: T1, arg3: T3) => R;
210
+ /**
211
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
212
+ *
213
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
214
+ *
215
+ * Note: This method doesn't set the `length` property of partially applied functions.
216
+ *
217
+ * @template T1 The type of the first argument.
218
+ * @template T2 The type of the second argument.
219
+ * @template T3 The type of the third argument.
220
+ * @template R The return type of the function.
221
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
222
+ * @param {T2} arg2 The second argument to be partially applied.
223
+ * @param {Placeholder} arg3 The placeholder for the third argument.
224
+ * @returns {(arg1: T1, arg3: T3) => R} Returns the new partially applied function.
225
+ * @example
226
+ * const createUser = (name: string, age: number, country: string) => `${name}, ${age} years old from ${country}`;
227
+ * const createUserFromUSA = partialRight(createUser, 'USA', partialRight.placeholder);
228
+ * console.log(createUserFromUSA('John', 30)); // => 'John, 30 years old from USA'
229
+ */
230
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg2: T2, arg3: Placeholder): (arg1: T1, arg3: T3) => R;
231
+ /**
232
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
233
+ *
234
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
235
+ *
236
+ * Note: This method doesn't set the `length` property of partially applied functions.
237
+ *
238
+ * @template T1 The type of the first argument.
239
+ * @template T2 The type of the second argument.
240
+ * @template T3 The type of the third argument.
241
+ * @template R The return type of the function.
242
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
243
+ * @param {T1} arg1 The first argument to be partially applied.
244
+ * @param {T2} arg2 The second argument to be partially applied.
245
+ * @param {Placeholder} arg3 The placeholder for the third argument.
246
+ * @returns {(arg3: T3) => R} Returns the new partially applied function.
247
+ * @example
248
+ * const logMessage = (level: string, message: string, timestamp: string) => `[${level}] ${message} at ${timestamp}`;
249
+ * const logError = partialRight(logMessage, 'ERROR', '2023-10-01');
250
+ * console.log(logError('Something went wrong!')); // => '[ERROR] Something went wrong! at 2023-10-01'
251
+ */
252
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: T2, arg3: Placeholder): (arg3: T3) => R;
253
+ /**
254
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
255
+ *
256
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
257
+ *
258
+ * Note: This method doesn't set the `length` property of partially applied functions.
259
+ *
260
+ * @template T1 The type of the first argument.
261
+ * @template T2 The type of the second argument.
262
+ * @template T3 The type of the third argument.
263
+ * @template R The return type of the function.
264
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
265
+ * @param {T3} arg3 The third argument to be partially applied.
266
+ * @returns {(arg1: T1, arg2: T2) => R} Returns the new partially applied function.
267
+ * @example
268
+ * const calculateArea = (length: number, width: number) => length * width;
269
+ * const calculateAreaWithWidth = partialRight(calculateArea, 5);
270
+ * console.log(calculateAreaWithWidth(10)); // => 50
271
+ */
272
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg3: T3): (arg1: T1, arg2: T2) => R;
273
+ /**
274
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
275
+ *
276
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
277
+ *
278
+ * Note: This method doesn't set the `length` property of partially applied functions.
279
+ *
280
+ * @template T1 The type of the first argument.
281
+ * @template T2 The type of the second argument.
282
+ * @template T3 The type of the third argument.
283
+ * @template R The return type of the function.
284
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
285
+ * @param {T1} arg1 The first argument to be partially applied.
286
+ * @param {Placeholder} arg2 The placeholder for the second argument.
287
+ * @param {T3} arg3 The third argument to be partially applied.
288
+ * @returns {(arg2: T2) => R} Returns the new partially applied function.
289
+ * @example
290
+ * const formatCurrency = (amount: number, currency: string) => `${amount} ${currency}`;
291
+ * const formatUSD = partialRight(formatCurrency, 100, partialRight.placeholder);
292
+ * console.log(formatUSD('USD')); // => '100 USD'
293
+ */
294
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: Placeholder, arg3: T3): (arg2: T2) => R;
295
+ /**
296
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
297
+ *
298
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
299
+ *
300
+ * Note: This method doesn't set the `length` property of partially applied functions.
301
+ *
302
+ * @template T1 The type of the first argument.
303
+ * @template T2 The type of the second argument.
304
+ * @template T3 The type of the third argument.
305
+ * @template R The return type of the function.
306
+ * @param {(arg1: T1, arg2: T2, arg3: T3) => R} func The function to partially apply arguments to.
307
+ * @param {T2} arg2 The second argument to be partially applied.
308
+ * @param {T3} arg3 The third argument to be partially applied.
309
+ * @returns {(arg1: T1) => R} Returns the new partially applied function.
310
+ * @example
311
+ * const createProfile = (name: string, age: number, country: string) => `${name}, ${age} from ${country}`;
312
+ * const createProfileFromCanada = partialRight(createProfile, 'Canada', 'John');
313
+ * console.log(createProfileFromCanada(30)); // => 'John, 30 from Canada'
314
+ */
315
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg2: T2, arg3: T3): (arg1: T1) => R;
316
+ declare function partialRight<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: T2, arg3: T3): () => R;
317
+ /**
318
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
319
+ *
320
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
321
+ *
322
+ * Note: This method doesn't set the `length` property of partially applied functions.
323
+ *
324
+ * @template T1 The type of the first argument.
325
+ * @template T2 The type of the second argument.
326
+ * @template T3 The type of the third argument.
327
+ * @template T4 The type of the fourth argument.
328
+ * @template R The return type of the function.
329
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
330
+ * @returns {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} Returns a new function that takes four arguments.
331
+ */
332
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R;
333
+ /**
334
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
335
+ *
336
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
337
+ *
338
+ * Note: This method doesn't set the `length` property of partially applied functions.
339
+ *
340
+ * @template T1 The type of the first argument.
341
+ * @template T2 The type of the second argument.
342
+ * @template T3 The type of the third argument.
343
+ * @template T4 The type of the fourth argument.
344
+ * @template R The return type of the function.
345
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
346
+ * @param {T1} arg1 The first argument to be partially applied.
347
+ * @param {Placeholder} arg2 The placeholder for the second argument.
348
+ * @param {Placeholder} arg3 The placeholder for the third argument.
349
+ * @param {Placeholder} arg4 The placeholder for the fourth argument.
350
+ * @returns {(arg2: T2, arg3: T3, arg4: T4) => R} Returns a new function that takes the second, third, and fourth arguments.
351
+ */
352
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: Placeholder, arg3: Placeholder, arg4: Placeholder): (arg2: T2, arg3: T3, arg4: T4) => R;
353
+ /**
354
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
355
+ *
356
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
357
+ *
358
+ * Note: This method doesn't set the `length` property of partially applied functions.
359
+ *
360
+ * @template T1 The type of the first argument.
361
+ * @template T2 The type of the second argument.
362
+ * @template T3 The type of the third argument.
363
+ * @template T4 The type of the fourth argument.
364
+ * @template R The return type of the function.
365
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
366
+ * @param {T2} arg2 The second argument to be partially applied.
367
+ * @param {Placeholder} arg3 The placeholder for the third argument.
368
+ * @param {Placeholder} arg4 The placeholder for the fourth argument.
369
+ * @returns {(arg1: T1, arg3: T3, arg4: T4) => R} Returns a new function that takes the first, third, and fourth arguments.
370
+ */
371
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg2: T2, arg3: Placeholder, arg4: Placeholder): (arg1: T1, arg3: T3, arg4: T4) => R;
372
+ /**
373
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
374
+ *
375
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
376
+ *
377
+ * Note: This method doesn't set the `length` property of partially applied functions.
378
+ *
379
+ * @template T1 The type of the first argument.
380
+ * @template T2 The type of the second argument.
381
+ * @template T3 The type of the third argument.
382
+ * @template T4 The type of the fourth argument.
383
+ * @template R The return type of the function.
384
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
385
+ * @param {T1} arg1 The first argument to be partially applied.
386
+ * @param {T2} arg2 The second argument to be partially applied.
387
+ * @param {Placeholder} arg3 The placeholder for the third argument.
388
+ * @param {Placeholder} arg4 The placeholder for the fourth argument.
389
+ * @returns {(arg3: T3, arg4: T4) => R} Returns a new function that takes the third and fourth arguments.
390
+ */
391
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: T2, arg3: Placeholder, arg4: Placeholder): (arg3: T3, arg4: T4) => R;
392
+ /**
393
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
394
+ *
395
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
396
+ *
397
+ * Note: This method doesn't set the `length` property of partially applied functions.
398
+ *
399
+ * @template T1 The type of the first argument.
400
+ * @template T2 The type of the second argument.
401
+ * @template T3 The type of the third argument.
402
+ * @template T4 The type of the fourth argument.
403
+ * @template R The return type of the function.
404
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
405
+ * @param {T3} arg3 The third argument to be partially applied.
406
+ * @param {Placeholder} arg4 The placeholder for the fourth argument.
407
+ * @returns {(arg1: T1, arg2: T2, arg4: T4) => R} Returns a new function that takes the first, second, and fourth arguments.
408
+ */
409
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg3: T3, arg4: Placeholder): (arg1: T1, arg2: T2, arg4: T4) => R;
410
+ /**
411
+ * Creates a function that invokes `func` with the first argument, a placeholder for the second argument,
412
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
413
+ *
414
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
415
+ *
416
+ * Note: This method doesn't set the `length` property of partially applied functions.
417
+ *
418
+ * @template T1 The type of the first argument.
419
+ * @template T2 The type of the second argument.
420
+ * @template T3 The type of the third argument.
421
+ * @template T4 The type of the fourth argument.
422
+ * @template R The return type of the function.
423
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
424
+ * @param {T1} arg1 The first argument to be partially applied.
425
+ * @param {Placeholder} arg2 The placeholder for the second argument.
426
+ * @param {T3} arg3 The third argument to be partially applied.
427
+ * @param {Placeholder} arg4 The placeholder for the fourth argument.
428
+ * @returns {(arg2: T2, arg4: T4) => R} Returns a new function that takes the second and fourth arguments.
429
+ */
430
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: Placeholder, arg3: T3, arg4: Placeholder): (arg2: T2, arg4: T4) => R;
431
+ /**
432
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
433
+ *
434
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
435
+ *
436
+ * Note: This method doesn't set the `length` property of partially applied functions.
437
+ *
438
+ * @template T1 The type of the first argument.
439
+ * @template T2 The type of the second argument.
440
+ * @template T3 The type of the third argument.
441
+ * @template T4 The type of the fourth argument.
442
+ * @template R The return type of the function.
443
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
444
+ * @param {T2} arg2 The second argument to be partially applied.
445
+ * @param {T3} arg3 The third argument to be partially applied.
446
+ * @param {Placeholder} arg4 The placeholder for the fourth argument.
447
+ * @returns {(arg1: T1, arg4: T4) => R} Returns a new function that takes the first and fourth arguments.
448
+ */
449
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg2: T2, arg3: T3, arg4: Placeholder): (arg1: T1, arg4: T4) => R;
450
+ /**
451
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
452
+ *
453
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
454
+ *
455
+ * Note: This method doesn't set the `length` property of partially applied functions.
456
+ *
457
+ * @template T1 The type of the first argument.
458
+ * @template T2 The type of the second argument.
459
+ * @template T3 The type of the third argument.
460
+ * @template T4 The type of the fourth argument.
461
+ * @template R The return type of the function.
462
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
463
+ * @param {T1} arg1 The first argument to be partially applied.
464
+ * @param {T2} arg2 The second argument to be partially applied.
465
+ * @param {T3} arg3 The third argument to be partially applied.
466
+ * @param {Placeholder} arg4 The placeholder for the fourth argument.
467
+ * @returns {(arg4: T4) => R} Returns a new function that takes the fourth argument.
468
+ */
469
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: T2, arg3: T3, arg4: Placeholder): (arg4: T4) => R;
470
+ /**
471
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
472
+ *
473
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
474
+ *
475
+ * Note: This method doesn't set the `length` property of partially applied functions.
476
+ *
477
+ * @template T1 The type of the first argument.
478
+ * @template T2 The type of the second argument.
479
+ * @template T3 The type of the third argument.
480
+ * @template T4 The type of the fourth argument.
481
+ * @template R The return type of the function.
482
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
483
+ * @param {T4} arg4 The fourth argument to be partially applied.
484
+ * @returns {(arg1: T1, arg2: T2, arg3: T3) => R} Returns a new function that takes the first, second, and third arguments.
485
+ */
486
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg4: T4): (arg1: T1, arg2: T2, arg3: T3) => R;
487
+ /**
488
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
489
+ *
490
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
491
+ *
492
+ * Note: This method doesn't set the `length` property of partially applied functions.
493
+ *
494
+ * @template T1 The type of the first argument.
495
+ * @template T2 The type of the second argument.
496
+ * @template T3 The type of the third argument.
497
+ * @template T4 The type of the fourth argument.
498
+ * @template R The return type of the function.
499
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
500
+ * @param {T1} arg1 The first argument to be partially applied.
501
+ * @param {Placeholder} arg2 The placeholder for the second argument.
502
+ * @param {Placeholder} arg3 The placeholder for the third argument.
503
+ * @param {T4} arg4 The fourth argument to be partially applied.
504
+ * @returns {(arg2: T2, arg3: T3) => R} Returns a new function that takes the second and third arguments.
505
+ */
506
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: Placeholder, arg3: Placeholder, arg4: T4): (arg2: T2, arg3: T3) => R;
507
+ /**
508
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
509
+ *
510
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
511
+ *
512
+ * Note: This method doesn't set the `length` property of partially applied functions.
513
+ *
514
+ * @template T1 The type of the first argument.
515
+ * @template T2 The type of the second argument.
516
+ * @template T3 The type of the third argument.
517
+ * @template T4 The type of the fourth argument.
518
+ * @template R The return type of the function.
519
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
520
+ * @param {T2} arg2 The second argument to be partially applied.
521
+ * @param {Placeholder} arg3 The placeholder for the third argument.
522
+ * @param {T4} arg4 The fourth argument to be partially applied.
523
+ * @returns {(arg1: T1, arg3: T3) => R} Returns a new function that takes the first and third arguments.
524
+ */
525
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg2: T2, arg3: Placeholder, arg4: T4): (arg1: T1, arg3: T3) => R;
526
+ /**
527
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
528
+ *
529
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
530
+ *
531
+ * Note: This method doesn't set the `length` property of partially applied functions.
532
+ *
533
+ * @template T1 The type of the first argument.
534
+ * @template T2 The type of the second argument.
535
+ * @template T3 The type of the third argument.
536
+ * @template T4 The type of the fourth argument.
537
+ * @template R The return type of the function.
538
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
539
+ * @param {T1} arg1 The first argument to be partially applied.
540
+ * @param {T2} arg2 The second argument to be partially applied.
541
+ * @param {Placeholder} arg3 The placeholder for the third argument.
542
+ * @param {T4} arg4 The fourth argument to be partially applied.
543
+ * @returns {(arg3: T3) => R} Returns a new function that takes the third argument.
544
+ */
545
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: T2, arg3: Placeholder, arg4: T4): (arg3: T3) => R;
546
+ /**
547
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
548
+ *
549
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
550
+ *
551
+ * Note: This method doesn't set the `length` property of partially applied functions.
552
+ *
553
+ * @template T1 The type of the first argument.
554
+ * @template T2 The type of the second argument.
555
+ * @template T3 The type of the third argument.
556
+ * @template T4 The type of the fourth argument.
557
+ * @template R The return type of the function.
558
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
559
+ * @param {T3} arg3 The third argument to be partially applied.
560
+ * @param {T4} arg4 The fourth argument to be partially applied.
561
+ * @returns {(arg1: T1, arg2: T2) => R} Returns a new function that takes the first and second arguments.
562
+ */
563
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg3: T3, arg4: T4): (arg1: T1, arg2: T2) => R;
564
+ /**
565
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
566
+ *
567
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
568
+ *
569
+ * Note: This method doesn't set the `length` property of partially applied functions.
570
+ *
571
+ * @template T1 The type of the first argument.
572
+ * @template T2 The type of the second argument.
573
+ * @template T3 The type of the third argument.
574
+ * @template T4 The type of the fourth argument.
575
+ * @template R The return type of the function.
576
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
577
+ * @param {T1} arg1 The first argument to be partially applied.
578
+ * @param {Placeholder} arg2 The placeholder for the second argument.
579
+ * @param {T3} arg3 The third argument to be partially applied.
580
+ * @param {T4} arg4 The fourth argument to be partially applied.
581
+ * @returns {(arg2: T2) => R} Returns a new function that takes the second argument.
582
+ */
583
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: Placeholder, arg3: T3, arg4: T4): (arg2: T2) => R;
584
+ /**
585
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
586
+ *
587
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
588
+ *
589
+ * Note: This method doesn't set the `length` property of partially applied functions.
590
+ *
591
+ * @template T1 The type of the first argument.
592
+ * @template T2 The type of the second argument.
593
+ * @template T3 The type of the third argument.
594
+ * @template T4 The type of the fourth argument.
595
+ * @template R The return type of the function.
596
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
597
+ * @param {T2} arg2 The second argument to be partially applied.
598
+ * @param {T3} arg3 The third argument to be partially applied.
599
+ * @param {T4} arg4 The fourth argument to be partially applied.
600
+ * @returns {(arg1: T1) => R} Returns a new function that takes the first argument.
601
+ */
602
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg2: T2, arg3: T3, arg4: T4): (arg1: T1) => R;
603
+ /**
604
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
605
+ *
606
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
607
+ *
608
+ * Note: This method doesn't set the `length` property of partially applied functions.
609
+ *
610
+ * @template T1 The type of the first argument.
611
+ * @template T2 The type of the second argument.
612
+ * @template T3 The type of the third argument.
613
+ * @template T4 The type of the fourth argument.
614
+ * @template R The return type of the function.
615
+ * @param {(arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R} func The function to partially apply arguments to.
616
+ * @param {T1} arg1 The first argument to be partially applied.
617
+ * @param {T2} arg2 The second argument to be partially applied.
618
+ * @param {T3} arg3 The third argument to be partially applied.
619
+ * @param {T4} arg4 The fourth argument to be partially applied.
620
+ * @returns {() => R} Returns the new partially applied function.
621
+ * @example
622
+ * const concatenate = (a: string, b: string, c: string, d: string) => a + b + c + d;
623
+ * const concatenateHelloWorld = partialRight(concatenate, 'Hello', ' ', 'World', '!');
624
+ * console.log(concatenateHelloWorld()); // => 'Hello World!'
625
+ */
626
+ declare function partialRight<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: T2, arg3: T3, arg4: T4): () => R;
627
+ /**
628
+ * This method is like `partial` except that partially applied arguments are appended to the arguments it receives.
629
+ *
630
+ * The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
631
+ *
632
+ * Note: This method doesn't set the `length` property of partially applied functions.
633
+ *
634
+ * @template F The type of the function to partially apply.
635
+ * @param {F} func The function to partially apply arguments to.
636
+ * @param {...any[]} args The arguments to be partially applied.
637
+ * @returns {function(...args: any[]): ReturnType<F>} Returns the new partially applied function.
638
+ * @example
639
+ * const log = (...messages: string[]) => console.log(...messages);
640
+ * const logError = partialRight(log, 'Error:');
641
+ * logError('Something went wrong!'); // => 'Error: Something went wrong!'
642
+ */
643
+ declare function partialRight(func: (...args: any[]) => any, ...args: any[]): (...args: any[]) => any;
644
+ declare namespace partialRight {
645
+ var placeholder: Placeholder;
646
+ }
647
+ type Placeholder = symbol | (((value: any) => any) & {
648
+ partialRight: typeof partialRight;
649
+ });
650
+
651
+ export { partialRight };
@@ -0,0 +1,8 @@
1
+ import { partialRightImpl } from '../../function/partialRight.mjs';
2
+
3
+ function partialRight(func, ...partialArgs) {
4
+ return partialRightImpl(func, partialRight.placeholder, ...partialArgs);
5
+ }
6
+ partialRight.placeholder = Symbol('compat.partialRight.placeholder');
7
+
8
+ export { partialRight };