@vinicunca/perkakas 1.5.0 → 1.7.0

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 (569) hide show
  1. package/dist/add-prop.cjs +1 -1
  2. package/dist/add-prop.d.cts +1 -1
  3. package/dist/add-prop.d.ts +1 -1
  4. package/dist/add-prop.js +1 -1
  5. package/dist/add.cjs +1 -1
  6. package/dist/add.js +1 -1
  7. package/dist/all-pass.cjs +1 -1
  8. package/dist/all-pass.js +1 -1
  9. package/dist/any-pass.cjs +1 -1
  10. package/dist/any-pass.js +1 -1
  11. package/dist/array-required-prefix-Ck4lHkbA.d.cts +33 -0
  12. package/dist/array-required-prefix-DXv_WnmG.d.ts +33 -0
  13. package/dist/bounded-partial-BqwRN49U.d.cts +15 -0
  14. package/dist/bounded-partial-BzynYDVs.d.ts +15 -0
  15. package/dist/ceil.cjs +1 -1
  16. package/dist/ceil.js +1 -1
  17. package/dist/{chunk-AJQEGHF5.cjs → chunk-22AQJBPW.cjs} +1 -1
  18. package/dist/chunk-2HQM73IT.cjs +1 -0
  19. package/dist/chunk-2XGSSTCA.js +1 -0
  20. package/dist/chunk-3DOG24FJ.cjs +1 -0
  21. package/dist/{chunk-6ENW2VLC.cjs → chunk-3LC3CLYE.cjs} +1 -1
  22. package/dist/chunk-44LUF6RO.js +1 -0
  23. package/dist/chunk-4BTTPOEU.cjs +1 -0
  24. package/dist/chunk-4Y6KJJOW.js +1 -0
  25. package/dist/chunk-5PMGMODH.js +1 -0
  26. package/dist/{chunk-GVYLRJPB.cjs → chunk-66JP4PUG.cjs} +1 -1
  27. package/dist/chunk-6M4IYQFZ.js +1 -0
  28. package/dist/chunk-76VE5EC6.cjs +1 -0
  29. package/dist/{chunk-TNA73S2T.cjs → chunk-7C7R7JNX.cjs} +1 -1
  30. package/dist/{chunk-WONMP5WS.js → chunk-7V7IBWP5.js} +1 -1
  31. package/dist/chunk-B6SBIS6W.js +1 -0
  32. package/dist/chunk-BEMQAYI5.cjs +1 -0
  33. package/dist/chunk-BKBHW2XJ.js +1 -0
  34. package/dist/chunk-BSNCALDT.cjs +1 -0
  35. package/dist/chunk-CTGIT5TY.js +1 -0
  36. package/dist/{chunk-UGWBDJPI.cjs → chunk-D4TUHKBA.cjs} +1 -1
  37. package/dist/chunk-EK7ODJWE.js +1 -0
  38. package/dist/chunk-FGMSPUSF.cjs +1 -0
  39. package/dist/chunk-FIO5FNV2.js +1 -0
  40. package/dist/chunk-FOUZI2Q3.cjs +1 -0
  41. package/dist/chunk-GRKRFDIL.js +1 -0
  42. package/dist/chunk-GW4KDK3D.cjs +1 -0
  43. package/dist/chunk-HSNPZS6R.cjs +1 -0
  44. package/dist/chunk-ITDJLXHO.js +1 -0
  45. package/dist/{chunk-FLQYTU5W.cjs → chunk-JHFSYEXB.cjs} +1 -1
  46. package/dist/{chunk-WCPENZWH.js → chunk-JI5FJX2E.js} +1 -1
  47. package/dist/chunk-JYWIRZ2Z.js +1 -0
  48. package/dist/chunk-K26HQR4Y.cjs +1 -0
  49. package/dist/chunk-KYMVIFAW.cjs +1 -0
  50. package/dist/chunk-MBGSSEZN.cjs +1 -0
  51. package/dist/{chunk-22IDCBFS.js → chunk-MPWQN3WY.js} +1 -1
  52. package/dist/chunk-NHTBBY2L.js +1 -0
  53. package/dist/chunk-NQUTCPKD.js +1 -0
  54. package/dist/{chunk-ZQXE6PIV.cjs → chunk-NVCXF5UR.cjs} +1 -1
  55. package/dist/chunk-O74TUGYF.js +1 -0
  56. package/dist/chunk-OKBFQ7B6.js +1 -0
  57. package/dist/{chunk-MHEODCN3.cjs → chunk-OMHZCALN.cjs} +1 -1
  58. package/dist/chunk-P7RCAO7P.cjs +438 -0
  59. package/dist/chunk-QGF2XNZS.cjs +1 -0
  60. package/dist/chunk-R4O7XE2F.cjs +1 -0
  61. package/dist/chunk-RMOD5JNB.cjs +1 -0
  62. package/dist/chunk-RTFVY5D4.cjs +1 -0
  63. package/dist/chunk-SG2YWG6U.cjs +1 -0
  64. package/dist/chunk-SXNRBENP.cjs +1 -0
  65. package/dist/chunk-TSP3FU72.cjs +1 -0
  66. package/dist/chunk-TVMG2NYC.js +1 -0
  67. package/dist/chunk-TWCEO47X.cjs +1 -0
  68. package/dist/{chunk-L4FN2W5Q.cjs → chunk-TXPRX236.cjs} +1 -1
  69. package/dist/{chunk-3K7SNX4D.cjs → chunk-UURK6I3D.cjs} +1 -1
  70. package/dist/chunk-UWMBE6BM.js +1 -0
  71. package/dist/{chunk-VBH6SKKO.js → chunk-VI2QG3FU.js} +1 -1
  72. package/dist/chunk-XCG2UC6T.js +1 -0
  73. package/dist/chunk-YCSQX2SY.js +1 -0
  74. package/dist/{chunk-6XVLHSPK.js → chunk-YRVN4PYH.js} +1 -1
  75. package/dist/chunk-YWIXN5BR.js +1 -0
  76. package/dist/chunk-Z23BZCCD.js +438 -0
  77. package/dist/{chunk-EDZFEURO.js → chunk-Z5YZYBC2.js} +1 -1
  78. package/dist/chunk-Z7D7Q6U3.js +1 -0
  79. package/dist/chunk-ZITGCTSW.js +1 -0
  80. package/dist/chunk-ZMG3NQDL.js +1 -0
  81. package/dist/chunk.cjs +1 -1
  82. package/dist/chunk.d.cts +37 -41
  83. package/dist/chunk.d.ts +37 -41
  84. package/dist/chunk.js +1 -1
  85. package/dist/clamp.cjs +1 -1
  86. package/dist/clamp.js +1 -1
  87. package/dist/clamped-integer-subtract-DZ7rsJE4.d.cts +15 -0
  88. package/dist/clamped-integer-subtract-DZ7rsJE4.d.ts +15 -0
  89. package/dist/clone.cjs +1 -1
  90. package/dist/clone.js +1 -1
  91. package/dist/coerced-array-DRz3tqda.d.cts +14 -0
  92. package/dist/coerced-array-DRz3tqda.d.ts +14 -0
  93. package/dist/concat.cjs +1 -1
  94. package/dist/concat.js +1 -1
  95. package/dist/conditional.cjs +1 -1
  96. package/dist/conditional.d.cts +133 -43
  97. package/dist/conditional.d.ts +133 -43
  98. package/dist/conditional.js +1 -1
  99. package/dist/constant.cjs +1 -1
  100. package/dist/constant.js +1 -1
  101. package/dist/count-by.cjs +1 -1
  102. package/dist/count-by.d.cts +5 -4
  103. package/dist/count-by.d.ts +5 -4
  104. package/dist/count-by.js +1 -1
  105. package/dist/curry.cjs +1 -1
  106. package/dist/curry.js +1 -1
  107. package/dist/debounce.cjs +1 -1
  108. package/dist/debounce.js +1 -1
  109. package/dist/difference-with.cjs +1 -1
  110. package/dist/difference-with.js +1 -1
  111. package/dist/difference.cjs +1 -1
  112. package/dist/difference.js +1 -1
  113. package/dist/divide.cjs +1 -1
  114. package/dist/divide.js +1 -1
  115. package/dist/do-nothing.cjs +1 -1
  116. package/dist/do-nothing.js +1 -1
  117. package/dist/drop-first-by.cjs +1 -1
  118. package/dist/drop-first-by.d.cts +1 -1
  119. package/dist/drop-first-by.d.ts +1 -1
  120. package/dist/drop-first-by.js +1 -1
  121. package/dist/drop-last-while.cjs +1 -1
  122. package/dist/drop-last-while.js +1 -1
  123. package/dist/drop-last.cjs +1 -1
  124. package/dist/drop-last.js +1 -1
  125. package/dist/drop-while.cjs +1 -1
  126. package/dist/drop-while.js +1 -1
  127. package/dist/drop.cjs +1 -1
  128. package/dist/drop.d.cts +18 -30
  129. package/dist/drop.d.ts +18 -30
  130. package/dist/drop.js +1 -1
  131. package/dist/entries.cjs +1 -1
  132. package/dist/entries.d.cts +8 -5
  133. package/dist/entries.d.ts +8 -5
  134. package/dist/entries.js +1 -1
  135. package/dist/{enumerable-string-key-of-BQ4aR5ep.d.cts → enumerable-string-key-of-C4gsorXe.d.ts} +3 -1
  136. package/dist/{enumerable-string-key-of-BQ4aR5ep.d.ts → enumerable-string-key-of-D8w_3Yg8.d.cts} +3 -1
  137. package/dist/enumerable-string-keyed-value-of-BU9R_cEk.d.cts +9 -0
  138. package/dist/enumerable-string-keyed-value-of-BU9R_cEk.d.ts +9 -0
  139. package/dist/evolve.cjs +1 -1
  140. package/dist/evolve.js +1 -1
  141. package/dist/filter.cjs +1 -1
  142. package/dist/filter.d.cts +12 -4
  143. package/dist/filter.d.ts +12 -4
  144. package/dist/filter.js +1 -1
  145. package/dist/filtered-array-BCjySbC6.d.cts +18 -0
  146. package/dist/filtered-array-JKATL39M.d.ts +18 -0
  147. package/dist/find-index.cjs +1 -1
  148. package/dist/find-index.js +1 -1
  149. package/dist/find-last-index.cjs +1 -1
  150. package/dist/find-last-index.js +1 -1
  151. package/dist/find-last.cjs +1 -1
  152. package/dist/find-last.js +1 -1
  153. package/dist/find.cjs +1 -1
  154. package/dist/find.js +1 -1
  155. package/dist/first-by.cjs +1 -1
  156. package/dist/first-by.d.cts +1 -1
  157. package/dist/first-by.d.ts +1 -1
  158. package/dist/first-by.js +1 -1
  159. package/dist/first.cjs +1 -1
  160. package/dist/first.js +1 -1
  161. package/dist/flat-map.cjs +1 -1
  162. package/dist/flat-map.js +1 -1
  163. package/dist/flat.cjs +1 -1
  164. package/dist/flat.d.cts +2 -5
  165. package/dist/flat.d.ts +2 -5
  166. package/dist/flat.js +1 -1
  167. package/dist/floor.cjs +1 -1
  168. package/dist/floor.js +1 -1
  169. package/dist/for-each-obj.cjs +1 -1
  170. package/dist/for-each-obj.d.cts +3 -2
  171. package/dist/for-each-obj.d.ts +3 -2
  172. package/dist/for-each-obj.js +1 -1
  173. package/dist/for-each.cjs +1 -1
  174. package/dist/for-each.js +1 -1
  175. package/dist/from-entries.cjs +1 -1
  176. package/dist/from-entries.d.cts +4 -2
  177. package/dist/from-entries.d.ts +4 -2
  178. package/dist/from-entries.js +1 -1
  179. package/dist/from-keys.cjs +1 -1
  180. package/dist/from-keys.d.cts +4 -3
  181. package/dist/from-keys.d.ts +4 -3
  182. package/dist/from-keys.js +1 -1
  183. package/dist/funnel.cjs +1 -1
  184. package/dist/funnel.d.cts +7 -7
  185. package/dist/funnel.d.ts +7 -7
  186. package/dist/funnel.js +1 -1
  187. package/dist/funnel.lodash-debounce-with-cached-value.test.cjs +1 -1
  188. package/dist/funnel.lodash-debounce-with-cached-value.test.js +1 -1
  189. package/dist/funnel.lodash-debounce.test.cjs +1 -1
  190. package/dist/funnel.lodash-debounce.test.js +1 -1
  191. package/dist/funnel.lodash-throttle-with-cached-value.test.cjs +1 -1
  192. package/dist/funnel.lodash-throttle-with-cached-value.test.js +1 -1
  193. package/dist/funnel.lodash-throttle.test.cjs +1 -1
  194. package/dist/funnel.lodash-throttle.test.js +1 -1
  195. package/dist/funnel.perkakas-debounce.test.cjs +1 -0
  196. package/dist/funnel.perkakas-debounce.test.js +1 -0
  197. package/dist/funnel.reference-batch.test.cjs +1 -1
  198. package/dist/funnel.reference-batch.test.js +1 -1
  199. package/dist/funnel.test-d.cjs +1 -1
  200. package/dist/funnel.test-d.js +1 -1
  201. package/dist/funnel.test.cjs +1 -1
  202. package/dist/funnel.test.js +1 -1
  203. package/dist/group-by-prop.cjs +1 -0
  204. package/dist/group-by-prop.d.cts +93 -0
  205. package/dist/group-by-prop.d.ts +93 -0
  206. package/dist/group-by-prop.js +1 -0
  207. package/dist/group-by.cjs +1 -1
  208. package/dist/group-by.d.cts +15 -4
  209. package/dist/group-by.d.ts +15 -4
  210. package/dist/group-by.js +1 -1
  211. package/dist/has-at-least.cjs +1 -1
  212. package/dist/has-at-least.d.cts +7 -15
  213. package/dist/has-at-least.d.ts +7 -15
  214. package/dist/has-at-least.js +1 -1
  215. package/dist/has-sub-object.cjs +1 -1
  216. package/dist/has-sub-object.js +1 -1
  217. package/dist/human-readable-file-size.cjs +1 -1
  218. package/dist/human-readable-file-size.js +1 -1
  219. package/dist/identity.cjs +1 -1
  220. package/dist/identity.js +1 -1
  221. package/dist/if-D4QIikQ1.d.cts +5 -0
  222. package/dist/if-D4QIikQ1.d.ts +5 -0
  223. package/dist/index-by.cjs +1 -1
  224. package/dist/index-by.d.cts +5 -4
  225. package/dist/index-by.d.ts +5 -4
  226. package/dist/index-by.js +1 -1
  227. package/dist/index.cjs +1 -1
  228. package/dist/index.d.cts +15 -8
  229. package/dist/index.d.ts +15 -8
  230. package/dist/index.js +1 -1
  231. package/dist/intersection-with.cjs +1 -1
  232. package/dist/intersection-with.js +1 -1
  233. package/dist/intersection.cjs +1 -1
  234. package/dist/intersection.js +1 -1
  235. package/dist/invert.cjs +1 -1
  236. package/dist/invert.d.cts +2 -1
  237. package/dist/invert.d.ts +2 -1
  238. package/dist/invert.js +1 -1
  239. package/dist/is-array.cjs +1 -1
  240. package/dist/is-array.js +1 -1
  241. package/dist/is-big-int.cjs +1 -1
  242. package/dist/is-big-int.js +1 -1
  243. package/dist/is-boolean.cjs +1 -1
  244. package/dist/is-boolean.js +1 -1
  245. package/dist/is-bounded-record-C9WAwfA8.d.cts +30 -0
  246. package/dist/is-bounded-record-C9WAwfA8.d.ts +30 -0
  247. package/dist/is-date.cjs +1 -1
  248. package/dist/is-date.js +1 -1
  249. package/dist/is-deep-equal.cjs +1 -1
  250. package/dist/is-deep-equal.js +1 -1
  251. package/dist/is-defined.cjs +1 -1
  252. package/dist/is-defined.js +1 -1
  253. package/dist/is-empty.cjs +1 -1
  254. package/dist/is-empty.js +1 -1
  255. package/dist/is-error.cjs +1 -1
  256. package/dist/is-error.js +1 -1
  257. package/dist/is-function.cjs +1 -1
  258. package/dist/is-function.js +1 -1
  259. package/dist/is-included-in.cjs +1 -1
  260. package/dist/is-included-in.js +1 -1
  261. package/dist/is-non-null.cjs +1 -1
  262. package/dist/is-non-null.js +1 -1
  263. package/dist/is-non-nullish.cjs +1 -1
  264. package/dist/is-non-nullish.js +1 -1
  265. package/dist/is-not.cjs +1 -1
  266. package/dist/is-not.js +1 -1
  267. package/dist/is-nullish.cjs +1 -1
  268. package/dist/is-nullish.js +1 -1
  269. package/dist/is-number.cjs +1 -1
  270. package/dist/is-number.js +1 -1
  271. package/dist/is-object-type.cjs +1 -1
  272. package/dist/is-object-type.js +1 -1
  273. package/dist/is-plain-object.cjs +1 -1
  274. package/dist/is-plain-object.js +1 -1
  275. package/dist/is-promise.cjs +1 -1
  276. package/dist/is-promise.js +1 -1
  277. package/dist/is-shallow-equal.cjs +1 -1
  278. package/dist/is-shallow-equal.js +1 -1
  279. package/dist/is-strict-equal.cjs +1 -1
  280. package/dist/is-strict-equal.js +1 -1
  281. package/dist/is-string.cjs +1 -1
  282. package/dist/is-string.js +1 -1
  283. package/dist/is-symbol.cjs +1 -1
  284. package/dist/is-symbol.js +1 -1
  285. package/dist/is-truthy.cjs +1 -1
  286. package/dist/is-truthy.js +1 -1
  287. package/dist/join.cjs +1 -1
  288. package/dist/join.js +1 -1
  289. package/dist/key-codes.cjs +1 -1
  290. package/dist/key-codes.js +1 -1
  291. package/dist/keys.cjs +1 -1
  292. package/dist/keys.d.cts +4 -3
  293. package/dist/keys.d.ts +4 -3
  294. package/dist/keys.js +1 -1
  295. package/dist/last.cjs +1 -1
  296. package/dist/last.js +1 -1
  297. package/dist/length.cjs +1 -1
  298. package/dist/length.js +1 -1
  299. package/dist/magic-string.es-2ADFIHOO.cjs +13 -0
  300. package/dist/magic-string.es-PNCTE22R.js +13 -0
  301. package/dist/map-keys.cjs +1 -1
  302. package/dist/map-keys.d.cts +8 -6
  303. package/dist/map-keys.d.ts +8 -6
  304. package/dist/map-keys.js +1 -1
  305. package/dist/map-to-obj.cjs +1 -1
  306. package/dist/map-to-obj.d.cts +30 -12
  307. package/dist/map-to-obj.d.ts +30 -12
  308. package/dist/map-to-obj.js +1 -1
  309. package/dist/map-values.cjs +1 -1
  310. package/dist/map-values.d.cts +3 -2
  311. package/dist/map-values.d.ts +3 -2
  312. package/dist/map-values.js +1 -1
  313. package/dist/map-with-feedback.cjs +1 -1
  314. package/dist/map-with-feedback.js +1 -1
  315. package/dist/map.cjs +1 -1
  316. package/dist/map.js +1 -1
  317. package/dist/mean-by.cjs +1 -1
  318. package/dist/mean-by.js +1 -1
  319. package/dist/merge-all.cjs +1 -1
  320. package/dist/merge-all.d.cts +2 -1
  321. package/dist/merge-all.d.ts +2 -1
  322. package/dist/merge-all.js +1 -1
  323. package/dist/merge-deep.cjs +1 -1
  324. package/dist/merge-deep.js +1 -1
  325. package/dist/merge.cjs +1 -1
  326. package/dist/merge.js +1 -1
  327. package/dist/multiply.cjs +1 -1
  328. package/dist/multiply.js +1 -1
  329. package/dist/nth-by.cjs +1 -1
  330. package/dist/nth-by.d.cts +1 -1
  331. package/dist/nth-by.d.ts +1 -1
  332. package/dist/nth-by.js +1 -1
  333. package/dist/obj-of.cjs +1 -1
  334. package/dist/obj-of.js +1 -1
  335. package/dist/omit-by.cjs +1 -1
  336. package/dist/omit-by.d.cts +7 -6
  337. package/dist/omit-by.d.ts +7 -6
  338. package/dist/omit-by.js +1 -1
  339. package/dist/omit.cjs +1 -1
  340. package/dist/omit.js +1 -1
  341. package/dist/once.cjs +1 -1
  342. package/dist/once.js +1 -1
  343. package/dist/only.cjs +1 -1
  344. package/dist/only.js +1 -1
  345. package/dist/partial-array-Vnf1fBtl.d.cts +10 -0
  346. package/dist/partial-array-Vnf1fBtl.d.ts +10 -0
  347. package/dist/partition.cjs +1 -1
  348. package/dist/partition.js +1 -1
  349. package/dist/path-or.cjs +1 -1
  350. package/dist/path-or.js +1 -1
  351. package/dist/perkakas-type-error-8wPb8T2y.d.cts +17 -0
  352. package/dist/perkakas-type-error-8wPb8T2y.d.ts +17 -0
  353. package/dist/pick-by.cjs +1 -1
  354. package/dist/pick-by.d.cts +11 -11
  355. package/dist/pick-by.d.ts +11 -11
  356. package/dist/pick-by.js +1 -1
  357. package/dist/pick.cjs +1 -1
  358. package/dist/pick.d.cts +52 -7
  359. package/dist/pick.d.ts +52 -7
  360. package/dist/pick.js +1 -1
  361. package/dist/pipe.cjs +1 -1
  362. package/dist/pipe.js +1 -1
  363. package/dist/piped.cjs +1 -1
  364. package/dist/piped.js +1 -1
  365. package/dist/product.cjs +1 -1
  366. package/dist/product.js +1 -1
  367. package/dist/prop.cjs +1 -1
  368. package/dist/prop.js +1 -1
  369. package/dist/pull-object.cjs +1 -1
  370. package/dist/pull-object.d.cts +5 -4
  371. package/dist/pull-object.d.ts +5 -4
  372. package/dist/pull-object.js +1 -1
  373. package/dist/random-integer.cjs +1 -1
  374. package/dist/random-integer.js +1 -1
  375. package/dist/random-string.cjs +1 -1
  376. package/dist/random-string.js +1 -1
  377. package/dist/range.cjs +1 -1
  378. package/dist/range.js +1 -1
  379. package/dist/rank-by.cjs +1 -1
  380. package/dist/rank-by.d.cts +1 -1
  381. package/dist/rank-by.d.ts +1 -1
  382. package/dist/rank-by.js +1 -1
  383. package/dist/reduce.cjs +1 -1
  384. package/dist/reduce.js +1 -1
  385. package/dist/reverse.cjs +1 -1
  386. package/dist/reverse.js +1 -1
  387. package/dist/round.cjs +1 -1
  388. package/dist/round.js +1 -1
  389. package/dist/sample.cjs +1 -1
  390. package/dist/sample.js +1 -1
  391. package/dist/set-path.cjs +1 -1
  392. package/dist/set-path.d.cts +18 -7
  393. package/dist/set-path.d.ts +18 -7
  394. package/dist/set-path.js +1 -1
  395. package/dist/set.cjs +1 -1
  396. package/dist/set.d.cts +1 -1
  397. package/dist/set.d.ts +1 -1
  398. package/dist/set.js +1 -1
  399. package/dist/shuffle.cjs +1 -1
  400. package/dist/shuffle.js +1 -1
  401. package/dist/sleep.cjs +1 -1
  402. package/dist/sleep.js +1 -1
  403. package/dist/slice-string.cjs +1 -1
  404. package/dist/slice-string.js +1 -1
  405. package/dist/slugify.cjs +1 -1
  406. package/dist/slugify.js +1 -1
  407. package/dist/sort-by.cjs +1 -1
  408. package/dist/sort-by.d.cts +1 -1
  409. package/dist/sort-by.d.ts +1 -1
  410. package/dist/sort-by.js +1 -1
  411. package/dist/sort.cjs +1 -1
  412. package/dist/sort.js +1 -1
  413. package/dist/sorted-index-by.cjs +1 -1
  414. package/dist/sorted-index-by.js +1 -1
  415. package/dist/sorted-index-with.cjs +1 -1
  416. package/dist/sorted-index-with.js +1 -1
  417. package/dist/sorted-index.cjs +1 -1
  418. package/dist/sorted-index.js +1 -1
  419. package/dist/sorted-last-index-by.cjs +1 -1
  420. package/dist/sorted-last-index-by.js +1 -1
  421. package/dist/sorted-last-index.cjs +1 -1
  422. package/dist/sorted-last-index.js +1 -1
  423. package/dist/splice.cjs +1 -1
  424. package/dist/splice.js +1 -1
  425. package/dist/split-at.cjs +1 -1
  426. package/dist/split-at.js +1 -1
  427. package/dist/split-when.cjs +1 -1
  428. package/dist/split-when.js +1 -1
  429. package/dist/split.cjs +1 -1
  430. package/dist/split.js +1 -1
  431. package/dist/string-to-path.cjs +1 -1
  432. package/dist/string-to-path.d.cts +33 -11
  433. package/dist/string-to-path.d.ts +33 -11
  434. package/dist/string-to-path.js +1 -1
  435. package/dist/subtract.cjs +1 -1
  436. package/dist/subtract.js +1 -1
  437. package/dist/sum-by.cjs +1 -1
  438. package/dist/sum-by.js +1 -1
  439. package/dist/sum.cjs +1 -1
  440. package/dist/sum.js +1 -1
  441. package/dist/swap-indices.cjs +1 -1
  442. package/dist/swap-indices.js +1 -1
  443. package/dist/swap-props.cjs +1 -1
  444. package/dist/swap-props.js +1 -1
  445. package/dist/take-first-by.cjs +1 -1
  446. package/dist/take-first-by.d.cts +1 -1
  447. package/dist/take-first-by.d.ts +1 -1
  448. package/dist/take-first-by.js +1 -1
  449. package/dist/take-last-while.cjs +1 -1
  450. package/dist/take-last-while.d.cts +2 -0
  451. package/dist/take-last-while.d.ts +2 -0
  452. package/dist/take-last-while.js +1 -1
  453. package/dist/take-last.cjs +1 -1
  454. package/dist/take-last.js +1 -1
  455. package/dist/take-while.cjs +1 -1
  456. package/dist/take-while.d.cts +2 -0
  457. package/dist/take-while.d.ts +2 -0
  458. package/dist/take-while.js +1 -1
  459. package/dist/take.cjs +1 -1
  460. package/dist/take.js +1 -1
  461. package/dist/tap.cjs +1 -1
  462. package/dist/tap.js +1 -1
  463. package/dist/times.cjs +1 -1
  464. package/dist/times.d.cts +1 -9
  465. package/dist/times.d.ts +1 -9
  466. package/dist/times.js +1 -1
  467. package/dist/to-camel-case.cjs +1 -1
  468. package/dist/to-camel-case.js +1 -1
  469. package/dist/to-capital-case.cjs +1 -1
  470. package/dist/to-capital-case.js +1 -1
  471. package/dist/to-constant-case.cjs +1 -1
  472. package/dist/to-constant-case.js +1 -1
  473. package/dist/to-kebab-case.cjs +1 -1
  474. package/dist/to-kebab-case.js +1 -1
  475. package/dist/to-no-case.cjs +1 -1
  476. package/dist/to-no-case.js +1 -1
  477. package/dist/to-pascal-case.cjs +1 -1
  478. package/dist/to-pascal-case.js +1 -1
  479. package/dist/to-pascal-snake-case.cjs +1 -1
  480. package/dist/to-pascal-snake-case.js +1 -1
  481. package/dist/to-sentence-case.cjs +1 -1
  482. package/dist/to-sentence-case.js +1 -1
  483. package/dist/to-snake-case.cjs +1 -1
  484. package/dist/to-snake-case.js +1 -1
  485. package/dist/to-string-DO8zw6jS.d.cts +11 -0
  486. package/dist/to-string-DO8zw6jS.d.ts +11 -0
  487. package/dist/to-train-case.cjs +1 -1
  488. package/dist/to-train-case.js +1 -1
  489. package/dist/tuple-parts-BTivqbtT.d.ts +86 -0
  490. package/dist/tuple-parts-v6av7LMU.d.cts +86 -0
  491. package/dist/unique-by.cjs +1 -1
  492. package/dist/unique-by.js +1 -1
  493. package/dist/unique-with.cjs +1 -1
  494. package/dist/unique-with.js +1 -1
  495. package/dist/unique.cjs +1 -1
  496. package/dist/unique.js +1 -1
  497. package/dist/{upsert-prop-tIHFi_F_.d.cts → upsert-prop-Cc3jEW9l.d.cts} +1 -2
  498. package/dist/{upsert-prop-D0N8486l.d.ts → upsert-prop-CdUtD50i.d.ts} +1 -2
  499. package/dist/values.cjs +1 -1
  500. package/dist/values.d.cts +1 -1
  501. package/dist/values.d.ts +1 -1
  502. package/dist/values.js +1 -1
  503. package/dist/zip-with.cjs +1 -1
  504. package/dist/zip-with.js +1 -1
  505. package/dist/zip.cjs +1 -1
  506. package/dist/zip.js +1 -1
  507. package/package.json +12 -12
  508. package/dist/chunk-2MU3SHCO.js +0 -1
  509. package/dist/chunk-3CFBQYOQ.js +0 -1
  510. package/dist/chunk-5SAUYUEK.js +0 -1
  511. package/dist/chunk-5VXKW6SI.cjs +0 -1
  512. package/dist/chunk-6HSB3NFW.js +0 -1
  513. package/dist/chunk-6L5XEBJG.js +0 -1
  514. package/dist/chunk-A2PAJNYA.js +0 -1
  515. package/dist/chunk-APUBIDDU.cjs +0 -1
  516. package/dist/chunk-AWXJSK4F.js +0 -1
  517. package/dist/chunk-B5QDOWVQ.cjs +0 -1
  518. package/dist/chunk-B7RHAPUE.js +0 -1
  519. package/dist/chunk-BOOMUHPG.js +0 -1
  520. package/dist/chunk-CZLV6ZLZ.js +0 -1
  521. package/dist/chunk-DLXKXNZT.js +0 -1
  522. package/dist/chunk-F3JXHUP4.cjs +0 -1
  523. package/dist/chunk-FMUPPQZE.js +0 -1
  524. package/dist/chunk-GFQXVPLP.cjs +0 -1
  525. package/dist/chunk-GOUUMCT7.cjs +0 -1
  526. package/dist/chunk-HRK4GMT2.cjs +0 -1
  527. package/dist/chunk-I7K3Z4BT.js +0 -1
  528. package/dist/chunk-ICYGL2YZ.js +0 -1
  529. package/dist/chunk-IJ4I5A3K.js +0 -1
  530. package/dist/chunk-IXGOK22A.cjs +0 -1
  531. package/dist/chunk-L4ITKDYB.cjs +0 -1
  532. package/dist/chunk-MBC7VZHY.js +0 -1
  533. package/dist/chunk-NQGMUM3E.cjs +0 -1
  534. package/dist/chunk-OBWPUDD3.cjs +0 -1
  535. package/dist/chunk-OEJ5J23C.js +0 -1
  536. package/dist/chunk-OL2TQDYM.cjs +0 -1
  537. package/dist/chunk-PIF5X7RQ.cjs +0 -1
  538. package/dist/chunk-PWHX2554.js +0 -1
  539. package/dist/chunk-QQMFHVPX.cjs +0 -1
  540. package/dist/chunk-SQZULO7V.js +0 -1
  541. package/dist/chunk-THE6MSJO.cjs +0 -1
  542. package/dist/chunk-UDSRBKNR.js +0 -1
  543. package/dist/chunk-UUYCL4G2.js +0 -1
  544. package/dist/chunk-VRZNQSZN.cjs +0 -1
  545. package/dist/chunk-WYM2JV5T.cjs +0 -1
  546. package/dist/chunk-XLGD5ZUY.cjs +0 -1
  547. package/dist/chunk-XU4TDKMD.cjs +0 -1
  548. package/dist/chunk-YCM6N46T.js +0 -1
  549. package/dist/chunk-Z46FX2Y4.js +0 -1
  550. package/dist/enumerable-string-keyed-value-of-CLzltniW.d.cts +0 -15
  551. package/dist/enumerable-string-keyed-value-of-CLzltniW.d.ts +0 -15
  552. package/dist/exact-record-Dhbe_K-E.d.ts +0 -5
  553. package/dist/exact-record-_isi2JMR.d.cts +0 -5
  554. package/dist/funnel.remeda-debounce.test.cjs +0 -1
  555. package/dist/funnel.remeda-debounce.test.js +0 -1
  556. package/dist/if-bounded-record-Drd4UbBU.d.cts +0 -29
  557. package/dist/if-bounded-record-Drd4UbBU.d.ts +0 -29
  558. package/dist/n-tuple-5jljrt4c.d.cts +0 -10
  559. package/dist/n-tuple-5jljrt4c.d.ts +0 -10
  560. package/dist/reconstructed-record-DchLaSO8.d.cts +0 -10
  561. package/dist/reconstructed-record-DuxOLlMs.d.ts +0 -10
  562. package/dist/take-last-while.spec-d-.cjs +0 -1
  563. package/dist/take-last-while.spec-d-.d.cts +0 -2
  564. package/dist/take-last-while.spec-d-.d.ts +0 -2
  565. package/dist/take-last-while.spec-d-.js +0 -1
  566. package/dist/tuple-parts-CP0H7BrE.d.cts +0 -37
  567. package/dist/tuple-parts-CP0H7BrE.d.ts +0 -37
  568. /package/dist/{funnel.remeda-debounce.test.d.cts → funnel.perkakas-debounce.test.d.cts} +0 -0
  569. /package/dist/{funnel.remeda-debounce.test.d.ts → funnel.perkakas-debounce.test.d.ts} +0 -0
