es-toolkit 1.13.1-dev.320 → 1.13.1-dev.322

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 (251) hide show
  1. package/dist/array/chunk.mjs +1 -1
  2. package/dist/array/compact.d.mts +1 -1
  3. package/dist/array/compact.d.ts +1 -1
  4. package/dist/array/compact.js.map +1 -1
  5. package/dist/array/compact.mjs +2 -2
  6. package/dist/array/countBy.js +1 -2
  7. package/dist/array/countBy.js.map +1 -1
  8. package/dist/array/countBy.mjs +2 -2
  9. package/dist/array/difference.mjs +1 -1
  10. package/dist/array/differenceBy.mjs +1 -1
  11. package/dist/array/differenceWith.mjs +1 -1
  12. package/dist/array/drop.mjs +1 -1
  13. package/dist/array/dropRight.mjs +1 -1
  14. package/dist/array/dropRightWhile.mjs +1 -1
  15. package/dist/array/dropWhile.mjs +1 -1
  16. package/dist/array/fill.d.mts +1 -0
  17. package/dist/array/fill.d.ts +1 -0
  18. package/dist/array/fill.js.map +1 -1
  19. package/dist/array/fill.mjs +2 -2
  20. package/dist/array/flatMap.mjs +1 -1
  21. package/dist/array/flatten.mjs +1 -1
  22. package/dist/array/flattenDeep.mjs +1 -1
  23. package/dist/array/forEachRight.mjs +1 -1
  24. package/dist/array/groupBy.mjs +1 -1
  25. package/dist/array/head.d.mts +1 -0
  26. package/dist/array/head.d.ts +1 -0
  27. package/dist/array/head.js.map +1 -1
  28. package/dist/array/head.mjs +2 -2
  29. package/dist/array/index.js +1 -2
  30. package/dist/array/index.js.map +1 -1
  31. package/dist/array/index.mjs +56 -56
  32. package/dist/array/initial.mjs +1 -1
  33. package/dist/array/intersection.mjs +1 -1
  34. package/dist/array/intersectionBy.mjs +1 -1
  35. package/dist/array/intersectionWith.mjs +1 -1
  36. package/dist/array/keyBy.mjs +1 -1
  37. package/dist/array/last.d.mts +1 -0
  38. package/dist/array/last.d.ts +1 -0
  39. package/dist/array/last.js.map +1 -1
  40. package/dist/array/last.mjs +2 -2
  41. package/dist/array/maxBy.mjs +1 -1
  42. package/dist/array/minBy.mjs +1 -1
  43. package/dist/array/orderBy.mjs +1 -1
  44. package/dist/array/partition.mjs +1 -1
  45. package/dist/array/sample.mjs +1 -1
  46. package/dist/array/sampleSize.mjs +1 -1
  47. package/dist/array/shuffle.mjs +1 -1
  48. package/dist/array/tail.d.mts +9 -4
  49. package/dist/array/tail.d.ts +9 -4
  50. package/dist/array/tail.js.map +1 -1
  51. package/dist/array/tail.mjs +2 -2
  52. package/dist/array/take.mjs +1 -1
  53. package/dist/array/takeRight.mjs +1 -1
  54. package/dist/array/takeRightWhile.mjs +1 -1
  55. package/dist/array/takeWhile.mjs +1 -1
  56. package/dist/array/toFilled.d.mts +2 -0
  57. package/dist/array/toFilled.d.ts +2 -0
  58. package/dist/array/toFilled.js.map +1 -1
  59. package/dist/array/toFilled.mjs +2 -2
  60. package/dist/array/union.mjs +1 -1
  61. package/dist/array/unionBy.mjs +1 -1
  62. package/dist/array/unionWith.mjs +1 -1
  63. package/dist/array/uniq.mjs +1 -1
  64. package/dist/array/uniqBy.mjs +1 -1
  65. package/dist/array/uniqWith.mjs +1 -1
  66. package/dist/array/unzip.d.mts +3 -2
  67. package/dist/array/unzip.d.ts +3 -2
  68. package/dist/array/unzip.js.map +1 -1
  69. package/dist/array/unzip.mjs +2 -2
  70. package/dist/array/unzipWith.mjs +1 -1
  71. package/dist/array/without.mjs +1 -1
  72. package/dist/array/xor.mjs +1 -1
  73. package/dist/array/xorBy.mjs +1 -1
  74. package/dist/array/xorWith.mjs +1 -1
  75. package/dist/array/zip.mjs +1 -1
  76. package/dist/array/zipObject.mjs +1 -1
  77. package/dist/array/zipWith.d.mts +5 -0
  78. package/dist/array/zipWith.d.ts +5 -0
  79. package/dist/array/zipWith.js.map +1 -1
  80. package/dist/array/zipWith.mjs +2 -2
  81. package/dist/browser.js +22 -58
  82. package/dist/browser.js.map +1 -1
  83. package/dist/browser.mjs +54 -53
  84. package/dist/browser.mjs.map +1 -1
  85. package/dist/{chunk-QXTNZR7B.mjs → chunk-3SBT6WDU.mjs} +2 -2
  86. package/dist/{chunk-O64NE2P4.mjs → chunk-4DFAGGIM.mjs} +3 -3
  87. package/dist/{chunk-O64NE2P4.mjs.map → chunk-4DFAGGIM.mjs.map} +1 -1
  88. package/dist/{chunk-Y5V7UAZZ.mjs → chunk-4ZES5T6V.mjs} +4 -4
  89. package/dist/{chunk-TJ4Z5I7M.mjs → chunk-DLS7UJKJ.mjs} +1 -1
  90. package/dist/chunk-DLS7UJKJ.mjs.map +1 -0
  91. package/dist/{chunk-KPBQ7OUY.mjs → chunk-DTTKJ3VC.mjs} +1 -1
  92. package/dist/chunk-DTTKJ3VC.mjs.map +1 -0
  93. package/dist/{chunk-YNJH6GEG.mjs → chunk-EEHJ656S.mjs} +95 -92
  94. package/dist/chunk-EEHJ656S.mjs.map +1 -0
  95. package/dist/{chunk-EYYZQFOP.mjs → chunk-ET33L3MQ.mjs} +2 -2
  96. package/dist/chunk-EZYYB34V.mjs +17 -0
  97. package/dist/{chunk-CVVZHOJX.mjs.map → chunk-EZYYB34V.mjs.map} +1 -1
  98. package/dist/{chunk-HM2JT2RX.mjs → chunk-FZZNWXDM.mjs} +1 -1
  99. package/dist/chunk-FZZNWXDM.mjs.map +1 -0
  100. package/dist/{chunk-YFN6KOC4.mjs → chunk-GTFDDKZ2.mjs} +1 -1
  101. package/dist/chunk-GTFDDKZ2.mjs.map +1 -0
  102. package/dist/{chunk-F3WCQQET.mjs → chunk-IWXZI3QT.mjs} +2 -2
  103. package/dist/chunk-J5LGTIGS.mjs +10 -0
  104. package/dist/{chunk-UYZKMBDO.mjs → chunk-JCRY7ZYS.mjs} +1 -1
  105. package/dist/chunk-JCRY7ZYS.mjs.map +1 -0
  106. package/dist/{chunk-5CPXZFCB.mjs → chunk-K5WL54BY.mjs} +2 -2
  107. package/dist/{chunk-5CPXZFCB.mjs.map → chunk-K5WL54BY.mjs.map} +1 -1
  108. package/dist/{chunk-4KYXHZ4R.mjs → chunk-MJ7LNBI6.mjs} +1 -1
  109. package/dist/chunk-MJ7LNBI6.mjs.map +1 -0
  110. package/dist/{chunk-3IP4JVLL.mjs → chunk-MSHSKENG.mjs} +3 -3
  111. package/dist/{chunk-3IP4JVLL.mjs.map → chunk-MSHSKENG.mjs.map} +1 -1
  112. package/dist/{chunk-WVQ7YVRK.mjs → chunk-OG2RLT5U.mjs} +2 -3
  113. package/dist/{chunk-WVQ7YVRK.mjs.map → chunk-OG2RLT5U.mjs.map} +1 -1
  114. package/dist/{chunk-DTJJIMKJ.mjs → chunk-PJPGJ2O6.mjs} +1 -1
  115. package/dist/chunk-PJPGJ2O6.mjs.map +1 -0
  116. package/dist/chunk-R6GLTTAB.mjs +9 -0
  117. package/dist/chunk-R6GLTTAB.mjs.map +1 -0
  118. package/dist/{chunk-5IKVJGHO.mjs → chunk-RTFTLCF3.mjs} +2 -2
  119. package/dist/{chunk-OP4OAKQJ.mjs → chunk-XHSIT5DL.mjs} +1 -1
  120. package/dist/chunk-XHSIT5DL.mjs.map +1 -0
  121. package/dist/{chunk-WFZXCGEG.mjs → chunk-YOPFSFTD.mjs} +2 -6
  122. package/dist/{chunk-WFZXCGEG.mjs.map → chunk-YOPFSFTD.mjs.map} +1 -1
  123. package/dist/chunk-YXD3AQAK.mjs +1 -0
  124. package/dist/{chunk-CRSKT4WW.mjs → chunk-Z7HWEOQX.mjs} +2 -3
  125. package/dist/{chunk-CRSKT4WW.mjs.map → chunk-Z7HWEOQX.mjs.map} +1 -1
  126. package/dist/chunk-ZPNX2QDE.mjs +13 -0
  127. package/dist/{chunk-IIDZ3KAJ.mjs.map → chunk-ZPNX2QDE.mjs.map} +1 -1
  128. package/dist/compat/index.d.mts +3 -1
  129. package/dist/compat/index.d.ts +3 -1
  130. package/dist/compat/index.js +23 -57
  131. package/dist/compat/index.js.map +1 -1
  132. package/dist/compat/index.mjs +98 -94
  133. package/dist/error/AbortError.mjs +1 -1
  134. package/dist/error/TimeoutError.mjs +1 -1
  135. package/dist/error/index.mjs +4 -4
  136. package/dist/function/after.mjs +1 -1
  137. package/dist/function/debounce.js +2 -2
  138. package/dist/function/debounce.js.map +1 -1
  139. package/dist/function/debounce.mjs +2 -2
  140. package/dist/function/index.js +2 -2
  141. package/dist/function/index.js.map +1 -1
  142. package/dist/function/index.mjs +10 -10
  143. package/dist/function/negate.mjs +1 -1
  144. package/dist/function/noop.mjs +1 -1
  145. package/dist/function/once.mjs +1 -1
  146. package/dist/function/throttle.mjs +1 -1
  147. package/dist/index.d.mts +1 -0
  148. package/dist/index.d.ts +1 -0
  149. package/dist/index.js +20 -53
  150. package/dist/index.js.map +1 -1
  151. package/dist/index.mjs +97 -93
  152. package/dist/math/clamp.mjs +1 -1
  153. package/dist/math/inRange.mjs +1 -1
  154. package/dist/math/index.mjs +1 -1
  155. package/dist/math/mean.mjs +1 -1
  156. package/dist/math/meanBy.mjs +1 -1
  157. package/dist/math/random.mjs +1 -1
  158. package/dist/math/randomInt.mjs +1 -1
  159. package/dist/math/range.mjs +1 -1
  160. package/dist/math/round.mjs +1 -1
  161. package/dist/math/sum.mjs +1 -1
  162. package/dist/math/sumBy.mjs +1 -1
  163. package/dist/object/clone.mjs +1 -1
  164. package/dist/object/cloneDeep.js +1 -1
  165. package/dist/object/cloneDeep.js.map +1 -1
  166. package/dist/object/cloneDeep.mjs +2 -2
  167. package/dist/object/flattenObject.mjs +1 -1
  168. package/dist/object/index.js +2 -16
  169. package/dist/object/index.js.map +1 -1
  170. package/dist/object/index.mjs +3 -3
  171. package/dist/object/invert.mjs +1 -1
  172. package/dist/object/omit.js +1 -15
  173. package/dist/object/omit.js.map +1 -1
  174. package/dist/object/omit.mjs +2 -2
  175. package/dist/object/omitBy.mjs +1 -1
  176. package/dist/object/pick.mjs +1 -1
  177. package/dist/object/pickBy.mjs +1 -1
  178. package/dist/predicate/index.d.mts +1 -0
  179. package/dist/predicate/index.d.ts +1 -0
  180. package/dist/predicate/index.js +7 -0
  181. package/dist/predicate/index.js.map +1 -1
  182. package/dist/predicate/index.mjs +9 -5
  183. package/dist/predicate/isArrayLike.mjs +1 -1
  184. package/dist/predicate/isEqual.mjs +1 -1
  185. package/dist/predicate/isFunction.mjs +1 -1
  186. package/dist/predicate/isLength.mjs +1 -1
  187. package/dist/predicate/isNil.mjs +1 -1
  188. package/dist/predicate/isNotNil.mjs +1 -1
  189. package/dist/predicate/isNull.mjs +1 -1
  190. package/dist/predicate/isPlainObject.mjs +1 -1
  191. package/dist/predicate/isPrimitive.d.mts +17 -0
  192. package/dist/predicate/isPrimitive.d.ts +17 -0
  193. package/dist/predicate/isPrimitive.js +33 -0
  194. package/dist/predicate/isPrimitive.js.map +1 -0
  195. package/dist/predicate/isPrimitive.mjs +8 -0
  196. package/dist/predicate/isPrimitive.mjs.map +1 -0
  197. package/dist/predicate/isTypedArray.mjs +1 -1
  198. package/dist/predicate/isUndefined.mjs +1 -1
  199. package/dist/promise/delay.js +2 -2
  200. package/dist/promise/delay.js.map +1 -1
  201. package/dist/promise/delay.mjs +2 -2
  202. package/dist/promise/index.js +7 -31
  203. package/dist/promise/index.js.map +1 -1
  204. package/dist/promise/index.mjs +5 -5
  205. package/dist/promise/timeout.js +5 -27
  206. package/dist/promise/timeout.js.map +1 -1
  207. package/dist/promise/timeout.mjs +4 -4
  208. package/dist/promise/withTimeout.js +7 -31
  209. package/dist/promise/withTimeout.js.map +1 -1
  210. package/dist/promise/withTimeout.mjs +5 -5
  211. package/dist/string/camelCase.js +1 -2
  212. package/dist/string/camelCase.js.map +1 -1
  213. package/dist/string/camelCase.mjs +3 -3
  214. package/dist/string/capitalize.mjs +1 -1
  215. package/dist/string/index.js +1 -2
  216. package/dist/string/index.js.map +1 -1
  217. package/dist/string/index.mjs +9 -9
  218. package/dist/string/kebabCase.js +1 -2
  219. package/dist/string/kebabCase.js.map +1 -1
  220. package/dist/string/kebabCase.mjs +3 -3
  221. package/dist/string/lowerCase.js +1 -2
  222. package/dist/string/lowerCase.js.map +1 -1
  223. package/dist/string/lowerCase.mjs +3 -3
  224. package/dist/string/snakeCase.js +1 -2
  225. package/dist/string/snakeCase.js.map +1 -1
  226. package/dist/string/snakeCase.mjs +3 -3
  227. package/dist/string/startCase.js +1 -2
  228. package/dist/string/startCase.js.map +1 -1
  229. package/dist/string/startCase.mjs +3 -3
  230. package/package.json +1 -1
  231. package/umd/browser.global.js +1 -1
  232. package/dist/chunk-24FKGR6U.mjs +0 -47
  233. package/dist/chunk-4KYXHZ4R.mjs.map +0 -1
  234. package/dist/chunk-CVVZHOJX.mjs +0 -22
  235. package/dist/chunk-DTJJIMKJ.mjs.map +0 -1
  236. package/dist/chunk-HM2JT2RX.mjs.map +0 -1
  237. package/dist/chunk-IIDZ3KAJ.mjs +0 -18
  238. package/dist/chunk-KPBQ7OUY.mjs.map +0 -1
  239. package/dist/chunk-OP4OAKQJ.mjs.map +0 -1
  240. package/dist/chunk-STL6TD3L.mjs +0 -1
  241. package/dist/chunk-TJ4Z5I7M.mjs.map +0 -1
  242. package/dist/chunk-UYZKMBDO.mjs.map +0 -1
  243. package/dist/chunk-YFN6KOC4.mjs.map +0 -1
  244. package/dist/chunk-YNJH6GEG.mjs.map +0 -1
  245. /package/dist/{chunk-QXTNZR7B.mjs.map → chunk-3SBT6WDU.mjs.map} +0 -0
  246. /package/dist/{chunk-Y5V7UAZZ.mjs.map → chunk-4ZES5T6V.mjs.map} +0 -0
  247. /package/dist/{chunk-EYYZQFOP.mjs.map → chunk-ET33L3MQ.mjs.map} +0 -0
  248. /package/dist/{chunk-F3WCQQET.mjs.map → chunk-IWXZI3QT.mjs.map} +0 -0
  249. /package/dist/{chunk-24FKGR6U.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  250. /package/dist/{chunk-5IKVJGHO.mjs.map → chunk-RTFTLCF3.mjs.map} +0 -0
  251. /package/dist/{chunk-STL6TD3L.mjs.map → chunk-YXD3AQAK.mjs.map} +0 -0
@@ -13,37 +13,40 @@ import {
13
13
  set,
14
14
  startsWith,
15
15
  zipObjectDeep
16
- } from "../chunk-YNJH6GEG.mjs";
16
+ } from "../chunk-EEHJ656S.mjs";
17
17
  import "../chunk-NKLIE2OI.mjs";
