es-toolkit 1.35.0 → 1.36.0-dev.1217

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,575 @@
1
+ /**
2
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
3
+ *
4
+ * The partial.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 T1 The type of the first argument.
9
+ * @template R The return type of the function.
10
+ * @param {function(arg1: T1): R} func The function to partially apply.
11
+ * @param {T1} arg1 The first argument to apply.
12
+ * @returns {function(): R} A new function that takes no arguments and returns the result of the original function.
13
+ *
14
+ * @example
15
+ * const addOne = (x: number) => x + 1;
16
+ * const addOneToFive = partial(addOne, 5);
17
+ * console.log(addOneToFive()); // => 6
18
+ */
19
+ declare function partial<T1, R>(func: (arg1: T1) => R, arg1: T1): () => R;
20
+ /**
21
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
22
+ *
23
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
24
+ *
25
+ * Note: This method doesn't set the `length` property of partially applied functions.
26
+ *
27
+ * @template T1 The type of the first argument.
28
+ * @template T2 The type of the second argument.
29
+ * @template R The return type of the function.
30
+ * @param {function(arg1: T1, arg2: T2): R} func The function to partially apply.
31
+ * @param {T1} arg1 The first argument to apply.
32
+ * @returns {function(arg2: T2): R} A new function that takes the second argument and returns the result of the original function.
33
+ *
34
+ * @example
35
+ * const multiply = (x: number, y: number) => x * y;
36
+ * const double = partial(multiply, 2);
37
+ * console.log(double(5)); // => 10
38
+ */
39
+ declare function partial<T1, T2, R>(func: (arg1: T1, arg2: T2) => R, arg1: T1): (arg2: T2) => R;
40
+ /**
41
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
42
+ *
43
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
44
+ *
45
+ * Note: This method doesn't set the `length` property of partially applied functions.
46
+ *
47
+ * @template T1 The type of the first argument.
48
+ * @template T2 The type of the second argument.
49
+ * @template R The return type of the function.
50
+ * @param {function(arg1: T1, arg2: T2): R} func The function to partially apply.
51
+ * @param {Placeholder} placeholder The placeholder for the first argument.
52
+ * @param {T2} arg2 The second argument to apply.
53
+ * @returns {function(arg1: T1): R} A new function that takes the first argument and returns the result of the original function.
54
+ *
55
+ * @example
56
+ * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`;
57
+ * const greetWithHello = partial(greet, partial.placeholder, 'John');
58
+ * console.log(greetWithHello('Hello')); // => 'Hello, John!'
59
+ */
60
+ declare function partial<T1, T2, R>(func: (arg1: T1, arg2: T2) => R, placeholder: Placeholder, arg2: T2): (arg1: T1) => R;
61
+ /**
62
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
63
+ *
64
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
65
+ *
66
+ * Note: This method doesn't set the `length` property of partially applied functions.
67
+ *
68
+ * @template T1 The type of the first argument.
69
+ * @template T2 The type of the second argument.
70
+ * @template T3 The type of the third argument.
71
+ * @template R The return type of the function.
72
+ * @param {function(arg1: T1, arg2: T2, arg3: T3): R} func The function to partially apply.
73
+ * @param {T1} arg1 The first argument to apply.
74
+ * @returns {function(arg2: T2, arg3: T3): R} A new function that takes the second and third arguments and returns the result of the original function.
75
+ *
76
+ * @example
77
+ * const sumThree = (a: number, b: number, c: number) => a + b + c;
78
+ * const addFive = partial(sumThree, 5);
79
+ * console.log(addFive(3, 2)); // => 10
80
+ */
81
+ declare function partial<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1): (arg2: T2, arg3: T3) => R;
82
+ /**
83
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
84
+ *
85
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
86
+ *
87
+ * Note: This method doesn't set the `length` property of partially applied functions.
88
+ *
89
+ * @template T1 The type of the first argument.
90
+ * @template T2 The type of the second argument.
91
+ * @template T3 The type of the third argument.
92
+ * @template R The return type of the function.
93
+ * @param {function(arg1: T1, arg2: T2, arg3: T3): R} func The function to partially apply.
94
+ * @param {Placeholder} arg1 The placeholder for the first argument.
95
+ * @param {T2} arg2 The second argument to apply.
96
+ * @returns {function(arg1: T1, arg3: T3): R} A new function that takes the first and third arguments and returns the result of the original function.
97
+ *
98
+ * @example
99
+ * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`;
100
+ * const greetWithPlaceholder = partial(greet, partial.placeholder, 'John');
101
+ * console.log(greetWithPlaceholder('Hello')); // => 'Hello, John!'
102
+ */
103
+ declare function partial<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: Placeholder, arg2: T2): (arg1: T1, arg3: T3) => R;
104
+ /**
105
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
106
+ *
107
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
108
+ *
109
+ * Note: This method doesn't set the `length` property of partially applied functions.
110
+ *
111
+ * @template T1 The type of the first argument.
112
+ * @template T2 The type of the second argument.
113
+ * @template T3 The type of the third argument.
114
+ * @template R The return type of the function.
115
+ * @param {function(arg1: T1, arg2: T2, arg3: T3): R} func The function to partially apply.
116
+ * @param {Placeholder} arg1 The placeholder for the first argument.
117
+ * @param {Placeholder} arg2 The placeholder for the second argument.
118
+ * @param {T3} arg3 The third argument to apply.
119
+ * @returns {function(arg1: T1, arg2: T2): R} A new function that takes the first and second arguments and returns the result of the original function.
120
+ *
121
+ * @example
122
+ * const multiply = (x: number, y: number, z: number) => x * y * z;
123
+ * const multiplyWithPlaceholders = partial(multiply, partial.placeholder, partial.placeholder, 2);
124
+ * console.log(multiplyWithPlaceholders(3, 4)); // => 24
125
+ */
126
+ declare function partial<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: Placeholder, arg2: Placeholder, arg3: T3): (arg1: T1, arg2: T2) => R;
127
+ /**
128
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
129
+ *
130
+ * The partial.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 T3 The type of the third argument.
137
+ * @template R The return type of the function.
138
+ * @param {function(arg1: T1, arg2: T2, arg3: T3): R} func The function to partially apply.
139
+ * @param {T1} arg1 The first argument to apply.
140
+ * @param {Placeholder} arg2 The placeholder for the second argument.
141
+ * @param {T3} arg3 The third argument to apply.
142
+ * @returns {function(arg2: T2): R} A new function that takes the second argument and returns the result of the original function.
143
+ *
144
+ * @example
145
+ * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`;
146
+ * const greetWithPlaceholder = partial(greet, 'Hello', partial.placeholder);
147
+ * console.log(greetWithPlaceholder('John')); // => 'Hello, John!'
148
+ */
149
+ declare function partial<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: Placeholder, arg3: T3): (arg2: T2) => R;
150
+ /**
151
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
152
+ *
153
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
154
+ *
155
+ * Note: This method doesn't set the `length` property of partially applied functions.
156
+ *
157
+ * @template T1 The type of the first argument.
158
+ * @template T2 The type of the second argument.
159
+ * @template T3 The type of the third argument.
160
+ * @template R The return type of the function.
161
+ * @param {function(arg1: T1, arg2: T2, arg3: T3): R} func The function to partially apply.
162
+ * @param {Placeholder} arg1 The placeholder for the first argument.
163
+ * @param {T2} arg2 The second argument to apply.
164
+ * @param {Placeholder} arg3 The placeholder for the third argument.
165
+ * @returns {function(arg1: T1, arg3: T3): R} A new function that takes the first and third arguments and returns the result of the original function.
166
+ *
167
+ * @example
168
+ * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`;
169
+ * const greetWithPlaceholder = partial(greet, 'Hello', partial.placeholder);
170
+ * console.log(greetWithPlaceholder('John')); // => 'Hello, John!'
171
+ */
172
+ declare function partial<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: Placeholder, arg2: T2, arg3: Placeholder): (arg1: T1, arg3: T3) => R;
173
+ /**
174
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
175
+ *
176
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
177
+ *
178
+ * Note: This method doesn't set the `length` property of partially applied functions.
179
+ *
180
+ * @template T1 The type of the first argument.
181
+ * @template T2 The type of the second argument.
182
+ * @template T3 The type of the third argument.
183
+ * @template R The return type of the function.
184
+ * @param {function(arg1: T1, arg2: T2, arg3: T3): R} func The function to partially apply.
185
+ * @param {Placeholder} arg1 The first argument to apply.
186
+ * @param {T2} arg2 The placeholder for the second argument.
187
+ * @param {T3} arg3 The third argument to apply.
188
+ * @returns {function(arg2: T2): R} A new function that takes the second argument and returns the result of the original function.
189
+ *
190
+ * @example
191
+ * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`;
192
+ * const greetWithPlaceholder = partial(greet, 'Hello', partial.placeholder);
193
+ * console.log(greetWithPlaceholder('John')); // => 'Hello, John!'
194
+ */
195
+ declare function partial<T1, T2, T3, R>(func: (arg1: T1, arg2: T2, arg3: T3) => R, plc1: Placeholder, arg2: T2, arg3: T3): (arg1: T1) => R;
196
+ /**
197
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
198
+ *
199
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
200
+ *
201
+ * Note: This method doesn't set the `length` property of partially applied functions.
202
+ *
203
+ * @template T1 The type of the first argument.
204
+ * @template T2 The type of the second argument.
205
+ * @template T3 The type of the third argument.
206
+ * @template T4 The type of the fourth argument.
207
+ * @template R The return type of the function.
208
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
209
+ * @param {T1} arg1 The first argument to apply.
210
+ * @returns {function(arg2: T2): R} A new function that takes the second argument and returns the result of the original function.
211
+ *
212
+ * @example
213
+ * const multiply = (x: number, y: number, z: number, w: number) => x * y * z * w;
214
+ * const double = partial(multiply, 2);
215
+ * console.log(double(5, 4, 3)); // => 120
216
+ */
217
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1): (arg2: T2, arg3: T3, arg4: T4) => R;
218
+ /**
219
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
220
+ *
221
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
222
+ *
223
+ * Note: This method doesn't set the `length` property of partially applied functions.
224
+ *
225
+ * @template T1 The type of the first argument.
226
+ * @template T2 The type of the second argument.
227
+ * @template T3 The type of the third argument.
228
+ * @template T4 The type of the fourth argument.
229
+ * @template R The return type of the function.
230
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
231
+ * @param {Placeholder} arg1 The placeholder for the first argument.
232
+ * @param {Placeholder} arg2 The placeholder for the second argument.
233
+ * @param {T3} arg3 The third argument to apply.
234
+ * @param {T4} arg4 The fourth argument to apply.
235
+ * @returns {function(arg1: T1, arg2: T2): R} A new function that takes the first and second arguments and returns the result of the original function.
236
+ *
237
+ * @example
238
+ * const multiply = (x: number, y: number, z: number, w: number) => x * y * z * w;
239
+ * const multiplyWithPlaceholders = partial(multiply, partial.placeholder, partial.placeholder, 2, 3);
240
+ * console.log(multiplyWithPlaceholders(4, 5)); // => 120
241
+ */
242
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: Placeholder, arg2: Placeholder, arg3: T3, arg4: T4): (arg1: T1, arg2: T2) => R;
243
+ /**
244
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
245
+ *
246
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
247
+ *
248
+ * Note: This method doesn't set the `length` property of partially applied functions.
249
+ *
250
+ * @template T1 The type of the first argument.
251
+ * @template T2 The type of the second argument.
252
+ * @template T3 The type of the third argument.
253
+ * @template T4 The type of the fourth argument.
254
+ * @template R The return type of the function.
255
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
256
+ * @param {T1} arg1 The first argument to apply.
257
+ * @param {T2} arg2 The second argument to apply.
258
+ * @returns {function(arg3: T3, arg4: T4): R} A new function that takes the third and fourth arguments and returns the result of the original function.
259
+ *
260
+ * @example
261
+ * const sumFour = (a: number, b: number, c: number, d: number) => a + b + c + d;
262
+ * const addOneAndTwo = partial(sumFour, 1, 2);
263
+ * console.log(addOneAndTwo(3, 4)); // => 10
264
+ */
265
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: T2): (arg3: T3, arg4: T4) => R;
266
+ /**
267
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
268
+ *
269
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
270
+ *
271
+ * Note: This method doesn't set the `length` property of partially applied functions.
272
+ *
273
+ * @template T1 The type of the first argument.
274
+ * @template T2 The type of the second argument.
275
+ * @template T3 The type of the third argument.
276
+ * @template T4 The type of the fourth argument.
277
+ * @template R The return type of the function.
278
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
279
+ * @param {T1} arg1 The first argument to apply.
280
+ * @param {Placeholder} arg2 The placeholder for the second argument.
281
+ * @param {T3} arg3 The third argument to apply.
282
+ * @param {T4} arg4 The fourth argument to apply.
283
+ * @returns {function(arg2: T2, arg4: T4): R} A new function that takes the second and fourth arguments and returns the result of the original function.
284
+ *
285
+ * @example
286
+ * const greet = (greeting: string, name: string, punctuation: string) => `${greeting}, ${name}${punctuation}`;
287
+ * const greetWithPlaceholder = partial(greet, 'Hello', partial.placeholder, '!');
288
+ * console.log(greetWithPlaceholder('John')); // => 'Hello, John!'
289
+ */
290
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: Placeholder, arg3: T3): (arg2: T2, arg4: T4) => R;
291
+ /**
292
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
293
+ *
294
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
295
+ *
296
+ * Note: This method doesn't set the `length` property of partially applied functions.
297
+ *
298
+ * @template T1 The type of the first argument.
299
+ * @template T2 The type of the second argument.
300
+ * @template T3 The type of the third argument.
301
+ * @template T4 The type of the fourth argument.
302
+ * @template R The return type of the function.
303
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
304
+ * @param {Placeholder} arg1 The placeholder for the first argument.
305
+ * @param {T2} arg2 The second argument to apply.
306
+ * @param {T3} arg3 The third argument to apply.
307
+ * @param {T4} arg4 The fourth argument to apply.
308
+ * @returns {function(arg1: T1, arg3: T3): R} A new function that takes the first and third arguments and returns the result of the original function.
309
+ *
310
+ * @example
311
+ * const multiply = (x: number, y: number, z: number, w: number) => x * y * z * w;
312
+ * const multiplyWithPlaceholder = partial(multiply, partial.placeholder, 2, 3);
313
+ * console.log(multiplyWithPlaceholder(4)); // => 24
314
+ */
315
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: Placeholder, arg2: T2, arg3: T3): (arg1: T1, arg4: T4) => R;
316
+ /**
317
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
318
+ *
319
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
320
+ *
321
+ * Note: This method doesn't set the `length` property of partially applied functions.
322
+ *
323
+ * @template T1 The type of the first argument.
324
+ * @template T2 The type of the second argument.
325
+ * @template T3 The type of the third argument.
326
+ * @template T4 The type of the fourth argument.
327
+ * @template R The return type of the function.
328
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
329
+ * @param {Placeholder} arg1 The placeholder for the first argument.
330
+ * @param {T2} arg2 The second argument to apply.
331
+ * @param {Placeholder} arg3 The placeholder for the third argument.
332
+ * @param {T4} arg4 The fourth argument to apply.
333
+ * @returns {function(arg1: T1, arg3: T3): R} A new function that takes the first and third arguments and returns the result of the original function.
334
+ */
335
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: Placeholder, arg2: T2, arg3: Placeholder, arg4: T4): (arg1: T1, arg3: T3) => R;
336
+ /**
337
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
338
+ *
339
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
340
+ *
341
+ * Note: This method doesn't set the `length` property of partially applied functions.
342
+ *
343
+ * @template T1 The type of the first argument.
344
+ * @template T2 The type of the second argument.
345
+ * @template T3 The type of the third argument.
346
+ * @template T4 The type of the fourth argument.
347
+ * @template R The return type of the function.
348
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
349
+ * @param {Placeholder} arg1 The placeholder for the first argument.
350
+ * @param {Placeholder} arg2 The placeholder for the second argument.
351
+ * @param {T3} arg3 The third argument to apply.
352
+ * @param {T4} arg4 The fourth argument to apply.
353
+ * @returns {function(arg1: T1, arg2: T2): R} A new function that takes the first and second arguments and returns the result of the original function.
354
+ *
355
+ * @example
356
+ * const multiply = (x: number, y: number, z: number, w: number) => x * y * z * w;
357
+ * const multiplyWithPlaceholders = partial(multiply, partial.placeholder, partial.placeholder, 2, 3);
358
+ * console.log(multiplyWithPlaceholders(4, 5)); // => 120
359
+ */
360
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: Placeholder, arg2: Placeholder, arg3: T3, arg4: T4): (arg1: T1, arg2: T2) => R;
361
+ /**
362
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
363
+ *
364
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
365
+ *
366
+ * Note: This method doesn't set the `length` property of partially applied functions.
367
+ *
368
+ * @template T1 The type of the first argument.
369
+ * @template T2 The type of the second argument.
370
+ * @template T3 The type of the third argument.
371
+ * @template T4 The type of the fourth argument.
372
+ * @template R The return type of the function.
373
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
374
+ * @param {T1} arg1 The first argument to apply.
375
+ * @param {T2} arg2 The second argument to apply.
376
+ * @param {T3} arg3 The third argument to apply.
377
+ * @returns {function(arg4: T4): R} A new function that takes the fourth argument and returns the result of the original function.
378
+ */
379
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: T1, arg2: T2, arg3: T3): (arg4: T4) => R;
380
+ /**
381
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
382
+ *
383
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
384
+ *
385
+ * Note: This method doesn't set the `length` property of partially applied functions.
386
+ *
387
+ * @template T1 The type of the first argument.
388
+ * @template T2 The type of the second argument.
389
+ * @template T3 The type of the third argument.
390
+ * @template T4 The type of the fourth argument.
391
+ * @template R The return type of the function.
392
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
393
+ * @param {T1} arg1 The first argument to apply.
394
+ * @param {T2} arg2 The second argument to apply.
395
+ * @param {Placeholder} arg3 The placeholder for the third argument.
396
+ * @param {T4} arg4 The fourth argument to apply.
397
+ * @returns {function(arg3: T3): R} A new function that takes the third argument and returns the result of the original function.
398
+ */
399
+ declare function partial<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;
400
+ /**
401
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
402
+ *
403
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
404
+ *
405
+ * Note: This method doesn't set the `length` property of partially applied functions.
406
+ *
407
+ * @template T1 The type of the first argument.
408
+ * @template T2 The type of the second argument.
409
+ * @template T3 The type of the third argument.
410
+ * @template T4 The type of the fourth argument.
411
+ * @template R The return type of the function.
412
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
413
+ * @param {T1} arg1 The first argument to apply.
414
+ * @param {Placeholder} arg2 The placeholder for the second argument.
415
+ * @param {T3} arg3 The third argument to apply.
416
+ * @param {T4} arg4 The fourth argument to apply.
417
+ * @returns {function(arg2: T2): R} A new function that takes the second argument and returns the result of the original function.
418
+ */
419
+ declare function partial<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;
420
+ /**
421
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
422
+ *
423
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
424
+ *
425
+ * Note: This method doesn't set the `length` property of partially applied functions.
426
+ *
427
+ * @template T1 The type of the first argument.
428
+ * @template T2 The type of the second argument.
429
+ * @template T3 The type of the third argument.
430
+ * @template T4 The type of the fourth argument.
431
+ * @template R The return type of the function.
432
+ * @param {function(arg1: T1, arg2: T2, arg3: T3, arg4: T4): R} func The function to partially apply.
433
+ * @param {Placeholder} arg1 The placeholder for the first argument.
434
+ * @param {T2} arg2 The second argument to apply.
435
+ * @param {T3} arg3 The third argument to apply.
436
+ * @param {T4} arg4 The fourth argument to apply.
437
+ * @returns {function(arg1: T1): R} A new function that takes the first argument and returns the result of the original function.
438
+ */
439
+ declare function partial<T1, T2, T3, T4, R>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R, arg1: Placeholder, arg2: T2, arg3: T3, arg4: T4): (arg1: T1) => R;
440
+ /**
441
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
442
+ *
443
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
444
+ *
445
+ * Note: This method doesn't set the `length` property of partially applied functions.
446
+ *
447
+ * @template TS The types of the arguments.
448
+ * @template R The return type of the function.
449
+ * @param {function(...args: TS): R} func The function to partially apply.
450
+ * @returns {function(...args: TS): R} A new function that takes the same arguments as the original function.
451
+ *
452
+ * @example
453
+ * const add = (...numbers: number[]) => numbers.reduce((sum, n) => sum + n, 0);
454
+ * const addFive = partial(add, 5);
455
+ * console.log(addFive(1, 2, 3)); // => 11
456
+ */
457
+ declare function partial<TS extends any[], R>(func: (...args: TS) => R): (...args: TS) => R;
458
+ /**
459
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
460
+ *
461
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
462
+ *
463
+ * Note: This method doesn't set the `length` property of partially applied functions.
464
+ *
465
+ * @template TS The types of the arguments.
466
+ * @template T1 The type of the first argument.
467
+ * @template R The return type of the function.
468
+ * @param {function(arg1: T1, ...args: TS): R} func The function to partially apply.
469
+ * @param {T1} arg1 The first argument to apply.
470
+ * @returns {function(...args: TS): R} A new function that takes the remaining arguments and returns the result of the original function.
471
+ *
472
+ * @example
473
+ * const greet = (greeting: string, ...names: string[]) => `${greeting}, ${names.join(', ')}!`;
474
+ * const greetHello = partial(greet, 'Hello');
475
+ * console.log(greetHello('Alice', 'Bob')); // => 'Hello, Alice, Bob!'
476
+ */
477
+ declare function partial<TS extends any[], T1, R>(func: (arg1: T1, ...args: TS) => R, arg1: T1): (...args: TS) => R;
478
+ /**
479
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
480
+ *
481
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
482
+ *
483
+ * Note: This method doesn't set the `length` property of partially applied functions.
484
+ *
485
+ * @template TS The types of the arguments.
486
+ * @template T1 The type of the first argument.
487
+ * @template T2 The type of the second argument.
488
+ * @template R The return type of the function.
489
+ * @param {function(arg1: T1, arg2: T2, ...args: TS): R} func The function to partially apply.
490
+ * @param {T1} arg1 The first argument to apply.
491
+ * @param {T2} arg2 The second argument to apply.
492
+ * @returns {function(...args: TS): R} A new function that takes the remaining arguments and returns the result of the original function.
493
+ *
494
+ * @example
495
+ * const greet = (greeting: string, name: string, punctuation: string) => `${greeting}, ${name}${punctuation}`;
496
+ * const greetWithHello = partial(greet, 'Hello', '!');
497
+ * console.log(greetWithHello('John')); // => 'Hello, John!'
498
+ */
499
+ declare function partial<TS extends any[], T1, T2, R>(func: (arg1: T1, arg2: T2, ...args: TS) => R, t1: T1, arg2: T2): (...args: TS) => R;
500
+ /**
501
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
502
+ *
503
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
504
+ *
505
+ * Note: This method doesn't set the `length` property of partially applied functions.
506
+ *
507
+ * @template TS The types of the arguments.
508
+ * @template T1 The type of the first argument.
509
+ * @template T2 The type of the second argument.
510
+ * @template T3 The type of the third argument.
511
+ * @template R The return type of the function.
512
+ * @param {function(t1: T1, arg2: T2, arg3: T3, ...args: TS): R} func The function to partially apply.
513
+ * @param {T1} t1 The first argument to apply.
514
+ * @param {T2} arg2 The second argument to apply.
515
+ * @param {T3} arg3 The third argument to apply.
516
+ * @returns {function(...args: TS): R} A new function that takes the remaining arguments and returns the result of the original function.
517
+ *
518
+ * @example
519
+ * const greet = (greeting: string, name: string, punctuation: string) => `${greeting}, ${name}${punctuation}`;
520
+ * const greetWithHello = partial(greet, 'Hello', 'John', '!');
521
+ * console.log(greetWithHello()); // => 'Hello, John!'
522
+ */
523
+ declare function partial<TS extends any[], T1, T2, T3, R>(func: (t1: T1, arg2: T2, arg3: T3, ...args: TS) => R, t1: T1, arg2: T2, arg3: T3): (...args: TS) => R;
524
+ /**
525
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
526
+ *
527
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
528
+ *
529
+ * Note: This method doesn't set the `length` property of partially applied functions.
530
+ *
531
+ * @template TS The types of the arguments.
532
+ * @template T1 The type of the first argument.
533
+ * @template T2 The type of the second argument.
534
+ * @template T3 The type of the third argument.
535
+ * @template T4 The type of the fourth argument.
536
+ * @template R The return type of the function.
537
+ * @param {function(t1: T1, arg2: T2, arg3: T3, arg4: T4, ...args: TS): R} func The function to partially apply.
538
+ * @param {T1} t1 The first argument to apply.
539
+ * @param {T2} arg2 The second argument to apply.
540
+ * @param {T3} arg3 The third argument to apply.
541
+ * @param {T4} arg4 The fourth argument to apply.
542
+ * @returns {function(...args: TS): R} A new function that takes the remaining arguments and returns the result of the original function.
543
+ *
544
+ * @example
545
+ * const greet = (greeting: string, name: string, punctuation: string) => `${greeting}, ${name}${punctuation}`;
546
+ * const greetWithHello = partial(greet, 'Hello', 'John', '!');
547
+ * console.log(greetWithHello()); // => 'Hello, John!'
548
+ */
549
+ declare function partial<TS extends any[], T1, T2, T3, T4, R>(func: (t1: T1, arg2: T2, arg3: T3, arg4: T4, ...args: TS) => R, t1: T1, arg2: T2, arg3: T3, arg4: T4): (...args: TS) => R;
550
+ /**
551
+ * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding.
552
+ *
553
+ * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments.
554
+ *
555
+ * Note: This method doesn't set the `length` property of partially applied functions.
556
+ *
557
+ * @template F The type of the function to partially apply.
558
+ * @param {F} func The function to partially apply.
559
+ * @param {...any[]} partialArgs The arguments to be partially applied.
560
+ * @returns {function(...args: any[]): ReturnType<F>} A new function that takes the remaining arguments and returns the result of the original function.
561
+ *
562
+ * @example
563
+ * const add = (...numbers: number[]) => numbers.reduce((sum, n) => sum + n, 0);
564
+ * const addFive = partial(add, 5);
565
+ * console.log(addFive(1, 2, 3)); // => 11
566
+ */
567
+ declare function partial<F extends (...args: any[]) => any>(func: F, ...partialArgs: any[]): (...args: any[]) => ReturnType<F>;
568
+ declare namespace partial {
569
+ var placeholder: Placeholder;
570
+ }
571
+ type Placeholder = symbol | (((value: any) => any) & {
572
+ partial: typeof partial;
573
+ });
574
+
575
+ export { partial };
@@ -0,0 +1,8 @@
1
+ import { partialImpl } from '../../function/partial.mjs';
2
+
3
+ function partial(func, ...partialArgs) {
4
+ return partialImpl(func, partial.placeholder, ...partialArgs);
5
+ }
6
+ partial.placeholder = Symbol('compat.partial.placeholder');
7
+
8
+ export { partial };