@@ -1 +1 @@
1
- import{a as d}from"./chunk-IJ4I5A3K.js";import{a as p}from"./chunk-AWXJSK4F.js";import{a as m}from"./chunk-AFO7BV2X.js";import"./chunk-J6WPJH72.js";import"./chunk-KGPDVVVV.js";function i(e,a,n=0){let l=p(s=>{e(s.map(({params:t})=>t)).then(t=>{for(let[o,{params:r,promiseCallbacks:[c]}]of s.entries()){let y=a(t,o,...r);c(y)}}).catch(t=>{for(let{promiseCallbacks:[,o]}of s)o(t)})},{reducer:(s,t)=>[...s??[],t],maxBurstDurationMs:n,triggerAt:"end"});return{...l,call:async(...s)=>new Promise((...t)=>{l.call({promiseCallbacks:t,params:s})})}}describe("showcase",()=>{it("results as object",async()=>{let e=vi.fn(async o=>d(o,r=>r.length)),a=i(async o=>await e(o.flat()),(o,r,c)=>o[c]),n=[a.call("short"),a.call("medium"),a.call("loooooooooooooong")];expect(e).toHaveBeenCalledTimes(0);let[l,s,t]=await Promise.all(n);expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["short","medium","loooooooooooooong"]),expect(e).toHaveLastResolvedWith({short:5,medium:6,loooooooooooooong:17}),expect(l).toBe(5),expect(s).toBe(6),expect(t).toBe(17)}),it("results as array",async()=>{let e=vi.fn(async o=>o.map(r=>r.length)),a=i(async o=>await e(o.flat()),(o,r)=>o[r]),n=[a.call("short"),a.call("medium"),a.call("loooooooooooooong")];expect(e).toHaveBeenCalledTimes(0);let[l,s,t]=await Promise.all(n);expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["short","medium","loooooooooooooong"]),expect(e).toHaveLastResolvedWith([5,6,17]),expect(l).toBe(5),expect(s).toBe(6),expect(t).toBe(17)}),it("error handling",async()=>{let e=i(async a=>{if(a.length>1)throw new Error(`Batch too big! ${JSON.stringify(a)}`)},m());await expect(e.call("a")).resolves.toBeUndefined(),await expect(Promise.all([e.call("hello"),e.call("world")])).rejects.toThrow('Batch too big! [["hello"],["world"]]')})});
1
+ import{a as h}from"./chunk-TVMG2NYC.js";import{a as R,b as c,c as e,d}from"./chunk-Z23BZCCD.js";import{a as p}from"./chunk-YWIXN5BR.js";import{a as u}from"./chunk-AFO7BV2X.js";import"./chunk-J6WPJH72.js";import"./chunk-KGPDVVVV.js";import"./chunk-EK7ODJWE.js";function y(o,r,i=0){let n=p(s=>{o(s.map(({params:t})=>t)).then(t=>{for(let[a,{params:l,promiseCallbacks:[m]}]of s.entries()){let g=r(t,a,...l);m(g)}}).catch(t=>{for(let{promiseCallbacks:[,a]}of s)a(t)})},{reducer:(s,t)=>[...s??[],t],maxBurstDurationMs:i,triggerAt:"end"});return{...n,call:async(...s)=>new Promise((...t)=>{n.call({promiseCallbacks:t,params:s})})}}R("showcase",()=>{c("results as object",async()=>{let o=d.fn(async a=>h(a,l=>l.length)),r=y(async a=>await o(a.flat()),(a,l,m)=>a[m]),i=[r.call("short"),r.call("medium"),r.call("loooooooooooooong")];e(o).toHaveBeenCalledTimes(0);let[n,s,t]=await Promise.all(i);e(o).toHaveBeenCalledTimes(1),e(o).toHaveBeenLastCalledWith(["short","medium","loooooooooooooong"]),e(o).toHaveLastResolvedWith({short:5,medium:6,loooooooooooooong:17}),e(n).toBe(5),e(s).toBe(6),e(t).toBe(17)}),c("results as array",async()=>{let o=d.fn(async a=>a.map(l=>l.length)),r=y(async a=>await o(a.flat()),(a,l)=>a[l]),i=[r.call("short"),r.call("medium"),r.call("loooooooooooooong")];e(o).toHaveBeenCalledTimes(0);let[n,s,t]=await Promise.all(i);e(o).toHaveBeenCalledTimes(1),e(o).toHaveBeenLastCalledWith(["short","medium","loooooooooooooong"]),e(o).toHaveLastResolvedWith([5,6,17]),e(n).toBe(5),e(s).toBe(6),e(t).toBe(17)}),c("error handling",async()=>{let o=y(async r=>{if(r.length>1)throw new Error(`Batch too big! ${JSON.stringify(r)}`)},u());await e(o.call("a")).resolves.toBeUndefined(),await e(Promise.all([o.call("hello"),o.call("world")])).rejects.toThrow('Batch too big! [["hello"],["world"]]')})});
@@ -1 +1 @@
1
- "use strict";var _chunkGOUUMCT7cjs = require('./chunk-GOUUMCT7.cjs');var _chunkWYRK6YJUcjs = require('./chunk-WYRK6YJU.cjs');describe("'call' method args",()=>{test("no args",()=>{let e=_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:a=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()}),test("non-optional args",()=>{let e=_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:(a,n,s,o)=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()}),test("optional args",()=>{let e=_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:(a,n)=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()}),test("rest args",()=>{let e=_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:(a,...n)=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()})});describe("derive the reducer accumulator type from the executor param",()=>{test("simple types",()=>{_chunkGOUUMCT7cjs.a.call(void 0, e=>{},{reducer:e=>(expectTypeOf(e).toEqualTypeOf(),e),triggerAt:"start"})}),test("arrays",()=>{_chunkGOUUMCT7cjs.a.call(void 0, e=>{},{reducer:e=>(expectTypeOf(e).toEqualTypeOf(),e),triggerAt:"start"})}),test("objects",()=>{_chunkGOUUMCT7cjs.a.call(void 0, e=>{},{reducer:e=>(expectTypeOf(e).toEqualTypeOf(),e),triggerAt:"start"})})});describe("prevent bad options",()=>{test("minGapMs cannot be the only option with timing: end",()=>{_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{minGapMs:100}),_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{triggerAt:"end",minGapMs:100}),_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{triggerAt:"start",minGapMs:100}),_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{triggerAt:"both",minGapMs:100})})});
1
+ "use strict";var _chunkP7RCAO7Pcjs = require('./chunk-P7RCAO7P.cjs');var _chunkRMOD5JNBcjs = require('./chunk-RMOD5JNB.cjs');var _chunkWYRK6YJUcjs = require('./chunk-WYRK6YJU.cjs');require('./chunk-MBGSSEZN.cjs');_chunkP7RCAO7Pcjs.a.call(void 0, "'call' method args",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "no args",()=>{let t=_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:s=>"test",triggerAt:"start"});(0,_chunkP7RCAO7Pcjs.e.expectTypeOf)(t.call).parameters.toEqualTypeOf()}),_chunkP7RCAO7Pcjs.b.call(void 0, "non-optional args",()=>{let t=_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:(s,i,u,g)=>"test",triggerAt:"start"});(0,_chunkP7RCAO7Pcjs.e.expectTypeOf)(t.call).parameters.toEqualTypeOf()}),_chunkP7RCAO7Pcjs.b.call(void 0, "optional args",()=>{let t=_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:(s,i)=>"test",triggerAt:"start"});(0,_chunkP7RCAO7Pcjs.e.expectTypeOf)(t.call).parameters.toEqualTypeOf()}),_chunkP7RCAO7Pcjs.b.call(void 0, "rest args",()=>{let t=_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:(s,...i)=>"test",triggerAt:"start"});(0,_chunkP7RCAO7Pcjs.e.expectTypeOf)(t.call).parameters.toEqualTypeOf()})});_chunkP7RCAO7Pcjs.a.call(void 0, "derive the reducer accumulator type from the executor param",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "simple types",()=>{_chunkRMOD5JNBcjs.a.call(void 0, t=>{},{reducer:t=>((0,_chunkP7RCAO7Pcjs.e.expectTypeOf)(t).toEqualTypeOf(),t),triggerAt:"start"})}),_chunkP7RCAO7Pcjs.b.call(void 0, "arrays",()=>{_chunkRMOD5JNBcjs.a.call(void 0, t=>{},{reducer:t=>((0,_chunkP7RCAO7Pcjs.e.expectTypeOf)(t).toEqualTypeOf(),t),triggerAt:"start"})}),_chunkP7RCAO7Pcjs.b.call(void 0, "objects",()=>{_chunkRMOD5JNBcjs.a.call(void 0, t=>{},{reducer:t=>((0,_chunkP7RCAO7Pcjs.e.expectTypeOf)(t).toEqualTypeOf(),t),triggerAt:"start"})})});_chunkP7RCAO7Pcjs.a.call(void 0, "prevent bad options",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "minGapMs cannot be the only option with timing: end",()=>{_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{minGapMs:100}),_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{triggerAt:"end",minGapMs:100}),_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{triggerAt:"start",minGapMs:100}),_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{triggerAt:"both",minGapMs:100})})});
@@ -1 +1 @@
1
- import{a as t}from"./chunk-AWXJSK4F.js";import{a as r}from"./chunk-AFO7BV2X.js";describe("'call' method args",()=>{test("no args",()=>{let e=t(r(),{reducer:a=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()}),test("non-optional args",()=>{let e=t(r(),{reducer:(a,n,s,o)=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()}),test("optional args",()=>{let e=t(r(),{reducer:(a,n)=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()}),test("rest args",()=>{let e=t(r(),{reducer:(a,...n)=>"test",triggerAt:"start"});expectTypeOf(e.call).parameters.toEqualTypeOf()})});describe("derive the reducer accumulator type from the executor param",()=>{test("simple types",()=>{t(e=>{},{reducer:e=>(expectTypeOf(e).toEqualTypeOf(),e),triggerAt:"start"})}),test("arrays",()=>{t(e=>{},{reducer:e=>(expectTypeOf(e).toEqualTypeOf(),e),triggerAt:"start"})}),test("objects",()=>{t(e=>{},{reducer:e=>(expectTypeOf(e).toEqualTypeOf(),e),triggerAt:"start"})})});describe("prevent bad options",()=>{test("minGapMs cannot be the only option with timing: end",()=>{t(r(),{minGapMs:100}),t(r(),{triggerAt:"end",minGapMs:100}),t(r(),{triggerAt:"start",minGapMs:100}),t(r(),{triggerAt:"both",minGapMs:100})})});
1
+ import{a as o,b as a,e as n}from"./chunk-Z23BZCCD.js";import{a as e}from"./chunk-YWIXN5BR.js";import{a as r}from"./chunk-AFO7BV2X.js";import"./chunk-EK7ODJWE.js";o("'call' method args",()=>{a("no args",()=>{let t=e(r(),{reducer:s=>"test",triggerAt:"start"});(0,n.expectTypeOf)(t.call).parameters.toEqualTypeOf()}),a("non-optional args",()=>{let t=e(r(),{reducer:(s,i,u,g)=>"test",triggerAt:"start"});(0,n.expectTypeOf)(t.call).parameters.toEqualTypeOf()}),a("optional args",()=>{let t=e(r(),{reducer:(s,i)=>"test",triggerAt:"start"});(0,n.expectTypeOf)(t.call).parameters.toEqualTypeOf()}),a("rest args",()=>{let t=e(r(),{reducer:(s,...i)=>"test",triggerAt:"start"});(0,n.expectTypeOf)(t.call).parameters.toEqualTypeOf()})});o("derive the reducer accumulator type from the executor param",()=>{a("simple types",()=>{e(t=>{},{reducer:t=>((0,n.expectTypeOf)(t).toEqualTypeOf(),t),triggerAt:"start"})}),a("arrays",()=>{e(t=>{},{reducer:t=>((0,n.expectTypeOf)(t).toEqualTypeOf(),t),triggerAt:"start"})}),a("objects",()=>{e(t=>{},{reducer:t=>((0,n.expectTypeOf)(t).toEqualTypeOf(),t),triggerAt:"start"})})});o("prevent bad options",()=>{a("minGapMs cannot be the only option with timing: end",()=>{e(r(),{minGapMs:100}),e(r(),{triggerAt:"end",minGapMs:100}),e(r(),{triggerAt:"start",minGapMs:100}),e(r(),{triggerAt:"both",minGapMs:100})})});
@@ -1 +1 @@
1
- "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkHC3HZK4Qcjs = require('./chunk-HC3HZK4Q.cjs');var _chunkGOUUMCT7cjs = require('./chunk-GOUUMCT7.cjs');var _chunkWYRK6YJUcjs = require('./chunk-WYRK6YJU.cjs');var _chunkWLNQOMKLcjs = require('./chunk-WLNQOMKL.cjs');var a=16;function i(e,t){return e===void 0?[t]:[...e,t]}describe("reducer behavior",()=>{it("passes the reduced arg to the executor",()=>{let e=vi.fn();_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:_chunkWLNQOMKLcjs.a.call(void 0, "hello world"),triggerAt:"start",minQuietPeriodMs:a}).call(),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith("hello world")}),it("reduces call args",async()=>{let e=vi.fn(n=>{}),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:(n,o)=>(_nullishCoalesce(n, () => (0)))+o,minQuietPeriodMs:2*a,triggerAt:"end"});t.call(1),t.call(2),t.call(3),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call(4),t.call(5),t.call(6),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(21)}),it("does not invoke if reduceArgs returns undefined",async()=>{let e=vi.fn();_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:_chunkWLNQOMKLcjs.a.call(void 0, void 0),triggerAt:"end",minQuietPeriodMs:a}).call(),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*a),expect(e).toHaveBeenCalledTimes(0)}),it("supports multiple arguments",()=>{let e=vi.fn();_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:(n,o,r,m)=>[n,o,r,m],triggerAt:"start",minQuietPeriodMs:a}).call(1,"a",!0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith([void 0,1,"a",!0])}),it("reducer isn't called again when 'invokedAt: start'",async()=>{let e=vi.fn(i),t=_chunkGOUUMCT7cjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:e,triggerAt:"start",minQuietPeriodMs:a});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(void 0,"a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*a),expect(e).toHaveBeenCalledTimes(1)})});describe("non-trivial (>0ms) timer duration",()=>{describe("delay timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"start",minGapMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1),t.call("d"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"])}),it("invokedAt: both",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minGapMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("invocations in the middle of a window",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minGapMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])})}),describe("burst timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"start",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1),t.call("d"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"])}),it("invokedAt: both",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(4),expect(e).toHaveBeenLastCalledWith(["e","f"])}),it("invokedAt: end",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),t.call("e"),t.call("f"),t.call("g"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["e","f","g"])}),it("invocations in the middle of a window",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, .9*a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, .1*a),expect(e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c","d","e","f"])}),it("maxBurstDurationMs limits the burst duration",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,minQuietPeriodMs:a,maxBurstDurationMs:2*a,triggerAt:"end"});t.call("a"),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*a),t.call("b"),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*a),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"])})}),describe("both timers",()=>{it("delay is longer than burst",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,minGapMs:2*a,minQuietPeriodMs:a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),it("burst is longer than delay",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,minGapMs:a,minQuietPeriodMs:2*a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),it("burst and delay are equal",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,minGapMs:a,minQuietPeriodMs:a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("delay and maxBurstDurationMs are equal",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,minGapMs:a,minQuietPeriodMs:2*a,maxBurstDurationMs:a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])})})});describe("immediate (===0) timer durations",()=>{describe("delay timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"start",minGapMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(2)}),it("invokedAt: both",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minGapMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("with a non-trivial burst timer",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minGapMs:0,minQuietPeriodMs:a});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"])})}),describe("burst timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"start",minQuietPeriodMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(2)}),it("invokedAt: both",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minQuietPeriodMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(4),expect(e).toHaveBeenLastCalledWith(["e","f"])}),it("invokedAt: end",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("with a non-trivial delay timer",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minGapMs:a,minQuietPeriodMs:0});t.call("a"),t.call("b"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"])}),it("burst timer with non-trivial maxBurstDuration",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,minQuietPeriodMs:0,maxBurstDurationMs:a,triggerAt:"end"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"])})}),it("both timers",async()=>{let e=vi.fn();_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0}).call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(1)}),it("maxBurstDurationMs = 0 limits the burst immediately",async()=>{let e=vi.fn();_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a,maxBurstDurationMs:0}).call("a"),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"])}),it("all timeouts zero",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0,maxBurstDurationMs:0});t.call("a"),t.call("b"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"])})});describe("default minQuietPeriodMs === 0 when minGapMs is not defined",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"start"});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(1),t.call("c"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["c"])}),it("invokedAt: both",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both"});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"]),t.call("c"),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["c"])})});describe("utility functions",()=>{describe("flush",()=>{it("flush triggers an immediate invocation",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),t.flush(),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1)}),it("flush during active burst",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:2*a});t.call("a"),t.call("b"),t.call("c"),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.flush(),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*a),expect(e).toHaveBeenCalledTimes(1)})}),describe("cancel",()=>{it("cancel prevents invocation",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),t.cancel(),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(0)}),it("cancel during delay period",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"start",minGapMs:2*a});t.call("a"),t.call("b"),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.cancel(),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1)})}),describe("isIdle",()=>{it("isIdle reflects the funnel's state",()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});expect(t.isIdle).toBe(!0),t.call("a"),expect(t.isIdle).toBe(!1),t.cancel(),expect(t.isIdle).toBe(!0)}),it("isIdle works when burst duration is 0",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"end",minQuietPeriodMs:0});expect(t.isIdle).toBe(!0),t.call("a"),t.call("b"),t.call("c"),expect(t.isIdle).toBe(!1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),expect(t.isIdle).toBe(!0)})})});describe("edge-cases",()=>{it("bursts that start late don't prevent delayed invocations",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minQuietPeriodMs:a,minGapMs:2*a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 1.5*a),expect(e).toHaveBeenCalledTimes(1),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, .5*a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),it("delay timeouts don't cause an invocation in the middle of bursts",async()=>{let e=vi.fn(),t=_chunkGOUUMCT7cjs.a.call(void 0, e,{reducer:i,triggerAt:"both",minQuietPeriodMs:2*a,minGapMs:a});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call("c"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),t.call("d"),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, a),expect(e).toHaveBeenCalledTimes(2)})});
1
+ "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkHC3HZK4Qcjs = require('./chunk-HC3HZK4Q.cjs');var _chunkP7RCAO7Pcjs = require('./chunk-P7RCAO7P.cjs');var _chunkRMOD5JNBcjs = require('./chunk-RMOD5JNB.cjs');var _chunkWYRK6YJUcjs = require('./chunk-WYRK6YJU.cjs');var _chunkWLNQOMKLcjs = require('./chunk-WLNQOMKL.cjs');require('./chunk-MBGSSEZN.cjs');var l=16;function c(e,a){return e===void 0?[a]:[...e,a]}_chunkP7RCAO7Pcjs.a.call(void 0, "reducer behavior",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "passes the reduced arg to the executor",()=>{let e=_chunkP7RCAO7Pcjs.d.fn();_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:_chunkWLNQOMKLcjs.a.call(void 0, "hello world"),triggerAt:"start",minQuietPeriodMs:l}).call(),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith("hello world")}),_chunkP7RCAO7Pcjs.b.call(void 0, "reduces call args",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(r=>{}),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:(r,m)=>(_nullishCoalesce(r, () => (0)))+m,minQuietPeriodMs:2*l,triggerAt:"end"});a.call(1),a.call(2),a.call(3),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call(4),a.call(5),a.call(6),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(21)}),_chunkP7RCAO7Pcjs.b.call(void 0, "does not invoke if reduceArgs returns undefined",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn();_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:_chunkWLNQOMKLcjs.a.call(void 0, void 0),triggerAt:"end",minQuietPeriodMs:l}).call(),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0)}),_chunkP7RCAO7Pcjs.b.call(void 0, "supports multiple arguments",()=>{let e=_chunkP7RCAO7Pcjs.d.fn();_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:(r,m,C,H)=>[r,m,C,H],triggerAt:"start",minQuietPeriodMs:l}).call(1,"a",!0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith([void 0,1,"a",!0])}),_chunkP7RCAO7Pcjs.b.call(void 0, "reducer isn't called again when 'invokedAt: start'",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(c),a=_chunkRMOD5JNBcjs.a.call(void 0, _chunkWYRK6YJUcjs.a.call(void 0, ),{reducer:e,triggerAt:"start",minQuietPeriodMs:l});a.call("a"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(void 0,"a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1)})});_chunkP7RCAO7Pcjs.a.call(void 0, "non-trivial (>0ms) timer duration",()=>{_chunkP7RCAO7Pcjs.a.call(void 0, "delay timer",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: start",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"start",minGapMs:l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),a.call("d"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: both",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minGapMs:l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c"]),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(3),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "invocations in the middle of a window",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minGapMs:l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*l),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c","d","e","f"])})}),_chunkP7RCAO7Pcjs.a.call(void 0, "burst timer",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: start",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"start",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),a.call("d"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: both",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c"]),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(3),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(4),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: end",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a","b","c"]),a.call("e"),a.call("f"),a.call("g"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["e","f","g"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "invocations in the middle of a window",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, .9*l),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, .1*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a","b","c","d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "maxBurstDurationMs limits the burst duration",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,minQuietPeriodMs:l,maxBurstDurationMs:2*l,triggerAt:"end"});a.call("a"),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*l),a.call("b"),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*l),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, .75*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a","b","c"])})}),_chunkP7RCAO7Pcjs.a.call(void 0, "both timers",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "delay is longer than burst",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,minGapMs:2*l,minQuietPeriodMs:l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "burst is longer than delay",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,minGapMs:l,minQuietPeriodMs:2*l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "burst and delay are equal",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,minGapMs:l,minQuietPeriodMs:l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(3),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "delay and maxBurstDurationMs are equal",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,minGapMs:l,minQuietPeriodMs:2*l,maxBurstDurationMs:l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(3),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d","e","f"])})})});_chunkP7RCAO7Pcjs.a.call(void 0, "immediate (===0) timer durations",()=>{_chunkP7RCAO7Pcjs.a.call(void 0, "delay timer",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: start",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"start",minGapMs:0});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2)}),_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: both",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minGapMs:0});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(3),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "with a non-trivial burst timer",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minGapMs:0,minQuietPeriodMs:l});a.call("a"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),a.call("b"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b"])})}),_chunkP7RCAO7Pcjs.a.call(void 0, "burst timer",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: start",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"start",minQuietPeriodMs:0});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2)}),_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: both",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minQuietPeriodMs:0});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c"]),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(3),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(4),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: end",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:0});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a","b","c"]),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "with a non-trivial delay timer",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minGapMs:l,minQuietPeriodMs:0});a.call("a"),a.call("b"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "burst timer with non-trivial maxBurstDuration",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,minQuietPeriodMs:0,maxBurstDurationMs:l,triggerAt:"end"});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a","b","c"])})}),_chunkP7RCAO7Pcjs.b.call(void 0, "both timers",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn();_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0}).call("a"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1)}),_chunkP7RCAO7Pcjs.b.call(void 0, "maxBurstDurationMs = 0 limits the burst immediately",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn();_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l,maxBurstDurationMs:0}).call("a"),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "all timeouts zero",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0,maxBurstDurationMs:0});a.call("a"),a.call("b"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b"])})});_chunkP7RCAO7Pcjs.a.call(void 0, "default minQuietPeriodMs === 0 when minGapMs is not defined",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: start",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"start"});a.call("a"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),a.call("b"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["c"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "invokedAt: both",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both"});a.call("a"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),a.call("b"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b"]),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(3),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["c"])})});_chunkP7RCAO7Pcjs.a.call(void 0, "utility functions",()=>{_chunkP7RCAO7Pcjs.a.call(void 0, "flush",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "flush triggers an immediate invocation",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),a.flush(),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a","b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1)}),_chunkP7RCAO7Pcjs.b.call(void 0, "flush during active burst",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:2*l});a.call("a"),a.call("b"),a.call("c"),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.flush(),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a","b","c"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 2*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1)})}),_chunkP7RCAO7Pcjs.a.call(void 0, "cancel",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "cancel prevents invocation",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),a.cancel(),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(0)}),_chunkP7RCAO7Pcjs.b.call(void 0, "cancel during delay period",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"start",minGapMs:2*l});a.call("a"),a.call("b"),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.cancel(),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1)})}),_chunkP7RCAO7Pcjs.a.call(void 0, "isIdle",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "isIdle reflects the funnel's state",()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});_chunkP7RCAO7Pcjs.c.call(void 0, a.isIdle).toBe(!0),a.call("a"),_chunkP7RCAO7Pcjs.c.call(void 0, a.isIdle).toBe(!1),a.cancel(),_chunkP7RCAO7Pcjs.c.call(void 0, a.isIdle).toBe(!0)}),_chunkP7RCAO7Pcjs.b.call(void 0, "isIdle works when burst duration is 0",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"end",minQuietPeriodMs:0});_chunkP7RCAO7Pcjs.c.call(void 0, a.isIdle).toBe(!0),a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, a.isIdle).toBe(!1),await _chunkHC3HZK4Qcjs.a.call(void 0, 0),_chunkP7RCAO7Pcjs.c.call(void 0, a.isIdle).toBe(!0)})})});_chunkP7RCAO7Pcjs.a.call(void 0, "edge-cases",()=>{_chunkP7RCAO7Pcjs.b.call(void 0, "bursts that start late don't prevent delayed invocations",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minQuietPeriodMs:l,minGapMs:2*l});a.call("a"),a.call("b"),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, 1.5*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),a.call("d"),a.call("e"),a.call("f"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, .5*l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),_chunkP7RCAO7Pcjs.b.call(void 0, "delay timeouts don't cause an invocation in the middle of bursts",async()=>{let e=_chunkP7RCAO7Pcjs.d.fn(),a=_chunkRMOD5JNBcjs.a.call(void 0, e,{reducer:c,triggerAt:"both",minQuietPeriodMs:2*l,minGapMs:l});a.call("a"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenLastCalledWith(["a"]),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call("b"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call("c"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),a.call("d"),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(1),await _chunkHC3HZK4Qcjs.a.call(void 0, l),_chunkP7RCAO7Pcjs.c.call(void 0, e).toHaveBeenCalledTimes(2)})});
@@ -1 +1 @@
1
- import{a as l}from"./chunk-6SYP2DRD.js";import{a as c}from"./chunk-AWXJSK4F.js";import{a as d}from"./chunk-AFO7BV2X.js";import{a as s}from"./chunk-T5XG33UI.js";var a=16;function i(e,t){return e===void 0?[t]:[...e,t]}describe("reducer behavior",()=>{it("passes the reduced arg to the executor",()=>{let e=vi.fn();c(e,{reducer:s("hello world"),triggerAt:"start",minQuietPeriodMs:a}).call(),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith("hello world")}),it("reduces call args",async()=>{let e=vi.fn(n=>{}),t=c(e,{reducer:(n,o)=>(n??0)+o,minQuietPeriodMs:2*a,triggerAt:"end"});t.call(1),t.call(2),t.call(3),await l(a),t.call(4),t.call(5),t.call(6),await l(2*a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(21)}),it("does not invoke if reduceArgs returns undefined",async()=>{let e=vi.fn();c(e,{reducer:s(void 0),triggerAt:"end",minQuietPeriodMs:a}).call(),await l(2*a),expect(e).toHaveBeenCalledTimes(0)}),it("supports multiple arguments",()=>{let e=vi.fn();c(e,{reducer:(n,o,r,m)=>[n,o,r,m],triggerAt:"start",minQuietPeriodMs:a}).call(1,"a",!0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith([void 0,1,"a",!0])}),it("reducer isn't called again when 'invokedAt: start'",async()=>{let e=vi.fn(i),t=c(d(),{reducer:e,triggerAt:"start",minQuietPeriodMs:a});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(void 0,"a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),await l(2*a),expect(e).toHaveBeenCalledTimes(1)})});describe("non-trivial (>0ms) timer duration",()=>{describe("delay timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"start",minGapMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),expect(e).toHaveBeenCalledTimes(1),t.call("d"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"])}),it("invokedAt: both",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minGapMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),await l(a),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("invocations in the middle of a window",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minGapMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(.75*a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await l(.75*a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])})}),describe("burst timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"start",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),expect(e).toHaveBeenCalledTimes(1),t.call("d"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"])}),it("invokedAt: both",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d"]),await l(a),expect(e).toHaveBeenCalledTimes(4),expect(e).toHaveBeenLastCalledWith(["e","f"])}),it("invokedAt: end",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await l(a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),t.call("e"),t.call("f"),t.call("g"),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["e","f","g"])}),it("invocations in the middle of a window",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await l(.9*a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(0),await l(.1*a),expect(e).toHaveBeenCalledTimes(0),await l(a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c","d","e","f"])}),it("maxBurstDurationMs limits the burst duration",async()=>{let e=vi.fn(),t=c(e,{reducer:i,minQuietPeriodMs:a,maxBurstDurationMs:2*a,triggerAt:"end"});t.call("a"),await l(.75*a),t.call("b"),await l(.75*a),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await l(.75*a),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"])})}),describe("both timers",()=>{it("delay is longer than burst",async()=>{let e=vi.fn(),t=c(e,{reducer:i,minGapMs:2*a,minQuietPeriodMs:a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),it("burst is longer than delay",async()=>{let e=vi.fn(),t=c(e,{reducer:i,minGapMs:a,minQuietPeriodMs:2*a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),it("burst and delay are equal",async()=>{let e=vi.fn(),t=c(e,{reducer:i,minGapMs:a,minQuietPeriodMs:a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),await l(a),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("delay and maxBurstDurationMs are equal",async()=>{let e=vi.fn(),t=c(e,{reducer:i,minGapMs:a,minQuietPeriodMs:2*a,maxBurstDurationMs:a,triggerAt:"both"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),await l(a),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])})})});describe("immediate (===0) timer durations",()=>{describe("delay timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"start",minGapMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(0),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"]),await l(0),expect(e).toHaveBeenCalledTimes(2)}),it("invokedAt: both",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minGapMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(0),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),await l(0),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("with a non-trivial burst timer",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minGapMs:0,minQuietPeriodMs:a});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"])})}),describe("burst timer",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"start",minQuietPeriodMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(0),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d"]),await l(0),expect(e).toHaveBeenCalledTimes(2)}),it("invokedAt: both",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minQuietPeriodMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["d"]),await l(0),expect(e).toHaveBeenCalledTimes(4),expect(e).toHaveBeenLastCalledWith(["e","f"])}),it("invokedAt: end",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:0});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await l(0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await l(0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["d","e","f"])}),it("with a non-trivial delay timer",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minGapMs:a,minQuietPeriodMs:0});t.call("a"),t.call("b"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(0),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"])}),it("burst timer with non-trivial maxBurstDuration",async()=>{let e=vi.fn(),t=c(e,{reducer:i,minQuietPeriodMs:0,maxBurstDurationMs:a,triggerAt:"end"});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(0),await l(0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"])})}),it("both timers",async()=>{let e=vi.fn();c(e,{reducer:i,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0}).call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(0),expect(e).toHaveBeenCalledTimes(1)}),it("maxBurstDurationMs = 0 limits the burst immediately",async()=>{let e=vi.fn();c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a,maxBurstDurationMs:0}).call("a"),await l(0),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"])}),it("all timeouts zero",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0,maxBurstDurationMs:0});t.call("a"),t.call("b"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"])})});describe("default minQuietPeriodMs === 0 when minGapMs is not defined",()=>{it("invokedAt: start",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"start"});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await l(0),expect(e).toHaveBeenCalledTimes(1),t.call("c"),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["c"])}),it("invokedAt: both",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both"});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await l(0),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b"]),t.call("c"),expect(e).toHaveBeenCalledTimes(3),expect(e).toHaveBeenLastCalledWith(["c"])})});describe("utility functions",()=>{describe("flush",()=>{it("flush triggers an immediate invocation",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),t.flush(),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),await l(a),expect(e).toHaveBeenCalledTimes(1)}),it("flush during active burst",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:2*a});t.call("a"),t.call("b"),t.call("c"),await l(a),t.flush(),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a","b","c"]),await l(2*a),expect(e).toHaveBeenCalledTimes(1)})}),describe("cancel",()=>{it("cancel prevents invocation",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});t.call("a"),t.call("b"),t.call("c"),t.cancel(),await l(a),expect(e).toHaveBeenCalledTimes(0)}),it("cancel during delay period",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"start",minGapMs:2*a});t.call("a"),t.call("b"),await l(a),t.cancel(),await l(a),expect(e).toHaveBeenCalledTimes(1)})}),describe("isIdle",()=>{it("isIdle reflects the funnel's state",()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:a});expect(t.isIdle).toBe(!0),t.call("a"),expect(t.isIdle).toBe(!1),t.cancel(),expect(t.isIdle).toBe(!0)}),it("isIdle works when burst duration is 0",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"end",minQuietPeriodMs:0});expect(t.isIdle).toBe(!0),t.call("a"),t.call("b"),t.call("c"),expect(t.isIdle).toBe(!1),await l(0),expect(t.isIdle).toBe(!0)})})});describe("edge-cases",()=>{it("bursts that start late don't prevent delayed invocations",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minQuietPeriodMs:a,minGapMs:2*a});t.call("a"),t.call("b"),t.call("c"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(1.5*a),expect(e).toHaveBeenCalledTimes(1),t.call("d"),t.call("e"),t.call("f"),expect(e).toHaveBeenCalledTimes(1),await l(.5*a),expect(e).toHaveBeenCalledTimes(2),expect(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),it("delay timeouts don't cause an invocation in the middle of bursts",async()=>{let e=vi.fn(),t=c(e,{reducer:i,triggerAt:"both",minQuietPeriodMs:2*a,minGapMs:a});t.call("a"),expect(e).toHaveBeenCalledTimes(1),expect(e).toHaveBeenLastCalledWith(["a"]),await l(a),t.call("b"),expect(e).toHaveBeenCalledTimes(1),await l(a),t.call("c"),expect(e).toHaveBeenCalledTimes(1),await l(a),t.call("d"),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(1),await l(a),expect(e).toHaveBeenCalledTimes(2)})});
1
+ import{a as n}from"./chunk-6SYP2DRD.js";import{a as d,b as o,c as t,d as i}from"./chunk-Z23BZCCD.js";import{a as s}from"./chunk-YWIXN5BR.js";import{a as B}from"./chunk-AFO7BV2X.js";import{a as v}from"./chunk-T5XG33UI.js";import"./chunk-EK7ODJWE.js";var l=16;function c(e,a){return e===void 0?[a]:[...e,a]}d("reducer behavior",()=>{o("passes the reduced arg to the executor",()=>{let e=i.fn();s(e,{reducer:v("hello world"),triggerAt:"start",minQuietPeriodMs:l}).call(),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith("hello world")}),o("reduces call args",async()=>{let e=i.fn(r=>{}),a=s(e,{reducer:(r,m)=>(r??0)+m,minQuietPeriodMs:2*l,triggerAt:"end"});a.call(1),a.call(2),a.call(3),await n(l),a.call(4),a.call(5),a.call(6),await n(2*l),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(21)}),o("does not invoke if reduceArgs returns undefined",async()=>{let e=i.fn();s(e,{reducer:v(void 0),triggerAt:"end",minQuietPeriodMs:l}).call(),await n(2*l),t(e).toHaveBeenCalledTimes(0)}),o("supports multiple arguments",()=>{let e=i.fn();s(e,{reducer:(r,m,C,H)=>[r,m,C,H],triggerAt:"start",minQuietPeriodMs:l}).call(1,"a",!0),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith([void 0,1,"a",!0])}),o("reducer isn't called again when 'invokedAt: start'",async()=>{let e=i.fn(c),a=s(B(),{reducer:e,triggerAt:"start",minQuietPeriodMs:l});a.call("a"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(void 0,"a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),await n(2*l),t(e).toHaveBeenCalledTimes(1)})});d("non-trivial (>0ms) timer duration",()=>{d("delay timer",()=>{o("invokedAt: start",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"start",minGapMs:l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),t(e).toHaveBeenCalledTimes(1),a.call("d"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["d"])}),o("invokedAt: both",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minGapMs:l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c"]),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(2),await n(l),t(e).toHaveBeenCalledTimes(3),t(e).toHaveBeenLastCalledWith(["d","e","f"])}),o("invocations in the middle of a window",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minGapMs:l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(.75*l),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(1),await n(.75*l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])})}),d("burst timer",()=>{o("invokedAt: start",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"start",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),t(e).toHaveBeenCalledTimes(1),a.call("d"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["d"])}),o("invokedAt: both",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c"]),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(3),t(e).toHaveBeenLastCalledWith(["d"]),await n(l),t(e).toHaveBeenCalledTimes(4),t(e).toHaveBeenLastCalledWith(["e","f"])}),o("invokedAt: end",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(0),await n(l),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a","b","c"]),a.call("e"),a.call("f"),a.call("g"),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["e","f","g"])}),o("invocations in the middle of a window",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(0),await n(.9*l),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(0),await n(.1*l),t(e).toHaveBeenCalledTimes(0),await n(l),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a","b","c","d","e","f"])}),o("maxBurstDurationMs limits the burst duration",async()=>{let e=i.fn(),a=s(e,{reducer:c,minQuietPeriodMs:l,maxBurstDurationMs:2*l,triggerAt:"end"});a.call("a"),await n(.75*l),a.call("b"),await n(.75*l),a.call("c"),t(e).toHaveBeenCalledTimes(0),await n(.75*l),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a","b","c"])})}),d("both timers",()=>{o("delay is longer than burst",async()=>{let e=i.fn(),a=s(e,{reducer:c,minGapMs:2*l,minQuietPeriodMs:l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),o("burst is longer than delay",async()=>{let e=i.fn(),a=s(e,{reducer:c,minGapMs:l,minQuietPeriodMs:2*l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),o("burst and delay are equal",async()=>{let e=i.fn(),a=s(e,{reducer:c,minGapMs:l,minQuietPeriodMs:l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c"]),await n(l),t(e).toHaveBeenCalledTimes(3),t(e).toHaveBeenLastCalledWith(["d","e","f"])}),o("delay and maxBurstDurationMs are equal",async()=>{let e=i.fn(),a=s(e,{reducer:c,minGapMs:l,minQuietPeriodMs:2*l,maxBurstDurationMs:l,triggerAt:"both"});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c"]),await n(l),t(e).toHaveBeenCalledTimes(3),t(e).toHaveBeenLastCalledWith(["d","e","f"])})})});d("immediate (===0) timer durations",()=>{d("delay timer",()=>{o("invokedAt: start",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"start",minGapMs:0});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(0),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["d"]),await n(0),t(e).toHaveBeenCalledTimes(2)}),o("invokedAt: both",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minGapMs:0});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(0),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c"]),await n(0),t(e).toHaveBeenCalledTimes(3),t(e).toHaveBeenLastCalledWith(["d","e","f"])}),o("with a non-trivial burst timer",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minGapMs:0,minQuietPeriodMs:l});a.call("a"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),a.call("b"),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b"])})}),d("burst timer",()=>{o("invokedAt: start",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"start",minQuietPeriodMs:0});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(0),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["d"]),await n(0),t(e).toHaveBeenCalledTimes(2)}),o("invokedAt: both",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minQuietPeriodMs:0});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(0),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c"]),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(3),t(e).toHaveBeenLastCalledWith(["d"]),await n(0),t(e).toHaveBeenCalledTimes(4),t(e).toHaveBeenLastCalledWith(["e","f"])}),o("invokedAt: end",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:0});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(0),await n(0),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a","b","c"]),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(1),await n(0),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["d","e","f"])}),o("with a non-trivial delay timer",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minGapMs:l,minQuietPeriodMs:0});a.call("a"),a.call("b"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(0),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b"])}),o("burst timer with non-trivial maxBurstDuration",async()=>{let e=i.fn(),a=s(e,{reducer:c,minQuietPeriodMs:0,maxBurstDurationMs:l,triggerAt:"end"});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(0),await n(0),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a","b","c"])})}),o("both timers",async()=>{let e=i.fn();s(e,{reducer:c,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0}).call("a"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(0),t(e).toHaveBeenCalledTimes(1)}),o("maxBurstDurationMs = 0 limits the burst immediately",async()=>{let e=i.fn();s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l,maxBurstDurationMs:0}).call("a"),await n(0),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"])}),o("all timeouts zero",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minGapMs:0,minQuietPeriodMs:0,maxBurstDurationMs:0});a.call("a"),a.call("b"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(0),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b"])})});d("default minQuietPeriodMs === 0 when minGapMs is not defined",()=>{o("invokedAt: start",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"start"});a.call("a"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),a.call("b"),t(e).toHaveBeenCalledTimes(1),await n(0),t(e).toHaveBeenCalledTimes(1),a.call("c"),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["c"])}),o("invokedAt: both",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both"});a.call("a"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),a.call("b"),t(e).toHaveBeenCalledTimes(1),await n(0),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b"]),a.call("c"),t(e).toHaveBeenCalledTimes(3),t(e).toHaveBeenLastCalledWith(["c"])})});d("utility functions",()=>{d("flush",()=>{o("flush triggers an immediate invocation",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),a.flush(),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a","b","c"]),await n(l),t(e).toHaveBeenCalledTimes(1)}),o("flush during active burst",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:2*l});a.call("a"),a.call("b"),a.call("c"),await n(l),a.flush(),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a","b","c"]),await n(2*l),t(e).toHaveBeenCalledTimes(1)})}),d("cancel",()=>{o("cancel prevents invocation",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});a.call("a"),a.call("b"),a.call("c"),a.cancel(),await n(l),t(e).toHaveBeenCalledTimes(0)}),o("cancel during delay period",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"start",minGapMs:2*l});a.call("a"),a.call("b"),await n(l),a.cancel(),await n(l),t(e).toHaveBeenCalledTimes(1)})}),d("isIdle",()=>{o("isIdle reflects the funnel's state",()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:l});t(a.isIdle).toBe(!0),a.call("a"),t(a.isIdle).toBe(!1),a.cancel(),t(a.isIdle).toBe(!0)}),o("isIdle works when burst duration is 0",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"end",minQuietPeriodMs:0});t(a.isIdle).toBe(!0),a.call("a"),a.call("b"),a.call("c"),t(a.isIdle).toBe(!1),await n(0),t(a.isIdle).toBe(!0)})})});d("edge-cases",()=>{o("bursts that start late don't prevent delayed invocations",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minQuietPeriodMs:l,minGapMs:2*l});a.call("a"),a.call("b"),a.call("c"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(1.5*l),t(e).toHaveBeenCalledTimes(1),a.call("d"),a.call("e"),a.call("f"),t(e).toHaveBeenCalledTimes(1),await n(.5*l),t(e).toHaveBeenCalledTimes(2),t(e).toHaveBeenLastCalledWith(["b","c","d","e","f"])}),o("delay timeouts don't cause an invocation in the middle of bursts",async()=>{let e=i.fn(),a=s(e,{reducer:c,triggerAt:"both",minQuietPeriodMs:2*l,minGapMs:l});a.call("a"),t(e).toHaveBeenCalledTimes(1),t(e).toHaveBeenLastCalledWith(["a"]),await n(l),a.call("b"),t(e).toHaveBeenCalledTimes(1),await n(l),a.call("c"),t(e).toHaveBeenCalledTimes(1),await n(l),a.call("d"),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(1),await n(l),t(e).toHaveBeenCalledTimes(2)})});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHSNPZS6Rcjs = require('./chunk-HSNPZS6R.cjs');require('./chunk-XR72I63W.cjs');require('./chunk-GZJMERDJ.cjs');require('./chunk-MBGSSEZN.cjs');exports.groupByProp = _chunkHSNPZS6Rcjs.a;
@@ -0,0 +1,93 @@
1
+ import { ConditionalKeys, AllUnionFields, IfNever, Merge, And } from 'type-fest';
2
+ import { A as ArrayRequiredPrefix } from './array-required-prefix-Ck4lHkbA.cjs';
3
+ import { B as BoundedPartial } from './bounded-partial-BqwRN49U.cjs';
4
+ import { F as FilteredArray } from './filtered-array-BCjySbC6.cjs';
5
+ import { I as IterableContainer } from './iterable-container-BTpDVdNc.cjs';
6
+ import { T as TupleParts } from './tuple-parts-v6av7LMU.cjs';
7
+ import './clamped-integer-subtract-DZ7rsJE4.cjs';
8
+ import './coerced-array-DRz3tqda.cjs';
9
+ import './perkakas-type-error-8wPb8T2y.cjs';
10
+ import './if-D4QIikQ1.cjs';
11
+ import './is-bounded-record-C9WAwfA8.cjs';
12
+
13
+ type GroupByProp<T extends IterableContainer, Prop extends GroupableProps<T>> = T extends unknown ? FixEmptyObject<EnsureValuesAreNonEmpty<{
14
+ [Value in AllPropValues<T, Prop>]: FilteredArray<T, Record<Prop, Value>>;
15
+ }>> : never;
16
+ type GroupableProps<T extends IterableContainer> = ConditionalKeys<ItemsSuperObject<T>, PropertyKey | undefined>;
17
+ type AllPropValues<T extends IterableContainer, Prop extends GroupableProps<T>> = Extract<ItemsSuperObject<T>[Prop], PropertyKey>;
18
+ type ItemsSuperObject<T extends IterableContainer> = AllUnionFields<Exclude<T[number], undefined>>;
19
+ type FixEmptyObject<T> = IfNever<keyof T, Record<PropertyKey, never>, T>;
20
+ type EnsureValuesAreNonEmpty<T extends Record<PropertyKey, IterableContainer>> = Merge<T, BoundedPartial<{
21
+ [P in keyof T as IsPossiblyEmpty<T[P]> extends true ? P : never]: ArrayRequiredPrefix<T[P], 1>;
22
+ }>>;
23
+ type IsPossiblyEmpty<T extends IterableContainer> = And<IsEmpty<TupleParts<T>['required']>, IsEmpty<TupleParts<T>['suffix']>>;
24
+ type IsEmpty<T> = T extends readonly [] ? true : false;
25
+ /**
26
+ * Groups the elements of an array of objects based on the values of a
27
+ * specified property of those objects. The result would contain a property for
28
+ * each unique value of the specific property, with it's value being the input
29
+ * array filtered to only items that have that property set to that value.
30
+ * For any object where the property is missing, or if it's value is
31
+ * `undefined` the item would be filtered out.
32
+ *
33
+ * The grouping property is enforced at the type level to exist in at least one
34
+ * item and to never have a value that cannot be used as an object key (e.g. it
35
+ * must be `PropertyKey | undefined`).
36
+ *
37
+ * The resulting arrays are filtered with the prop and it's value as a
38
+ * type-guard, effectively narrowing the items in each output arrays. This
39
+ * means that when the grouping property is the discriminator of a
40
+ * discriminated union type each output array would contain just the subtype for
41
+ * that value.
42
+ *
43
+ * If you need more control over the grouping you should use `groupBy` instead.
44
+ *
45
+ * @param data - The items to group.
46
+ * @param prop - The property name to group by.
47
+ * @signature
48
+ * P.groupByProp(data, prop)
49
+ * @example
50
+ * const result = P.groupByProp(
51
+ * // ^? { cat: [{ a: 'cat' }], dog: [{ a: 'dog' }] }
52
+ * [{ a: 'cat' }, { a: 'dog' }] as const,
53
+ * 'a',
54
+ * );
55
+ * @dataFirst
56
+ * @category Array
57
+ */
58
+ declare function groupByProp<T extends IterableContainer, Prop extends GroupableProps<T>>(data: T, prop: Prop): GroupByProp<T, Prop>;
59
+ /**
60
+ * Groups the elements of an array of objects based on the values of a
61
+ * specified property of those objects. The result would contain a property for
62
+ * each unique value of the specific property, with it's value being the input
63
+ * array filtered to only items that have that property set to that value.
64
+ * For any object where the property is missing, or if it's value is
65
+ * `undefined` the item would be filtered out.
66
+ *
67
+ * The grouping property is enforced at the type level to exist in at least one
68
+ * item and to never have a value that cannot be used as an object key (e.g. it
69
+ * must be `PropertyKey | undefined`).
70
+ *
71
+ * The resulting arrays are filtered with the prop and it's value as a
72
+ * type-guard, effectively narrowing the items in each output arrays. This
73
+ * means that when the grouping property is the discriminator of a
74
+ * discriminated union type each output array would contain just the subtype for
75
+ * that value.
76
+ *
77
+ * If you need more control over the grouping you should use `groupBy` instead.
78
+ *
79
+ * @param prop - The property name to group by.
80
+ * @signature
81
+ * P.groupByProp(prop)(data);
82
+ * @example
83
+ * const result = P.pipe(
84
+ * // ^? { cat: [{ a: 'cat' }], dog: [{ a: 'dog' }] }
85
+ * [{ a: 'cat' }, { a: 'dog' }] as const,
86
+ * P.groupByProp('a'),
87
+ * );
88
+ * @dataLast
89
+ * @category Array
90
+ */
91
+ declare function groupByProp<T extends IterableContainer, Prop extends GroupableProps<T>>(prop: Prop): (data: T) => GroupByProp<T, Prop>;
92
+
93
+ export { groupByProp };
@@ -0,0 +1,93 @@
1
+ import { ConditionalKeys, AllUnionFields, IfNever, Merge, And } from 'type-fest';
2
+ import { A as ArrayRequiredPrefix } from './array-required-prefix-DXv_WnmG.js';
3
+ import { B as BoundedPartial } from './bounded-partial-BzynYDVs.js';
4
+ import { F as FilteredArray } from './filtered-array-JKATL39M.js';
5
+ import { I as IterableContainer } from './iterable-container-BTpDVdNc.js';
6
+ import { T as TupleParts } from './tuple-parts-BTivqbtT.js';
7
+ import './clamped-integer-subtract-DZ7rsJE4.js';
8
+ import './coerced-array-DRz3tqda.js';
9
+ import './perkakas-type-error-8wPb8T2y.js';
10
+ import './if-D4QIikQ1.js';
11
+ import './is-bounded-record-C9WAwfA8.js';
12
+
13
+ type GroupByProp<T extends IterableContainer, Prop extends GroupableProps<T>> = T extends unknown ? FixEmptyObject<EnsureValuesAreNonEmpty<{
14
+ [Value in AllPropValues<T, Prop>]: FilteredArray<T, Record<Prop, Value>>;
15
+ }>> : never;
16
+ type GroupableProps<T extends IterableContainer> = ConditionalKeys<ItemsSuperObject<T>, PropertyKey | undefined>;
17
+ type AllPropValues<T extends IterableContainer, Prop extends GroupableProps<T>> = Extract<ItemsSuperObject<T>[Prop], PropertyKey>;
18
+ type ItemsSuperObject<T extends IterableContainer> = AllUnionFields<Exclude<T[number], undefined>>;
19
+ type FixEmptyObject<T> = IfNever<keyof T, Record<PropertyKey, never>, T>;
20
+ type EnsureValuesAreNonEmpty<T extends Record<PropertyKey, IterableContainer>> = Merge<T, BoundedPartial<{
21
+ [P in keyof T as IsPossiblyEmpty<T[P]> extends true ? P : never]: ArrayRequiredPrefix<T[P], 1>;
22
+ }>>;
23
+ type IsPossiblyEmpty<T extends IterableContainer> = And<IsEmpty<TupleParts<T>['required']>, IsEmpty<TupleParts<T>['suffix']>>;
24
+ type IsEmpty<T> = T extends readonly [] ? true : false;
25
+ /**
26
+ * Groups the elements of an array of objects based on the values of a
27
+ * specified property of those objects. The result would contain a property for
28
+ * each unique value of the specific property, with it's value being the input
29
+ * array filtered to only items that have that property set to that value.
30
+ * For any object where the property is missing, or if it's value is
31
+ * `undefined` the item would be filtered out.
32
+ *
33
+ * The grouping property is enforced at the type level to exist in at least one
34
+ * item and to never have a value that cannot be used as an object key (e.g. it
35
+ * must be `PropertyKey | undefined`).
36
+ *
37
+ * The resulting arrays are filtered with the prop and it's value as a
38
+ * type-guard, effectively narrowing the items in each output arrays. This
39
+ * means that when the grouping property is the discriminator of a
40
+ * discriminated union type each output array would contain just the subtype for
41
+ * that value.
42
+ *
43
+ * If you need more control over the grouping you should use `groupBy` instead.
44
+ *
45
+ * @param data - The items to group.
46
+ * @param prop - The property name to group by.
47
+ * @signature
48
+ * P.groupByProp(data, prop)
49
+ * @example
50
+ * const result = P.groupByProp(
51
+ * // ^? { cat: [{ a: 'cat' }], dog: [{ a: 'dog' }] }
52
+ * [{ a: 'cat' }, { a: 'dog' }] as const,
53
+ * 'a',
54
+ * );
55
+ * @dataFirst
56
+ * @category Array
57
+ */
58
+ declare function groupByProp<T extends IterableContainer, Prop extends GroupableProps<T>>(data: T, prop: Prop): GroupByProp<T, Prop>;
59
+ /**
60
+ * Groups the elements of an array of objects based on the values of a
61
+ * specified property of those objects. The result would contain a property for
62
+ * each unique value of the specific property, with it's value being the input
63
+ * array filtered to only items that have that property set to that value.
64
+ * For any object where the property is missing, or if it's value is
65
+ * `undefined` the item would be filtered out.
66
+ *
67
+ * The grouping property is enforced at the type level to exist in at least one
68
+ * item and to never have a value that cannot be used as an object key (e.g. it
69
+ * must be `PropertyKey | undefined`).
70
+ *
71
+ * The resulting arrays are filtered with the prop and it's value as a
72
+ * type-guard, effectively narrowing the items in each output arrays. This
73
+ * means that when the grouping property is the discriminator of a
74
+ * discriminated union type each output array would contain just the subtype for
75
+ * that value.
76
+ *
77
+ * If you need more control over the grouping you should use `groupBy` instead.
78
+ *
79
+ * @param prop - The property name to group by.
80
+ * @signature
81
+ * P.groupByProp(prop)(data);
82
+ * @example
83
+ * const result = P.pipe(
84
+ * // ^? { cat: [{ a: 'cat' }], dog: [{ a: 'dog' }] }
85
+ * [{ a: 'cat' }, { a: 'dog' }] as const,
86
+ * P.groupByProp('a'),
87
+ * );
88
+ * @dataLast
89
+ * @category Array
90
+ */
91
+ declare function groupByProp<T extends IterableContainer, Prop extends GroupableProps<T>>(prop: Prop): (data: T) => GroupByProp<T, Prop>;
92
+
93
+ export { groupByProp };
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-6M4IYQFZ.js";import"./chunk-J6WPJH72.js";import"./chunk-KGPDVVVV.js";import"./chunk-EK7ODJWE.js";export{a as groupByProp};
package/dist/group-by.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkAPUBIDDUcjs = require('./chunk-APUBIDDU.cjs');require('./chunk-XR72I63W.cjs');require('./chunk-GZJMERDJ.cjs');exports.groupBy = _chunkAPUBIDDUcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGW4KDK3Dcjs = require('./chunk-GW4KDK3D.cjs');require('./chunk-XR72I63W.cjs');require('./chunk-GZJMERDJ.cjs');require('./chunk-MBGSSEZN.cjs');exports.groupBy = _chunkGW4KDK3Dcjs.a;
@@ -1,7 +1,8 @@
1
- import { E as ExactRecord } from './exact-record-_isi2JMR.cjs';
1
+ import { B as BoundedPartial } from './bounded-partial-BqwRN49U.cjs';
2
2
  import { N as NonEmptyArray } from './non-empty-array-C9Od1wmF.cjs';