18
18
  import "../chunk-4OIZM4HS.mjs";
19
19
  import {
20
20
  withTimeout
21
- } from "../chunk-IIDZ3KAJ.mjs";
22
- import "../chunk-CVVZHOJX.mjs";
21
+ } from "../chunk-ZPNX2QDE.mjs";
22
+ import "../chunk-EZYYB34V.mjs";
23
23
  import {
24
24
  delay
25
- } from "../chunk-O64NE2P4.mjs";
25
+ } from "../chunk-4DFAGGIM.mjs";
26
26
  import "../chunk-XT74R35S.mjs";
27
+ import {
28
+ kebabCase
29
+ } from "../chunk-ET33L3MQ.mjs";
27
30
  import {
28
31
  lowerCase
29
- } from "../chunk-5IKVJGHO.mjs";
32
+ } from "../chunk-RTFTLCF3.mjs";
30
33
  import {
31
34
  snakeCase
32
- } from "../chunk-F3WCQQET.mjs";
35
+ } from "../chunk-IWXZI3QT.mjs";
33
36
  import {
34
37
  startCase
35
- } from "../chunk-QXTNZR7B.mjs";
38
+ } from "../chunk-3SBT6WDU.mjs";
36
39
  import {
37
40
  camelCase
38
- } from "../chunk-Y5V7UAZZ.mjs";
41
+ } from "../chunk-4ZES5T6V.mjs";
42
+ import "../chunk-OG2RLT5U.mjs";
39
43
  import {
40
44
  capitalize
41
45
  } from "../chunk-U56ZOM7L.mjs";