3
- import './if-bounded-record-Drd4UbBU.cjs';
3
+ import './if-D4QIikQ1.cjs';
4
4
  import 'type-fest';
5
+ import './is-bounded-record-C9WAwfA8.cjs';
5
6
 
6
7
  /**
7
8
  * Groups the elements of a given iterable according to the string values
@@ -11,6 +12,11 @@ import 'type-fest';
11
12
  * return `undefined` in order to exclude the item from being added to any
12
13
  * group.
13
14
  *
15
+ * If you are grouping objects by a property of theirs (e.g.
16
+ * `groupBy(data, ({ myProp }) => myProp)` or `groupBy(data, prop('myProp'))`)
17
+ * consider using `groupByProp` (e.g. `groupByProp(data, 'myProp')`) instead,
18
+ * as it would provide better typing.
19
+ *
14
20
  * @param data - The items to group.
15
21
  * @param callbackfn - A function to execute for each element in the iterable.
16
22
  * It should return a value indicating the group of the current element, or
@@ -25,7 +31,7 @@ import 'type-fest';
25
31
  * @dataFirst
26
32
  * @category Array
27
33
  */
28
- declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): ExactRecord<Key, NonEmptyArray<T>>;
34
+ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): BoundedPartial<Record<Key, NonEmptyArray<T>>>;
29
35
  /**
30
36
  * Groups the elements of a given iterable according to the string values
31
37
  * returned by a provided callback function. The returned object has separate
@@ -34,6 +40,11 @@ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: Readonl
34
40
  * return `undefined` in order to exclude the item from being added to any
35
41
  * group.
36
42
  *
43
+ * If you are grouping objects by a property of theirs (e.g.
44
+ * `groupBy(data, ({ myProp }) => myProp)` or `groupBy(data, prop('myProp'))`)
45
+ * consider using `groupByProp` (e.g. `groupByProp(data, 'myProp')`) instead,
46
+ * as it would provide better typing.
47
+ *
37
48
  * @param callbackfn - A function to execute for each element in the iterable.
38
49
  * It should return a value indicating the group of the current element, or
39
50
  * `undefined` when the item should be excluded from any group.
@@ -53,6 +64,6 @@ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: Readonl
53
64
  * @dataLast
54
65
  * @category Array
55
66
  */
56
- declare function groupBy<T, Key extends PropertyKey = PropertyKey>(callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): (items: ReadonlyArray<T>) => ExactRecord<Key, NonEmptyArray<T>>;
67
+ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): (items: ReadonlyArray<T>) => BoundedPartial<Record<Key, NonEmptyArray<T>>>;
57
68
 
58
69
  export { groupBy };
@@ -1,7 +1,8 @@
1
- import { E as ExactRecord } from './exact-record-Dhbe_K-E.js';
1
+ import { B as BoundedPartial } from './bounded-partial-BzynYDVs.js';
2
2
  import { N as NonEmptyArray } from './non-empty-array-C9Od1wmF.js';
3
- import './if-bounded-record-Drd4UbBU.js';
3
+ import './if-D4QIikQ1.js';
4
4
  import 'type-fest';
5
+ import './is-bounded-record-C9WAwfA8.js';
5
6
 
6
7
  /**
7
8
  * Groups the elements of a given iterable according to the string values
@@ -11,6 +12,11 @@ import 'type-fest';
11
12
  * return `undefined` in order to exclude the item from being added to any
12
13
  * group.
13
14
  *
15
+ * If you are grouping objects by a property of theirs (e.g.
16
+ * `groupBy(data, ({ myProp }) => myProp)` or `groupBy(data, prop('myProp'))`)
17
+ * consider using `groupByProp` (e.g. `groupByProp(data, 'myProp')`) instead,
18
+ * as it would provide better typing.
19
+ *
14
20
  * @param data - The items to group.
15
21
  * @param callbackfn - A function to execute for each element in the iterable.
16
22
  * It should return a value indicating the group of the current element, or
@@ -25,7 +31,7 @@ import 'type-fest';
25
31
  * @dataFirst
26
32
  * @category Array
27
33
  */