46
+ import "../chunk-YXD3AQAK.mjs";
42
47
  import {
43
- kebabCase
44
- } from "../chunk-EYYZQFOP.mjs";
45
- import "../chunk-WVQ7YVRK.mjs";
46
- import "../chunk-STL6TD3L.mjs";
48
+ isUndefined
49
+ } from "../chunk-VH2PV426.mjs";
47
50
  import {
48
51
  isFunction
49
52
  } from "../chunk-74CREQXW.mjs";
@@ -56,10 +59,10 @@ import {
56
59
  import {
57
60
  isNull
58
61
  } from "../chunk-AIRSKN47.mjs";
59
- import "../chunk-SXFMQQ6F.mjs";
60
62
  import {
61
- isUndefined
62
- } from "../chunk-VH2PV426.mjs";
63
+ isPrimitive
64
+ } from "../chunk-R6GLTTAB.mjs";
65
+ import "../chunk-SXFMQQ6F.mjs";
63
66
  import {
64
67
  isArrayLike
65
68
  } from "../chunk-LPZZIY5Z.mjs";
@@ -75,7 +78,7 @@ import {
75
78
  } from "../chunk-OLX53VEF.mjs";
76
79
  import {
77
80
  omit
78
- } from "../chunk-WFZXCGEG.mjs";
81
+ } from "../chunk-YOPFSFTD.mjs";
79
82
  import {
80
83
  omitBy
81
84
  } from "../chunk-BCTYOXT7.mjs";
@@ -90,7 +93,7 @@ import {
90
93
  } from "../chunk-VRUTBJYS.mjs";
91
94
  import {
92
95
  cloneDeep
93
- } from "../chunk-5CPXZFCB.mjs";
96
+ } from "../chunk-K5WL54BY.mjs";
94
97
  import {
95
98
  flattenObject
96
99
  } from "../chunk-XGQWTHW6.mjs";
@@ -120,33 +123,19 @@ import {
120
123
  import {
121
124
  sum
122
125
  } from "../chunk-2SLTL4KL.mjs";
123
- import "../chunk-F47GLYUU.mjs";
124
- import {
125
- TimeoutError
126
- } from "../chunk-KIOYQRMQ.mjs";
127
- import "../chunk-ZA2XI3OV.mjs";
128
- import {
129
- throttle
130
- } from "../chunk-QOJGMVVR.mjs";
131
- import {
132
- after
133
- } from "../chunk-OGZMEWPR.mjs";
134
- import {
135
- debounce
136
- } from "../chunk-3IP4JVLL.mjs";
126
+ import "../chunk-DDH7K4QM.mjs";
137
127
  import {
138
- negate
139
- } from "../chunk-BOOQBJN2.mjs";
128
+ zipWith
129
+ } from "../chunk-MJ7LNBI6.mjs";
140
130
  import {
141
- noop
142
- } from "../chunk-LKXCOLNY.mjs";
131
+ unzip
132
+ } from "../chunk-JCRY7ZYS.mjs";
143
133
  import {
144
- once
145
- } from "../chunk-CMBC4MXG.mjs";
134
+ unzipWith
135
+ } from "../chunk-IFNXROZR.mjs";
146
136
  import {
147
- AbortError
148
- } from "../chunk-DXB7EZUQ.mjs";
149
- import "../chunk-DDH7K4QM.mjs";
137
+ without
138
+ } from "../chunk-PYEYV7BY.mjs";
150
139
  import {
151
140
  xor
152
141
  } from "../chunk-L7FQX5MN.mjs";
@@ -163,14 +152,23 @@ import {
163
152
  zipObject
164
153
  } from "../chunk-6GWEY5EL.mjs";
165
154
  import {
166
- zipWith
167
- } from "../chunk-4KYXHZ4R.mjs";
155
+ takeWhile
156
+ } from "../chunk-2IXFGSUA.mjs";
157
+ import {
158
+ toFilled
159
+ } from "../chunk-XHSIT5DL.mjs";
160
+ import {
161
+ union
162
+ } from "../chunk-R6QA7PLZ.mjs";
168
163
  import {
169
164
  unionBy
170
165
  } from "../chunk-NFS7RWWE.mjs";
171
166
  import {
172
167
  unionWith
173
168
  } from "../chunk-2ZCITDMK.mjs";
169
+ import {
170
+ uniq
171
+ } from "../chunk-DVK2N4KC.mjs";
174
172
  import {
175
173
  uniqBy
176
174
  } from "../chunk-B4COTK4K.mjs";
@@ -178,20 +176,26 @@ import {
178
176
  uniqWith
179
177
  } from "../chunk-237HGSZS.mjs";
180
178
  import {
181
- unzip
182
- } from "../chunk-UYZKMBDO.mjs";
179
+ partition
180
+ } from "../chunk-DN3NOZ3H.mjs";
183
181
  import {
184
- unzipWith
185
- } from "../chunk-IFNXROZR.mjs";
182
+ sample
183
+ } from "../chunk-2KNLZB7V.mjs";
186
184
  import {
187
- without
188
- } from "../chunk-PYEYV7BY.mjs";
185
+ sampleSize
186
+ } from "../chunk-EHSKB6DF.mjs";
187
+ import {
188
+ randomInt
189
+ } from "../chunk-GIWAOOFY.mjs";
190
+ import {
191
+ random
192
+ } from "../chunk-SYWMYQYJ.mjs";
189
193
  import {
190
194
  shuffle
191
195
  } from "../chunk-G7UQ5PUR.mjs";