28
- declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): ExactRecord<Key, NonEmptyArray<T>>;
34
+ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: ReadonlyArray<T>, callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): BoundedPartial<Record<Key, NonEmptyArray<T>>>;
29
35
  /**
30
36
  * Groups the elements of a given iterable according to the string values
31
37
  * returned by a provided callback function. The returned object has separate
@@ -34,6 +40,11 @@ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: Readonl
34
40
  * return `undefined` in order to exclude the item from being added to any
35
41
  * group.
36
42
  *
43
+ * If you are grouping objects by a property of theirs (e.g.
44
+ * `groupBy(data, ({ myProp }) => myProp)` or `groupBy(data, prop('myProp'))`)
45
+ * consider using `groupByProp` (e.g. `groupByProp(data, 'myProp')`) instead,
46
+ * as it would provide better typing.
47
+ *
37
48
  * @param callbackfn - A function to execute for each element in the iterable.
38
49
  * It should return a value indicating the group of the current element, or
39
50
  * `undefined` when the item should be excluded from any group.
@@ -53,6 +64,6 @@ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(data: Readonl
53
64
  * @dataLast
54
65
  * @category Array
55
66
  */
56
- declare function groupBy<T, Key extends PropertyKey = PropertyKey>(callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): (items: ReadonlyArray<T>) => ExactRecord<Key, NonEmptyArray<T>>;
67
+ declare function groupBy<T, Key extends PropertyKey = PropertyKey>(callbackfn: (value: T, index: number, data: ReadonlyArray<T>) => Key | undefined): (items: ReadonlyArray<T>) => BoundedPartial<Record<Key, NonEmptyArray<T>>>;
57
68
 