192
196
  import {
193
197
  tail
194
- } from "../chunk-TJ4Z5I7M.mjs";
198
+ } from "../chunk-DLS7UJKJ.mjs";
195
199
  import {
196
200
  take
197
201
  } from "../chunk-ME352XO7.mjs";
@@ -202,23 +206,20 @@ import {
202
206
  takeRightWhile
203
207
  } from "../chunk-NTLX2MPV.mjs";
204
208
  import {
205
- takeWhile
206
- } from "../chunk-2IXFGSUA.mjs";
207
- import {
208
- toFilled
209
- } from "../chunk-OP4OAKQJ.mjs";
209
+ intersection
210
+ } from "../chunk-FVVSE2F2.mjs";
210
211
  import {
211
- union
212
- } from "../chunk-R6QA7PLZ.mjs";
212
+ intersectionBy
213
+ } from "../chunk-O6UXZR3U.mjs";
213
214
  import {
214
- uniq
215
- } from "../chunk-DVK2N4KC.mjs";
215
+ intersectionWith
216
+ } from "../chunk-XI7KRD2C.mjs";
216
217
  import {
217
218
  keyBy
218
219
  } from "../chunk-AJKZMN2V.mjs";
219
220
  import {
220
221
  last
221
- } from "../chunk-KPBQ7OUY.mjs";
222
+ } from "../chunk-DTTKJ3VC.mjs";
222
223
  import {
223
224
  maxBy
224
225
  } from "../chunk-OOKNBU4V.mjs";
@@ -229,20 +230,14 @@ import {
229
230
  orderBy
230
231
  } from "../chunk-7B7W36UP.mjs";
231
232
  import {
232
- partition
233
- } from "../chunk-DN3NOZ3H.mjs";
234
- import {
235
- sample
236
- } from "../chunk-2KNLZB7V.mjs";
237
- import {
238
- sampleSize
239
- } from "../chunk-EHSKB6DF.mjs";
233
+ flatMap
234
+ } from "../chunk-UY76KTPE.mjs";
240
235
  import {
241
- randomInt
242
- } from "../chunk-GIWAOOFY.mjs";
236
+ flattenDeep
237
+ } from "../chunk-ML727RRJ.mjs";
243
238
  import {
244
- random
245
- } from "../chunk-SYWMYQYJ.mjs";
239
+ flatten
240
+ } from "../chunk-33MSBDC6.mjs";
246
241
  import {
247
242
  forEachRight
248
243
  } from "../chunk-IEA53J7P.mjs";
@@ -251,19 +246,17 @@ import {
251
246
  } from "../chunk-E6E4RZLN.mjs";
252
247
  import {
253
248
  head
254
- } from "../chunk-HM2JT2RX.mjs";
249
+ } from "../chunk-FZZNWXDM.mjs";
255
250
  import {
256
251
  initial
257
252
  } from "../chunk-XPSOKBRZ.mjs";
253
+ import "../chunk-JPUKH67K.mjs";
258
254
  import {
259
- intersection
260
- } from "../chunk-FVVSE2F2.mjs";
261
- import {
262
- intersectionBy
263
- } from "../chunk-O6UXZR3U.mjs";
255
+ differenceBy
256
+ } from "../chunk-LVWX5B43.mjs";
264
257
  import {
265
- intersectionWith
266
- } from "../chunk-XI7KRD2C.mjs";
258
+ differenceWith
259
+ } from "../chunk-6NVQAHXP.mjs";
267
260
  import {
268
261
  drop
269
262
  } from "../chunk-3EZAFZG3.mjs";
@@ -276,31 +269,41 @@ import {
276
269
  import {
277
270
  dropWhile
278
271
  } from "../chunk-LJ2C6MVP.mjs";
279
- import "../chunk-YFN6KOC4.mjs";
272
+ import "../chunk-GTFDDKZ2.mjs";
273
+ import "../chunk-ZA2XI3OV.mjs";
280
274
  import {
281
- flatMap
282
- } from "../chunk-UY76KTPE.mjs";
275
+ negate
276
+ } from "../chunk-BOOQBJN2.mjs";
283
277
  import {
284
- flattenDeep
285
- } from "../chunk-ML727RRJ.mjs";
278
+ noop
279
+ } from "../chunk-LKXCOLNY.mjs";
286
280
  import {
287
- flatten
288
- } from "../chunk-33MSBDC6.mjs";
281
+ once
282
+ } from "../chunk-CMBC4MXG.mjs";
283
+ import {
284
+ throttle
285
+ } from "../chunk-QOJGMVVR.mjs";
289
286
  import "../chunk-E6C5EZQA.mjs";
290
287
  import {
291
288
  compact
292
- } from "../chunk-DTJJIMKJ.mjs";
289
+ } from "../chunk-PJPGJ2O6.mjs";
293
290
  import {
294
291
  countBy
295
- } from "../chunk-CRSKT4WW.mjs";
296
- import "../chunk-JPUKH67K.mjs";
292
+ } from "../chunk-Z7HWEOQX.mjs";
293
+ import "../chunk-F47GLYUU.mjs";
297
294
  import {
298
- differenceBy
299
- } from "../chunk-LVWX5B43.mjs";
295
+ AbortError
296
+ } from "../chunk-DXB7EZUQ.mjs";
300
297
  import {
301
- differenceWith
302
- } from "../chunk-6NVQAHXP.mjs";
303
- import "../chunk-24FKGR6U.mjs";
298
+ TimeoutError
299
+ } from "../chunk-KIOYQRMQ.mjs";
300
+ import {
301
+ after
302
+ } from "../chunk-OGZMEWPR.mjs";
303
+ import {
304
+ debounce
305
+ } from "../chunk-MSHSKENG.mjs";
306
+ import "../chunk-J5LGTIGS.mjs";
304
307
  export {
305
308
  AbortError,
306
309
  TimeoutError,
@@ -349,6 +352,7 @@ export {
349
352
  isNotNil,
350
353
  isNull,
351
354
  isPlainObject,
355
+ isPrimitive,
352
356
  isTypedArray,
353
357
  isUndefined,
354
358
  kebabCase,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AbortError
3
3
  } from "../chunk-DXB7EZUQ.mjs";
4
- import "../chunk-24FKGR6U.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  AbortError
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TimeoutError
3
3
  } from "../chunk-KIOYQRMQ.mjs";
4
- import "../chunk-24FKGR6U.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  TimeoutError
7
7
  };
@@ -1,11 +1,11 @@
1
1
  import "../chunk-F47GLYUU.mjs";
2
- import {
3
- TimeoutError
4
- } from "../chunk-KIOYQRMQ.mjs";
5
2
  import {
6
3
  AbortError
7
4
  } from "../chunk-DXB7EZUQ.mjs";
8
- import "../chunk-24FKGR6U.mjs";
5
+ import {
6
+ TimeoutError
7
+ } from "../chunk-KIOYQRMQ.mjs";
8
+ import "../chunk-J5LGTIGS.mjs";
9
9
  export {
10
10
  AbortError,
11
11
  TimeoutError
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  after
3
3
  } from "../chunk-OGZMEWPR.mjs";
4
- import "../chunk-24FKGR6U.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  after
7
7
  };
@@ -29,7 +29,7 @@ function debounce(func, debounceMs, { signal } = {}) {
29
29
  if (timeoutId !== null) {
30
30
  clearTimeout(timeoutId);
31
31
  }
32
- if (signal == null ? void 0 : signal.aborted) {
32
+ if (signal?.aborted) {
33
33
  return;
34
34
  }
35
35
  timeoutId = setTimeout(() => {
@@ -46,7 +46,7 @@ function debounce(func, debounceMs, { signal } = {}) {
46
46
  timeoutId = null;
47
47
  }
48
48
  };
49
- signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
49
+ signal?.addEventListener("abort", onAbort, { once: true });
50
50
  return debounced;
51
51
  }
52
52
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/function/debounce.ts"],"sourcesContent":["interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: number | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) as any;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCO,SAAS,SACd,MACA,YACA,EAAE,OAAO,IAAqB,CAAC,GACH;AAC5B,MAAI,YAA2B;AAE/B,QAAM,YAAY,YAAa,MAAqB;AAClD,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AAAA,IACxB;AAEA,QAAI,iCAAQ,SAAS;AACnB;AAAA,IACF;AAEA,gBAAY,WAAW,MAAM;AAC3B,WAAK,GAAG,IAAI;AACZ,kBAAY;AAAA,IACd,GAAG,UAAU;AAAA,EACf;AAEA,QAAM,UAAU,WAAY;AAC1B,cAAU,OAAO;AAAA,EACnB;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,mCAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK;AAExD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/function/debounce.ts"],"sourcesContent":["interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: number | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) as any;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCO,SAAS,SACd,MACA,YACA,EAAE,OAAO,IAAqB,CAAC,GACH;AAC5B,MAAI,YAA2B;AAE/B,QAAM,YAAY,YAAa,MAAqB;AAClD,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AAAA,IACxB;AAEA,QAAI,QAAQ,SAAS;AACnB;AAAA,IACF;AAEA,gBAAY,WAAW,MAAM;AAC3B,WAAK,GAAG,IAAI;AACZ,kBAAY;AAAA,IACd,GAAG,UAAU;AAAA,EACf;AAEA,QAAM,UAAU,WAAY;AAC1B,cAAU,OAAO;AAAA,EACnB;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,UAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAEzD,SAAO;AACT;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  debounce
3
- } from "../chunk-3IP4JVLL.mjs";
4
- import "../chunk-24FKGR6U.mjs";
3
+ } from "../chunk-MSHSKENG.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  debounce
7
7
  };