58
69
  export { groupBy };
package/dist/group-by.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-2MU3SHCO.js";import"./chunk-J6WPJH72.js";import"./chunk-KGPDVVVV.js";export{a as groupBy};
1
+ import{a}from"./chunk-44LUF6RO.js";import"./chunk-J6WPJH72.js";import"./chunk-KGPDVVVV.js";import"./chunk-EK7ODJWE.js";export{a as groupBy};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGVYLRJPBcjs = require('./chunk-GVYLRJPB.cjs');require('./chunk-XR72I63W.cjs');require('./chunk-GZJMERDJ.cjs');exports.hasAtLeast = _chunkGVYLRJPBcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk66JP4PUGcjs = require('./chunk-66JP4PUG.cjs');require('./chunk-XR72I63W.cjs');require('./chunk-GZJMERDJ.cjs');require('./chunk-MBGSSEZN.cjs');exports.hasAtLeast = _chunk66JP4PUGcjs.a;
@@ -1,19 +1,11 @@
1
1
  import { IsNumericLiteral } from 'type-fest';
2
+ import { A as ArrayRequiredPrefix } from './array-required-prefix-Ck4lHkbA.cjs';
2
3
  import { I as IterableContainer } from './iterable-container-BTpDVdNc.cjs';
4
+ import './clamped-integer-subtract-DZ7rsJE4.cjs';
5
+ import './coerced-array-DRz3tqda.cjs';
6
+ import './perkakas-type-error-8wPb8T2y.cjs';
7
+ import './tuple-parts-v6av7LMU.cjs';
3
8
 