@@ -50,7 +50,7 @@ function debounce(func, debounceMs, { signal } = {}) {
50
50
  if (timeoutId !== null) {
51
51
  clearTimeout(timeoutId);
52
52
  }
53
- if (signal == null ? void 0 : signal.aborted) {
53
+ if (signal?.aborted) {
54
54
  return;
55
55
  }
56
56
  timeoutId = setTimeout(() => {
@@ -67,7 +67,7 @@ function debounce(func, debounceMs, { signal } = {}) {
67
67
  timeoutId = null;
68
68
  }
69
69
  };
70
- signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
70
+ signal?.addEventListener("abort", onAbort, { once: true });
71
71
  return debounced;
72
72
  }
73
73
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/function/index.ts","../../src/function/after.ts","../../src/function/debounce.ts","../../src/function/noop.ts","../../src/function/once.ts","../../src/function/throttle.ts","../../src/function/negate.ts"],"sourcesContent":["export { after } from './after.ts';\nexport { debounce } from './debounce.ts';\nexport { noop } from './noop.ts';\nexport { once } from './once.ts';\nexport { throttle } from './throttle.ts';\nexport { negate } from './negate.ts';\n","/**\n * Creates a function that only executes starting from the `n`-th call.\n * The provided function will be invoked starting from the `n`-th call.\n *\n * This is particularly useful for scenarios involving events or asynchronous operations\n * where an action should occur only after a certain number of invocations.\n *\n * @template F - The type of the function to be invoked.\n * @param {number} n - The number of calls required for `func` to execute.\n * @param {F} func - The function to be invoked.\n * @returns {F} - A new function that:\n * - Tracks the number of calls.\n * - Invokes `func` starting from the `n`-th call.\n * - Returns `undefined` if fewer than `n` calls have been made.\n * @throws {Error} - Throws an error if `n` is negative.\n * @example\n *\n * const afterFn = after(3, () => {\n * console.log(\"called\")\n * });\n *\n * // Will not log anything.\n * afterFn()\n * // Will not log anything.\n * afterFn()\n * // Will log 'called'.\n * afterFn()\n */\n\nexport const after = <F extends (...args: any[]) => any>(n: number, func: F): F => {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error(`n must be a non-negative integer.`);\n }\n\n let counter = 0;\n return ((...args: Parameters<F>) => {\n if (++counter >= n) {\n return func(...args);\n }\n return undefined;\n }) as F;\n};\n","interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: number | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) as any;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n","/**\n * A no-operation function that does nothing.\n * This can be used as a placeholder or default function.\n *\n * @example\n * noop(); // Does nothing\n *\n * @returns {void} This function does not return anything.\n */\nexport function noop(): void {}\n","/**\n * Creates a function that is restricted to invoking the provided function `func` once.\n * Repeated calls to the function will return the value from the first invocation.\n *\n * @template F - The type of function.\n * @param {F} func - The function to restrict.\n * @returns {F} A new function that invokes `func` once and caches the result.\n *\n * @example\n * const initialize = once(() => {\n * console.log('Initialized!');\n * return true;\n * });\n *\n * initialize(); // Logs: 'Initialized!' and returns true\n * initialize(); // Returns true without logging\n */\nexport function once<F extends () => any>(func: F): F {\n let called = false;\n let cache: ReturnType<F> | undefined;\n\n return function () {\n if (called) {\n return cache;\n }\n\n const result = func();\n\n called = true;\n cache = result;\n\n return result;\n } as F;\n}\n","/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @template F - The type of function.\n * @param {F} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {F} A new throttled function that accepts the same parameters as the original function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n *\n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n *\n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle<F extends (...args: any[]) => void>(func: F, throttleMs: number): F {\n let lastCallTime: number | null;\n\n const throttledFunction = function (...args: Parameters<F>) {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func(...args);\n }\n } as F;\n\n return throttledFunction;\n}\n","/**\n * Creates a function that negates the result of the predicate function.\n *\n * @template F - The type of the function to negate.\n * @param {F} func - The function to negate.\n * @returns {F} The new negated function, which negates the boolean result of `func`.\n */\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC6BO,IAAM,QAAQ,CAAoC,GAAW,SAAe;AACjF,MAAI,CAAC,OAAO,UAAU,CAAC,KAAK,IAAI,GAAG;AACjC,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,MAAI,UAAU;AACd,SAAQ,IAAI,SAAwB;AAClC,QAAI,EAAE,WAAW,GAAG;AAClB,aAAO,KAAK,GAAG,IAAI;AAAA,IACrB;AACA,WAAO;AAAA,EACT;AACF;;;ACFO,SAAS,SACd,MACA,YACA,EAAE,OAAO,IAAqB,CAAC,GACH;AAC5B,MAAI,YAA2B;AAE/B,QAAM,YAAY,YAAa,MAAqB;AAClD,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AAAA,IACxB;AAEA,QAAI,iCAAQ,SAAS;AACnB;AAAA,IACF;AAEA,gBAAY,WAAW,MAAM;AAC3B,WAAK,GAAG,IAAI;AACZ,kBAAY;AAAA,IACd,GAAG,UAAU;AAAA,EACf;AAEA,QAAM,UAAU,WAAY;AAC1B,cAAU,OAAO;AAAA,EACnB;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,mCAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK;AAExD,SAAO;AACT;;;AClEO,SAAS,OAAa;AAAC;;;ACQvB,SAAS,KAA0B,MAAY;AACpD,MAAI,SAAS;AACb,MAAI;AAEJ,SAAO,WAAY;AACjB,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,KAAK;AAEpB,aAAS;AACT,YAAQ;AAER,WAAO;AAAA,EACT;AACF;;;ACPO,SAAS,SAA6C,MAAS,YAAuB;AAC3F,MAAI;AAEJ,QAAM,oBAAoB,YAAa,MAAqB;AAC1D,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,gBAAgB,QAAQ,MAAM,gBAAgB,YAAY;AAC5D,qBAAe;AACf,WAAK,GAAG,IAAI;AAAA,IACd;AAAA,EACF;AAEA,SAAO;AACT;;;AChCO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","names":[]}
1
+ {"version":3,"sources":["../../src/function/index.ts","../../src/function/after.ts","../../src/function/debounce.ts","../../src/function/noop.ts","../../src/function/once.ts","../../src/function/throttle.ts","../../src/function/negate.ts"],"sourcesContent":["export { after } from './after.ts';\nexport { debounce } from './debounce.ts';\nexport { noop } from './noop.ts';\nexport { once } from './once.ts';\nexport { throttle } from './throttle.ts';\nexport { negate } from './negate.ts';\n","/**\n * Creates a function that only executes starting from the `n`-th call.\n * The provided function will be invoked starting from the `n`-th call.\n *\n * This is particularly useful for scenarios involving events or asynchronous operations\n * where an action should occur only after a certain number of invocations.\n *\n * @template F - The type of the function to be invoked.\n * @param {number} n - The number of calls required for `func` to execute.\n * @param {F} func - The function to be invoked.\n * @returns {F} - A new function that:\n * - Tracks the number of calls.\n * - Invokes `func` starting from the `n`-th call.\n * - Returns `undefined` if fewer than `n` calls have been made.\n * @throws {Error} - Throws an error if `n` is negative.\n * @example\n *\n * const afterFn = after(3, () => {\n * console.log(\"called\")\n * });\n *\n * // Will not log anything.\n * afterFn()\n * // Will not log anything.\n * afterFn()\n * // Will log 'called'.\n * afterFn()\n */\n\nexport const after = <F extends (...args: any[]) => any>(n: number, func: F): F => {\n if (!Number.isInteger(n) || n < 0) {\n throw new Error(`n must be a non-negative integer.`);\n }\n\n let counter = 0;\n return ((...args: Parameters<F>) => {\n if (++counter >= n) {\n return func(...args);\n }\n return undefined;\n }) as F;\n};\n","interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: number | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) as any;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n","/**\n * A no-operation function that does nothing.\n * This can be used as a placeholder or default function.\n *\n * @example\n * noop(); // Does nothing\n *\n * @returns {void} This function does not return anything.\n */\nexport function noop(): void {}\n","/**\n * Creates a function that is restricted to invoking the provided function `func` once.\n * Repeated calls to the function will return the value from the first invocation.\n *\n * @template F - The type of function.\n * @param {F} func - The function to restrict.\n * @returns {F} A new function that invokes `func` once and caches the result.\n *\n * @example\n * const initialize = once(() => {\n * console.log('Initialized!');\n * return true;\n * });\n *\n * initialize(); // Logs: 'Initialized!' and returns true\n * initialize(); // Returns true without logging\n */\nexport function once<F extends () => any>(func: F): F {\n let called = false;\n let cache: ReturnType<F> | undefined;\n\n return function () {\n if (called) {\n return cache;\n }\n\n const result = func();\n\n called = true;\n cache = result;\n\n return result;\n } as F;\n}\n","/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @template F - The type of function.\n * @param {F} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {F} A new throttled function that accepts the same parameters as the original function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n *\n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n *\n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle<F extends (...args: any[]) => void>(func: F, throttleMs: number): F {\n let lastCallTime: number | null;\n\n const throttledFunction = function (...args: Parameters<F>) {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func(...args);\n }\n } as F;\n\n return throttledFunction;\n}\n","/**\n * Creates a function that negates the result of the predicate function.\n *\n * @template F - The type of the function to negate.\n * @param {F} func - The function to negate.\n * @returns {F} The new negated function, which negates the boolean result of `func`.\n */\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC6BO,IAAM,QAAQ,CAAoC,GAAW,SAAe;AACjF,MAAI,CAAC,OAAO,UAAU,CAAC,KAAK,IAAI,GAAG;AACjC,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,MAAI,UAAU;AACd,SAAQ,IAAI,SAAwB;AAClC,QAAI,EAAE,WAAW,GAAG;AAClB,aAAO,KAAK,GAAG,IAAI;AAAA,IACrB;AACA,WAAO;AAAA,EACT;AACF;;;ACFO,SAAS,SACd,MACA,YACA,EAAE,OAAO,IAAqB,CAAC,GACH;AAC5B,MAAI,YAA2B;AAE/B,QAAM,YAAY,YAAa,MAAqB;AAClD,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AAAA,IACxB;AAEA,QAAI,QAAQ,SAAS;AACnB;AAAA,IACF;AAEA,gBAAY,WAAW,MAAM;AAC3B,WAAK,GAAG,IAAI;AACZ,kBAAY;AAAA,IACd,GAAG,UAAU;AAAA,EACf;AAEA,QAAM,UAAU,WAAY;AAC1B,cAAU,OAAO;AAAA,EACnB;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,UAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAEzD,SAAO;AACT;;;AClEO,SAAS,OAAa;AAAC;;;ACQvB,SAAS,KAA0B,MAAY;AACpD,MAAI,SAAS;AACb,MAAI;AAEJ,SAAO,WAAY;AACjB,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,KAAK;AAEpB,aAAS;AACT,YAAQ;AAER,WAAO;AAAA,EACT;AACF;;;ACPO,SAAS,SAA6C,MAAS,YAAuB;AAC3F,MAAI;AAEJ,QAAM,oBAAoB,YAAa,MAAqB;AAC1D,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,gBAAgB,QAAQ,MAAM,gBAAgB,YAAY;AAC5D,qBAAe;AACf,WAAK,GAAG,IAAI;AAAA,IACd;AAAA,EACF;AAEA,SAAO;AACT;;;AChCO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","names":[]}
@@ -1,13 +1,4 @@
1
1
  import "../chunk-ZA2XI3OV.mjs";
2
- import {
3
- throttle
4
- } from "../chunk-QOJGMVVR.mjs";
5
- import {
6
- after
7
- } from "../chunk-OGZMEWPR.mjs";
8
- import {
9
- debounce
10
- } from "../chunk-3IP4JVLL.mjs";
11
2
  import {
12
3
  negate
13
4
  } from "../chunk-BOOQBJN2.mjs";
@@ -17,7 +8,16 @@ import {
17
8
  import {
18
9
  once
19
10
  } from "../chunk-CMBC4MXG.mjs";
20
- import "../chunk-24FKGR6U.mjs";
11
+ import {
12
+ throttle
13
+ } from "../chunk-QOJGMVVR.mjs";
14
+ import {
15
+ after
16
+ } from "../chunk-OGZMEWPR.mjs";
17
+ import {
18
+ debounce
19
+ } from "../chunk-MSHSKENG.mjs";
20
+ import "../chunk-J5LGTIGS.mjs";
21
21
  export {
22
22
  after,
23
23
  debounce,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  negate
3
3
  } from "../chunk-BOOQBJN2.mjs";
4
- import "../chunk-24FKGR6U.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  negate
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  noop
3
3
  } from "../chunk-LKXCOLNY.mjs";
4
- import "../chunk-24FKGR6U.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  noop
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  once
3
3
  } from "../chunk-CMBC4MXG.mjs";
4
- import "../chunk-24FKGR6U.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  once
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  throttle
3
3
  } from "../chunk-QOJGMVVR.mjs";
4
- import "../chunk-24FKGR6U.mjs";
4
+ import "../chunk-J5LGTIGS.mjs";
5
5
  export {
6
6
  throttle
7
7
  };
package/dist/index.d.mts CHANGED
@@ -85,6 +85,7 @@ export { isPlainObject } from './predicate/isPlainObject.mjs';
85
85
  export { isFunction } from './predicate/isFunction.mjs';
86
86
  export { isArrayLike } from './predicate/isArrayLike.mjs';
87
87
  export { isTypedArray } from './predicate/isTypedArray.mjs';
88
+ export { isPrimitive } from './predicate/isPrimitive.mjs';
88
89
  export { delay } from './promise/delay.mjs';
89
90
  export { withTimeout } from './promise/withTimeout.mjs';
90
91
  export { camelCase } from './string/camelCase.mjs';
package/dist/index.d.ts CHANGED
@@ -85,6 +85,7 @@ export { isPlainObject } from './predicate/isPlainObject.js';
85
85
  export { isFunction } from './predicate/isFunction.js';
86
86
  export { isArrayLike } from './predicate/isArrayLike.js';
87
87
  export { isTypedArray } from './predicate/isTypedArray.js';
88
+ export { isPrimitive } from './predicate/isPrimitive.js';
88
89
  export { delay } from './promise/delay.js';
89
90
  export { withTimeout } from './promise/withTimeout.js';
90
91
  export { camelCase } from './string/camelCase.js';