4
- type ArraySetRequired<T extends IterableContainer, Min extends number, Iteration extends ReadonlyArray<unknown> = []> = number extends Min ? never : Iteration['length'] extends Min ? T : T extends readonly [] ? never : T extends [infer Head, ...infer Rest] ? [
5
- Head,
6
- ...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
7
- ] : T extends readonly [infer Head, ...infer Rest] ? readonly [
8
- Head,
9
- ...ArraySetRequired<Rest, Min, [unknown, ...Iteration]>
10
- ] : T extends Array<infer Item> ? [
11
- Item,
12
- ...ArraySetRequired<T, Min, [unknown, ...Iteration]>
13
- ] : T extends ReadonlyArray<infer Item> ? readonly [
14
- Item,
15
- ...ArraySetRequired<T, Min, [unknown, ...Iteration]>
16
- ] : never;
17
9
  /**
18
10
  * Checks if the given array has at least the defined number of elements. When
19
11
  * the minimum used is a literal (e.g. `3`) the output is refined accordingly so
@@ -36,7 +28,7 @@ type ArraySetRequired<T extends IterableContainer, Min extends number, Iteration
36
28
  * @dataFirst
37
29
  * @category Array
38
30
  */
39
- declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArraySetRequired<T, N>;
31
+ declare function hasAtLeast<T extends IterableContainer, N extends number>(data: IterableContainer | T, minimum: IsNumericLiteral<N> extends true ? N : never): data is ArrayRequiredPrefix<T, N>;
40
32
  declare function hasAtLeast(data: IterableContainer, minimum: number): boolean;
41
33
  /**
42
34
  * Checks if the given array has at least the defined number of elements. When
@@ -62,7 +54,7 @@ declare function hasAtLeast(data: IterableContainer, minimum: number): boolean;
62
54
  * @dataLast
63
55
  * @category Array
64
56
  */
65
- declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArraySetRequired<T, N>;
57
+ declare function hasAtLeast<N extends number>(minimum: IsNumericLiteral<N> extends true ? N : never): <T extends IterableContainer>(data: IterableContainer | T) => data is ArrayRequiredPrefix<T, N>;
66
58
  declare function hasAtLeast(minimum: number): (data: IterableContainer) => boolean;
67
59
 
68
60
  export { hasAtLeast };