@vinicunca/perkakas 1.14.0 → 1.16.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 (563) hide show
  1. package/dist/add-prop.cjs +1 -1
  2. package/dist/add-prop.cjs.map +1 -1
  3. package/dist/add-prop.js.map +1 -1
  4. package/dist/add.cjs +1 -1
  5. package/dist/add.cjs.map +1 -1
  6. package/dist/add.js.map +1 -1
  7. package/dist/all-pass.cjs +1 -1
  8. package/dist/all-pass.cjs.map +1 -1
  9. package/dist/all-pass.js.map +1 -1
  10. package/dist/any-pass.cjs +1 -1
  11. package/dist/any-pass.cjs.map +1 -1
  12. package/dist/any-pass.js.map +1 -1
  13. package/dist/{binary-search-cutoff-index-TJlnoie4.js → binary-search-cutoff-index-CRPy-dOJ.js} +1 -1
  14. package/dist/{binary-search-cutoff-index-TJlnoie4.js.map → binary-search-cutoff-index-CRPy-dOJ.js.map} +1 -1
  15. package/dist/binary-search-cutoff-index-CdUUMUB1.cjs +2 -0
  16. package/dist/{binary-search-cutoff-index-CLFtXYPc.cjs.map → binary-search-cutoff-index-CdUUMUB1.cjs.map} +1 -1
  17. package/dist/capitalize.cjs +1 -1
  18. package/dist/capitalize.cjs.map +1 -1
  19. package/dist/capitalize.js.map +1 -1
  20. package/dist/ceil.cjs +1 -1
  21. package/dist/ceil.cjs.map +1 -1
  22. package/dist/ceil.js +1 -1
  23. package/dist/ceil.js.map +1 -1
  24. package/dist/chunk.cjs +1 -1
  25. package/dist/chunk.cjs.map +1 -1
  26. package/dist/chunk.js.map +1 -1
  27. package/dist/clamp.cjs +1 -1
  28. package/dist/clamp.cjs.map +1 -1
  29. package/dist/clamp.js.map +1 -1
  30. package/dist/clone.cjs +1 -1
  31. package/dist/clone.cjs.map +1 -1
  32. package/dist/clone.js.map +1 -1
  33. package/dist/concat.cjs +1 -1
  34. package/dist/concat.cjs.map +1 -1
  35. package/dist/concat.js.map +1 -1
  36. package/dist/conditional.cjs +2 -1
  37. package/dist/conditional.cjs.map +1 -0
  38. package/dist/conditional.js +2 -1
  39. package/dist/conditional.js.map +1 -0
  40. package/dist/constant.cjs.map +1 -1
  41. package/dist/constant.js.map +1 -1
  42. package/dist/count-by.cjs +1 -1
  43. package/dist/count-by.cjs.map +1 -1
  44. package/dist/count-by.js.map +1 -1
  45. package/dist/{curry-from-lazy-CtH1dp14.js → curry-from-lazy-BoPMn2L_.js} +1 -1
  46. package/dist/{curry-from-lazy-CtH1dp14.js.map → curry-from-lazy-BoPMn2L_.js.map} +1 -1
  47. package/dist/{curry-from-lazy-BvN_VKlH.cjs → curry-from-lazy-mdjeRP1g.cjs} +2 -2
  48. package/dist/{curry-from-lazy-BvN_VKlH.cjs.map → curry-from-lazy-mdjeRP1g.cjs.map} +1 -1
  49. package/dist/curry-on-Et2NUOHd.js +2 -0
  50. package/dist/curry-on-Et2NUOHd.js.map +1 -0
  51. package/dist/curry-on-wBH_q-mO.cjs +2 -0
  52. package/dist/curry-on-wBH_q-mO.cjs.map +1 -0
  53. package/dist/{curry-order-rules-DsJSy3gX.cjs → curry-order-rules-CacOTzfW.cjs} +2 -2
  54. package/dist/{curry-order-rules-DsJSy3gX.cjs.map → curry-order-rules-CacOTzfW.cjs.map} +1 -1
  55. package/dist/{curry-order-rules-BLyCSMdZ.js → curry-order-rules-Dage-BeC.js} +1 -1
  56. package/dist/{curry-order-rules-BLyCSMdZ.js.map → curry-order-rules-Dage-BeC.js.map} +1 -1
  57. package/dist/curry.cjs +1 -1
  58. package/dist/curry.cjs.map +1 -1
  59. package/dist/curry.js +1 -1
  60. package/dist/curry.js.map +1 -1
  61. package/dist/debounce.cjs.map +1 -1
  62. package/dist/debounce.js.map +1 -1
  63. package/dist/default-to.cjs +1 -1
  64. package/dist/default-to.cjs.map +1 -1
  65. package/dist/default-to.js.map +1 -1
  66. package/dist/difference-with.cjs +1 -1
  67. package/dist/difference-with.cjs.map +1 -1
  68. package/dist/difference-with.js +1 -1
  69. package/dist/difference-with.js.map +1 -1
  70. package/dist/difference.cjs +1 -1
  71. package/dist/difference.cjs.map +1 -1
  72. package/dist/difference.js +1 -1
  73. package/dist/difference.js.map +1 -1
  74. package/dist/divide.cjs +1 -1
  75. package/dist/divide.cjs.map +1 -1
  76. package/dist/divide.js.map +1 -1
  77. package/dist/do-nothing.cjs.map +1 -1
  78. package/dist/do-nothing.js.map +1 -1
  79. package/dist/drop-first-by.cjs +1 -1
  80. package/dist/drop-first-by.cjs.map +1 -1
  81. package/dist/drop-first-by.js +1 -1
  82. package/dist/drop-first-by.js.map +1 -1
  83. package/dist/drop-last-while.cjs +1 -1
  84. package/dist/drop-last-while.cjs.map +1 -1
  85. package/dist/drop-last-while.js.map +1 -1
  86. package/dist/drop-last.cjs +1 -1
  87. package/dist/drop-last.cjs.map +1 -1
  88. package/dist/drop-last.js.map +1 -1
  89. package/dist/drop-while.cjs +1 -1
  90. package/dist/drop-while.cjs.map +1 -1
  91. package/dist/drop-while.js.map +1 -1
  92. package/dist/drop.cjs +1 -1
  93. package/dist/drop.cjs.map +1 -1
  94. package/dist/drop.js +1 -1
  95. package/dist/drop.js.map +1 -1
  96. package/dist/ends-with.cjs +1 -1
  97. package/dist/ends-with.cjs.map +1 -1
  98. package/dist/ends-with.js.map +1 -1
  99. package/dist/entries.cjs +1 -1
  100. package/dist/entries.cjs.map +1 -1
  101. package/dist/entries.js.map +1 -1
  102. package/dist/evolve.cjs +1 -1
  103. package/dist/evolve.cjs.map +1 -1
  104. package/dist/evolve.js.map +1 -1
  105. package/dist/filter.cjs +1 -1
  106. package/dist/filter.cjs.map +1 -1
  107. package/dist/filter.js +1 -1
  108. package/dist/filter.js.map +1 -1
  109. package/dist/find-index.cjs +1 -1
  110. package/dist/find-index.cjs.map +1 -1
  111. package/dist/find-index.js.map +1 -1
  112. package/dist/find-last-index.cjs +1 -1
  113. package/dist/find-last-index.cjs.map +1 -1
  114. package/dist/find-last-index.js.map +1 -1
  115. package/dist/find-last.cjs +1 -1
  116. package/dist/find-last.cjs.map +1 -1
  117. package/dist/find-last.js.map +1 -1
  118. package/dist/find.cjs +1 -1
  119. package/dist/find.cjs.map +1 -1
  120. package/dist/find.js +1 -1
  121. package/dist/find.js.map +1 -1
  122. package/dist/first-by.cjs +1 -1
  123. package/dist/first-by.cjs.map +1 -1
  124. package/dist/first-by.js +1 -1
  125. package/dist/first-by.js.map +1 -1
  126. package/dist/first.cjs +1 -1
  127. package/dist/first.cjs.map +1 -1
  128. package/dist/first.js +1 -1
  129. package/dist/first.js.map +1 -1
  130. package/dist/flat-map.cjs +1 -1
  131. package/dist/flat-map.cjs.map +1 -1
  132. package/dist/flat-map.js.map +1 -1
  133. package/dist/flat.cjs +1 -1
  134. package/dist/flat.cjs.map +1 -1
  135. package/dist/flat.js +1 -1
  136. package/dist/flat.js.map +1 -1
  137. package/dist/floor.cjs +1 -1
  138. package/dist/floor.cjs.map +1 -1
  139. package/dist/floor.js +1 -1
  140. package/dist/floor.js.map +1 -1
  141. package/dist/for-each-obj.cjs +1 -1
  142. package/dist/for-each-obj.cjs.map +1 -1
  143. package/dist/for-each-obj.js.map +1 -1
  144. package/dist/for-each.cjs +1 -1
  145. package/dist/for-each.cjs.map +1 -1
  146. package/dist/for-each.js.map +1 -1
  147. package/dist/from-entries.cjs +1 -1
  148. package/dist/from-entries.cjs.map +1 -1
  149. package/dist/from-entries.js.map +1 -1
  150. package/dist/from-keys.cjs +1 -1
  151. package/dist/from-keys.cjs.map +1 -1
  152. package/dist/from-keys.js.map +1 -1
  153. package/dist/funnel.cjs.map +1 -1
  154. package/dist/funnel.js.map +1 -1
  155. package/dist/group-by-prop.cjs +1 -1
  156. package/dist/group-by-prop.cjs.map +1 -1
  157. package/dist/group-by-prop.js.map +1 -1
  158. package/dist/group-by.cjs +1 -1
  159. package/dist/group-by.cjs.map +1 -1
  160. package/dist/group-by.js.map +1 -1
  161. package/dist/has-at-least.cjs +1 -1
  162. package/dist/has-at-least.cjs.map +1 -1
  163. package/dist/has-at-least.js.map +1 -1
  164. package/dist/has-prop.cjs +2 -0
  165. package/dist/has-prop.cjs.map +1 -0
  166. package/dist/has-prop.js +2 -0
  167. package/dist/has-prop.js.map +1 -0
  168. package/dist/has-sub-object.cjs +1 -1
  169. package/dist/has-sub-object.cjs.map +1 -1
  170. package/dist/has-sub-object.js.map +1 -1
  171. package/dist/heap-BK0Y5t1Y.cjs +2 -0
  172. package/dist/{heap-C0zPQGC0.cjs.map → heap-BK0Y5t1Y.cjs.map} +1 -1
  173. package/dist/{heap-M6D40vkc.js → heap-CL5ahv5n.js} +2 -2
  174. package/dist/{heap-M6D40vkc.js.map → heap-CL5ahv5n.js.map} +1 -1
  175. package/dist/human-readable-file-size.cjs.map +1 -1
  176. package/dist/human-readable-file-size.js.map +1 -1
  177. package/dist/identity.cjs.map +1 -1
  178. package/dist/identity.js.map +1 -1
  179. package/dist/index-by.cjs +1 -1
  180. package/dist/index-by.cjs.map +1 -1
  181. package/dist/index-by.js.map +1 -1
  182. package/dist/index.cjs +1 -1
  183. package/dist/index.cjs.map +1 -1
  184. package/dist/index.d.cts +174 -202
  185. package/dist/index.d.cts.map +1 -1
  186. package/dist/index.d.ts +174 -202
  187. package/dist/index.d.ts.map +1 -1
  188. package/dist/index.js +1 -1
  189. package/dist/index.js.map +1 -1
  190. package/dist/intersection-with.cjs +1 -1
  191. package/dist/intersection-with.cjs.map +1 -1
  192. package/dist/intersection-with.js +1 -1
  193. package/dist/intersection-with.js.map +1 -1
  194. package/dist/intersection.cjs +1 -1
  195. package/dist/intersection.cjs.map +1 -1
  196. package/dist/intersection.js +1 -1
  197. package/dist/intersection.js.map +1 -1
  198. package/dist/invert.cjs +1 -1
  199. package/dist/invert.cjs.map +1 -1
  200. package/dist/invert.js.map +1 -1
  201. package/dist/is-array.cjs.map +1 -1
  202. package/dist/is-array.js.map +1 -1
  203. package/dist/is-big-int.cjs.map +1 -1
  204. package/dist/is-big-int.js.map +1 -1
  205. package/dist/is-boolean.cjs.map +1 -1
  206. package/dist/is-boolean.js.map +1 -1
  207. package/dist/is-date.cjs.map +1 -1
  208. package/dist/is-date.js.map +1 -1
  209. package/dist/is-deep-equal.cjs +1 -1
  210. package/dist/is-deep-equal.cjs.map +1 -1
  211. package/dist/is-deep-equal.js +1 -1
  212. package/dist/is-deep-equal.js.map +1 -1
  213. package/dist/is-defined.cjs.map +1 -1
  214. package/dist/is-defined.js.map +1 -1
  215. package/dist/is-empty.cjs.map +1 -1
  216. package/dist/is-empty.js.map +1 -1
  217. package/dist/is-emptyish.cjs.map +1 -1
  218. package/dist/is-emptyish.js.map +1 -1
  219. package/dist/is-error.cjs.map +1 -1
  220. package/dist/is-error.js.map +1 -1
  221. package/dist/is-function.cjs.map +1 -1
  222. package/dist/is-function.js.map +1 -1
  223. package/dist/is-included-in.cjs.map +1 -1
  224. package/dist/is-included-in.js.map +1 -1
  225. package/dist/is-non-null.cjs.map +1 -1
  226. package/dist/is-non-null.js.map +1 -1
  227. package/dist/is-non-nullish.cjs.map +1 -1
  228. package/dist/is-non-nullish.js.map +1 -1
  229. package/dist/is-not.cjs.map +1 -1
  230. package/dist/is-not.js.map +1 -1
  231. package/dist/is-nullish.cjs.map +1 -1
  232. package/dist/is-nullish.js.map +1 -1
  233. package/dist/is-number.cjs.map +1 -1
  234. package/dist/is-number.js.map +1 -1
  235. package/dist/is-object-type.cjs.map +1 -1
  236. package/dist/is-object-type.js.map +1 -1
  237. package/dist/is-plain-object.cjs.map +1 -1
  238. package/dist/is-plain-object.js.map +1 -1
  239. package/dist/is-promise.cjs.map +1 -1
  240. package/dist/is-promise.js.map +1 -1
  241. package/dist/is-shallow-equal.cjs +1 -1
  242. package/dist/is-shallow-equal.cjs.map +1 -1
  243. package/dist/is-shallow-equal.js.map +1 -1
  244. package/dist/is-strict-equal.cjs +1 -1
  245. package/dist/is-strict-equal.cjs.map +1 -1
  246. package/dist/is-strict-equal.js.map +1 -1
  247. package/dist/is-string.cjs.map +1 -1
  248. package/dist/is-string.js.map +1 -1
  249. package/dist/is-symbol.cjs.map +1 -1
  250. package/dist/is-symbol.js.map +1 -1
  251. package/dist/is-truthy.cjs.map +1 -1
  252. package/dist/is-truthy.js.map +1 -1
  253. package/dist/join.cjs +1 -1
  254. package/dist/join.cjs.map +1 -1
  255. package/dist/join.js.map +1 -1
  256. package/dist/key-codes.cjs.map +1 -1
  257. package/dist/key-codes.js.map +1 -1
  258. package/dist/keys.cjs +1 -1
  259. package/dist/keys.cjs.map +1 -1
  260. package/dist/keys.js.map +1 -1
  261. package/dist/last.cjs +1 -1
  262. package/dist/last.cjs.map +1 -1
  263. package/dist/last.js.map +1 -1
  264. package/dist/{lazy-data-last-impl-Vt_M0l7X.js → lazy-data-last-impl--3B10z3s.js} +1 -1
  265. package/dist/{lazy-data-last-impl-Vt_M0l7X.js.map → lazy-data-last-impl--3B10z3s.js.map} +1 -1
  266. package/dist/lazy-data-last-impl-Dd5zjCfU.cjs +2 -0
  267. package/dist/{lazy-data-last-impl-B05ZpguF.cjs.map → lazy-data-last-impl-Dd5zjCfU.cjs.map} +1 -1
  268. package/dist/length.cjs +1 -1
  269. package/dist/length.cjs.map +1 -1
  270. package/dist/length.js.map +1 -1
  271. package/dist/map-keys.cjs +1 -1
  272. package/dist/map-keys.cjs.map +1 -1
  273. package/dist/map-keys.js.map +1 -1
  274. package/dist/map-to-obj.cjs +1 -1
  275. package/dist/map-to-obj.cjs.map +1 -1
  276. package/dist/map-to-obj.js.map +1 -1
  277. package/dist/map-values.cjs +1 -1
  278. package/dist/map-values.cjs.map +1 -1
  279. package/dist/map-values.js.map +1 -1
  280. package/dist/map-with-feedback.cjs +1 -1
  281. package/dist/map-with-feedback.cjs.map +1 -1
  282. package/dist/map-with-feedback.js +1 -1
  283. package/dist/map-with-feedback.js.map +1 -1
  284. package/dist/map.cjs +1 -1
  285. package/dist/map.cjs.map +1 -1
  286. package/dist/map.js.map +1 -1
  287. package/dist/mean-by.cjs +1 -1
  288. package/dist/mean-by.cjs.map +1 -1
  289. package/dist/mean-by.js.map +1 -1
  290. package/dist/mean.cjs +1 -1
  291. package/dist/mean.cjs.map +1 -1
  292. package/dist/mean.js.map +1 -1
  293. package/dist/median.cjs +1 -1
  294. package/dist/median.cjs.map +1 -1
  295. package/dist/median.js.map +1 -1
  296. package/dist/merge-all.cjs.map +1 -1
  297. package/dist/merge-all.js.map +1 -1
  298. package/dist/merge-deep.cjs +1 -1
  299. package/dist/merge-deep.cjs.map +1 -1
  300. package/dist/merge-deep.js.map +1 -1
  301. package/dist/merge.cjs +1 -1
  302. package/dist/merge.cjs.map +1 -1
  303. package/dist/merge.js.map +1 -1
  304. package/dist/multiply.cjs +1 -1
  305. package/dist/multiply.cjs.map +1 -1
  306. package/dist/multiply.js.map +1 -1
  307. package/dist/{nth-by-zZ3RM-mR.cjs → nth-by-BrkoqeV2.cjs} +2 -2
  308. package/dist/{nth-by-zZ3RM-mR.cjs.map → nth-by-BrkoqeV2.cjs.map} +1 -1
  309. package/dist/{nth-by-DhfNV5xd.js → nth-by-DGcGGvJX.js} +2 -2
  310. package/dist/{nth-by-DhfNV5xd.js.map → nth-by-DGcGGvJX.js.map} +1 -1
  311. package/dist/nth-by.cjs +1 -1
  312. package/dist/nth-by.js +1 -1
  313. package/dist/obj-of.cjs +1 -1
  314. package/dist/obj-of.cjs.map +1 -1
  315. package/dist/obj-of.js.map +1 -1
  316. package/dist/omit-by.cjs +1 -1
  317. package/dist/omit-by.cjs.map +1 -1
  318. package/dist/omit-by.js.map +1 -1
  319. package/dist/omit.cjs +1 -1
  320. package/dist/omit.cjs.map +1 -1
  321. package/dist/omit.js.map +1 -1
  322. package/dist/once.cjs.map +1 -1
  323. package/dist/once.js.map +1 -1
  324. package/dist/only.cjs +1 -1
  325. package/dist/only.cjs.map +1 -1
  326. package/dist/only.js.map +1 -1
  327. package/dist/partial-bind.cjs.map +1 -1
  328. package/dist/partial-bind.js.map +1 -1
  329. package/dist/partial-last-bind.cjs.map +1 -1
  330. package/dist/partial-last-bind.js.map +1 -1
  331. package/dist/partition.cjs +1 -1
  332. package/dist/partition.cjs.map +1 -1
  333. package/dist/partition.js.map +1 -1
  334. package/dist/path-or.cjs +1 -1
  335. package/dist/path-or.cjs.map +1 -1
  336. package/dist/path-or.js.map +1 -1
  337. package/dist/pick-by.cjs +1 -1
  338. package/dist/pick-by.cjs.map +1 -1
  339. package/dist/pick-by.js.map +1 -1
  340. package/dist/pick.cjs +1 -1
  341. package/dist/pick.cjs.map +1 -1
  342. package/dist/pick.js.map +1 -1
  343. package/dist/pipe.cjs +1 -1
  344. package/dist/pipe.cjs.map +1 -1
  345. package/dist/pipe.js +1 -1
  346. package/dist/pipe.js.map +1 -1
  347. package/dist/piped.cjs +1 -1
  348. package/dist/piped.cjs.map +1 -1
  349. package/dist/piped.js.map +1 -1
  350. package/dist/product.cjs +1 -1
  351. package/dist/product.cjs.map +1 -1
  352. package/dist/product.js.map +1 -1
  353. package/dist/prop.cjs.map +1 -1
  354. package/dist/prop.js.map +1 -1
  355. package/dist/pull-object.cjs +1 -1
  356. package/dist/pull-object.cjs.map +1 -1
  357. package/dist/pull-object.js.map +1 -1
  358. package/dist/random-big-int.cjs.map +1 -1
  359. package/dist/random-big-int.js.map +1 -1
  360. package/dist/random-integer.cjs.map +1 -1
  361. package/dist/random-integer.js.map +1 -1
  362. package/dist/random-string.cjs +1 -1
  363. package/dist/random-string.cjs.map +1 -1
  364. package/dist/random-string.js.map +1 -1
  365. package/dist/range.cjs +1 -1
  366. package/dist/range.cjs.map +1 -1
  367. package/dist/range.js.map +1 -1
  368. package/dist/rank-by.cjs +1 -1
  369. package/dist/rank-by.cjs.map +1 -1
  370. package/dist/rank-by.js +1 -1
  371. package/dist/rank-by.js.map +1 -1
  372. package/dist/reduce.cjs +1 -1
  373. package/dist/reduce.cjs.map +1 -1
  374. package/dist/reduce.js.map +1 -1
  375. package/dist/reverse.cjs +1 -1
  376. package/dist/reverse.cjs.map +1 -1
  377. package/dist/reverse.js.map +1 -1
  378. package/dist/round.cjs +1 -1
  379. package/dist/round.cjs.map +1 -1
  380. package/dist/round.js +1 -1
  381. package/dist/round.js.map +1 -1
  382. package/dist/sample.cjs +1 -1
  383. package/dist/sample.cjs.map +1 -1
  384. package/dist/sample.js.map +1 -1
  385. package/dist/set-path.cjs +1 -1
  386. package/dist/set-path.cjs.map +1 -1
  387. package/dist/set-path.js.map +1 -1
  388. package/dist/set.cjs +1 -1
  389. package/dist/set.cjs.map +1 -1
  390. package/dist/set.js.map +1 -1
  391. package/dist/shuffle.cjs +1 -1
  392. package/dist/shuffle.cjs.map +1 -1
  393. package/dist/shuffle.js.map +1 -1
  394. package/dist/sleep.cjs.map +1 -1
  395. package/dist/sleep.js.map +1 -1
  396. package/dist/slice-string.cjs.map +1 -1
  397. package/dist/slice-string.js.map +1 -1
  398. package/dist/slugify.cjs.map +1 -1
  399. package/dist/slugify.js.map +1 -1
  400. package/dist/sort-by.cjs +1 -1
  401. package/dist/sort-by.cjs.map +1 -1
  402. package/dist/sort-by.js +1 -1
  403. package/dist/sort-by.js.map +1 -1
  404. package/dist/sort.cjs +1 -1
  405. package/dist/sort.cjs.map +1 -1
  406. package/dist/sort.js.map +1 -1
  407. package/dist/sorted-index-by.cjs +1 -1
  408. package/dist/sorted-index-by.cjs.map +1 -1
  409. package/dist/sorted-index-by.js +1 -1
  410. package/dist/sorted-index-by.js.map +1 -1
  411. package/dist/sorted-index-with.cjs +1 -1
  412. package/dist/sorted-index-with.cjs.map +1 -1
  413. package/dist/sorted-index-with.js +1 -1
  414. package/dist/sorted-index-with.js.map +1 -1
  415. package/dist/sorted-index.cjs +1 -1
  416. package/dist/sorted-index.cjs.map +1 -1
  417. package/dist/sorted-index.js +1 -1
  418. package/dist/sorted-index.js.map +1 -1
  419. package/dist/sorted-last-index-by.cjs +1 -1
  420. package/dist/sorted-last-index-by.cjs.map +1 -1
  421. package/dist/sorted-last-index-by.js +1 -1
  422. package/dist/sorted-last-index-by.js.map +1 -1
  423. package/dist/sorted-last-index.cjs +1 -1
  424. package/dist/sorted-last-index.cjs.map +1 -1
  425. package/dist/sorted-last-index.js +1 -1
  426. package/dist/sorted-last-index.js.map +1 -1
  427. package/dist/splice.cjs +1 -1
  428. package/dist/splice.cjs.map +1 -1
  429. package/dist/splice.js +1 -1
  430. package/dist/splice.js.map +1 -1
  431. package/dist/split-at.cjs +1 -1
  432. package/dist/split-at.cjs.map +1 -1
  433. package/dist/split-at.js.map +1 -1
  434. package/dist/split-when.cjs +1 -1
  435. package/dist/split-when.cjs.map +1 -1
  436. package/dist/split-when.js.map +1 -1
  437. package/dist/split.cjs.map +1 -1
  438. package/dist/split.js.map +1 -1
  439. package/dist/starts-with.cjs +1 -1
  440. package/dist/starts-with.cjs.map +1 -1
  441. package/dist/starts-with.js.map +1 -1
  442. package/dist/string-to-path.cjs.map +1 -1
  443. package/dist/string-to-path.js.map +1 -1
  444. package/dist/subtract.cjs +1 -1
  445. package/dist/subtract.cjs.map +1 -1
  446. package/dist/subtract.js.map +1 -1
  447. package/dist/sum-by.cjs +1 -1
  448. package/dist/sum-by.cjs.map +1 -1
  449. package/dist/sum-by.js.map +1 -1
  450. package/dist/sum.cjs +1 -1
  451. package/dist/sum.cjs.map +1 -1
  452. package/dist/sum.js.map +1 -1
  453. package/dist/swap-in-place-CllcD0HG.cjs +2 -0
  454. package/dist/{swap-in-place-D1vasegg.cjs.map → swap-in-place-CllcD0HG.cjs.map} +1 -1
  455. package/dist/{swap-in-place-BzNaxwB3.js → swap-in-place-ubtnp8en.js} +1 -1
  456. package/dist/{swap-in-place-BzNaxwB3.js.map → swap-in-place-ubtnp8en.js.map} +1 -1
  457. package/dist/swap-indices.cjs +1 -1
  458. package/dist/swap-indices.cjs.map +1 -1
  459. package/dist/swap-indices.js.map +1 -1
  460. package/dist/swap-props.cjs +1 -1
  461. package/dist/swap-props.cjs.map +1 -1
  462. package/dist/swap-props.js.map +1 -1
  463. package/dist/take-first-by.cjs +1 -1
  464. package/dist/take-first-by.cjs.map +1 -1
  465. package/dist/take-first-by.js +1 -1
  466. package/dist/take-first-by.js.map +1 -1
  467. package/dist/take-last-while.cjs +1 -1
  468. package/dist/take-last-while.cjs.map +1 -1
  469. package/dist/take-last-while.js.map +1 -1
  470. package/dist/take-last.cjs +1 -1
  471. package/dist/take-last.cjs.map +1 -1
  472. package/dist/take-last.js.map +1 -1
  473. package/dist/take-while.cjs +1 -1
  474. package/dist/take-while.cjs.map +1 -1
  475. package/dist/take-while.js.map +1 -1
  476. package/dist/take.cjs +1 -1
  477. package/dist/take.cjs.map +1 -1
  478. package/dist/take.js +1 -1
  479. package/dist/take.js.map +1 -1
  480. package/dist/tap.cjs +1 -1
  481. package/dist/tap.cjs.map +1 -1
  482. package/dist/tap.js.map +1 -1
  483. package/dist/times.cjs +1 -1
  484. package/dist/times.cjs.map +1 -1
  485. package/dist/times.js.map +1 -1
  486. package/dist/to-camel-case.cjs +1 -1
  487. package/dist/to-camel-case.cjs.map +1 -1
  488. package/dist/to-camel-case.js +1 -1
  489. package/dist/to-camel-case.js.map +1 -1
  490. package/dist/to-kebab-case.cjs +1 -1
  491. package/dist/to-kebab-case.cjs.map +1 -1
  492. package/dist/to-kebab-case.js +1 -1
  493. package/dist/to-kebab-case.js.map +1 -1
  494. package/dist/to-lower-case.cjs +1 -1
  495. package/dist/to-lower-case.cjs.map +1 -1
  496. package/dist/to-lower-case.js.map +1 -1
  497. package/dist/to-single-BOkjnmkm.cjs +2 -0
  498. package/dist/{to-single-BunGuk7o.cjs.map → to-single-BOkjnmkm.cjs.map} +1 -1
  499. package/dist/{to-single-XEXXW73e.js → to-single-D6t2BxVq.js} +1 -1
  500. package/dist/{to-single-XEXXW73e.js.map → to-single-D6t2BxVq.js.map} +1 -1
  501. package/dist/to-snake-case.cjs +1 -1
  502. package/dist/to-snake-case.cjs.map +1 -1
  503. package/dist/to-snake-case.js +1 -1
  504. package/dist/to-snake-case.js.map +1 -1
  505. package/dist/to-title-case.cjs +1 -1
  506. package/dist/to-title-case.cjs.map +1 -1
  507. package/dist/to-title-case.js +1 -1
  508. package/dist/to-title-case.js.map +1 -1
  509. package/dist/to-upper-case.cjs +1 -1
  510. package/dist/to-upper-case.cjs.map +1 -1
  511. package/dist/to-upper-case.js.map +1 -1
  512. package/dist/truncate.cjs.map +1 -1
  513. package/dist/truncate.js.map +1 -1
  514. package/dist/uncapitalize.cjs +1 -1
  515. package/dist/uncapitalize.cjs.map +1 -1
  516. package/dist/uncapitalize.js.map +1 -1
  517. package/dist/unique-by.cjs +1 -1
  518. package/dist/unique-by.cjs.map +1 -1
  519. package/dist/unique-by.js +1 -1
  520. package/dist/unique-by.js.map +1 -1
  521. package/dist/unique-with.cjs +1 -1
  522. package/dist/unique-with.cjs.map +1 -1
  523. package/dist/unique-with.js +1 -1
  524. package/dist/unique-with.js.map +1 -1
  525. package/dist/unique.cjs +1 -1
  526. package/dist/unique.cjs.map +1 -1
  527. package/dist/unique.js +1 -1
  528. package/dist/unique.js.map +1 -1
  529. package/dist/utility-evaluators-BGM19SpK.cjs +2 -0
  530. package/dist/{utility-evaluators-C8koSp9T.cjs.map → utility-evaluators-BGM19SpK.cjs.map} +1 -1
  531. package/dist/{utility-evaluators-ZAaUtL2Z.js → utility-evaluators-DDW55xeL.js} +1 -1
  532. package/dist/{utility-evaluators-ZAaUtL2Z.js.map → utility-evaluators-DDW55xeL.js.map} +1 -1
  533. package/dist/values.cjs +1 -1
  534. package/dist/values.cjs.map +1 -1
  535. package/dist/values.js.map +1 -1
  536. package/dist/when.cjs.map +1 -1
  537. package/dist/when.js.map +1 -1
  538. package/dist/{with-precision-CgRuf7Wl.js → with-precision-D-84B_By.js} +1 -1
  539. package/dist/{with-precision-CgRuf7Wl.js.map → with-precision-D-84B_By.js.map} +1 -1
  540. package/dist/{with-precision-DVi9325n.cjs → with-precision-Dy5W6bdk.cjs} +2 -2
  541. package/dist/{with-precision-DVi9325n.cjs.map → with-precision-Dy5W6bdk.cjs.map} +1 -1
  542. package/dist/{words-C8Rd_80F.cjs → words-B-9EXtsW.cjs} +2 -2
  543. package/dist/{words-C8Rd_80F.cjs.map → words-B-9EXtsW.cjs.map} +1 -1
  544. package/dist/{words-CYZ0Lyko.js → words-CN1Qil5U.js} +2 -2
  545. package/dist/{words-CYZ0Lyko.js.map → words-CN1Qil5U.js.map} +1 -1
  546. package/dist/zip-with.cjs +1 -1
  547. package/dist/zip-with.cjs.map +1 -1
  548. package/dist/zip-with.js +1 -1
  549. package/dist/zip-with.js.map +1 -1
  550. package/dist/zip.cjs +1 -1
  551. package/dist/zip.cjs.map +1 -1
  552. package/dist/zip.js.map +1 -1
  553. package/package.json +11 -11
  554. package/dist/binary-search-cutoff-index-CLFtXYPc.cjs +0 -2
  555. package/dist/conditional-3wcaMG9k.cjs +0 -2
  556. package/dist/conditional-3wcaMG9k.cjs.map +0 -1
  557. package/dist/conditional-CTEJD5TX.js +0 -2
  558. package/dist/conditional-CTEJD5TX.js.map +0 -1
  559. package/dist/heap-C0zPQGC0.cjs +0 -2
  560. package/dist/lazy-data-last-impl-B05ZpguF.cjs +0 -2
  561. package/dist/swap-in-place-D1vasegg.cjs +0 -2
  562. package/dist/to-single-BunGuk7o.cjs +0 -2
  563. package/dist/utility-evaluators-C8koSp9T.cjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"to-kebab-case.cjs","names":["curry","words"],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"oIA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAOC,EAAAA,EAAM,EAAK,CAAC,KAAK,IAAI,CAAC,aAAa"}
1
+ {"version":3,"file":"to-kebab-case.cjs","names":["curry","words"],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n // @ts-expect-error [ts2322] -- To avoid importing our own utilities for this\n // we are using the built-in `join` and `toLowerCase` functions which aren't\n // typed as well. This is equivalent to `toLowerCase(join(words(data), \"-\"))`\n // which TypeScript infers correctly as KebabCase.\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"oIA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAK1E,OAAOC,EAAAA,EAAM,CAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,YAAY,CAC3C"}
@@ -1,2 +1,2 @@
1
- import{curry as e}from"./curry.js";import{t}from"./words-CYZ0Lyko.js";function n(...t){return e(r,t)}function r(e){return t(e).join(`-`).toLowerCase()}export{n as toKebabCase};
1
+ import{curry as e}from"./curry.js";import{t}from"./words-CN1Qil5U.js";function n(...t){return e(r,t)}function r(e){return t(e).join(`-`).toLowerCase()}export{n as toKebabCase};
2
2
  //# sourceMappingURL=to-kebab-case.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-kebab-case.js","names":[],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"sEA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAM,EAAK,CAAC,KAAK,IAAI,CAAC,aAAa"}
1
+ {"version":3,"file":"to-kebab-case.js","names":[],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n // @ts-expect-error [ts2322] -- To avoid importing our own utilities for this\n // we are using the built-in `join` and `toLowerCase` functions which aren't\n // typed as well. This is equivalent to `toLowerCase(join(words(data), \"-\"))`\n // which TypeScript infers correctly as KebabCase.\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"sEA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAK1E,OAAO,EAAM,CAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,YAAY,CAC3C"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`);function t(...t){return e.curry(n,t)}function n(e){return e.toLowerCase()}exports.toLowerCase=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e){return e.toLowerCase()}exports.toLowerCase=t;
2
2
  //# sourceMappingURL=to-lower-case.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-lower-case.cjs","names":["curry"],"sources":["../src/to-lower-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toLowerCase(data);\n * @example\n * toLowerCase(\"Hello World\"); // \"hello world\"\n * @dataFirst\n * @category String\n */\nexport function toLowerCase<T extends string>(data: T): Lowercase<T>;\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toLowerCase()(data);\n * @example\n * pipe(\"Hello World\", toLowerCase()); // \"hello world\"\n * @dataLast\n * @category String\n */\nexport function toLowerCase(): <T extends string>(data: T) => Lowercase<T>;\n\nexport function toLowerCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toLowerCaseImplementation, args);\n}\n\nfunction toLowerCaseImplementation<T extends string>(data: T): Lowercase<T> {\n return data.toLowerCase();\n}\n"],"mappings":"kGAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,aAAa"}
1
+ {"version":3,"file":"to-lower-case.cjs","names":["curry"],"sources":["../src/to-lower-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toLowerCase(data);\n * @example\n * toLowerCase(\"Hello World\"); // \"hello world\"\n * @dataFirst\n * @category String\n */\nexport function toLowerCase<T extends string>(data: T): Lowercase<T>;\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toLowerCase()(data);\n * @example\n * pipe(\"Hello World\", toLowerCase()); // \"hello world\"\n * @dataLast\n * @category String\n */\nexport function toLowerCase(): <T extends string>(data: T) => Lowercase<T>;\n\nexport function toLowerCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toLowerCaseImplementation, args);\n}\n\nfunction toLowerCaseImplementation<T extends string>(data: T): Lowercase<T> {\n return data.toLowerCase();\n}\n"],"mappings":"kGAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,YAAY,CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"to-lower-case.js","names":[],"sources":["../src/to-lower-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toLowerCase(data);\n * @example\n * toLowerCase(\"Hello World\"); // \"hello world\"\n * @dataFirst\n * @category String\n */\nexport function toLowerCase<T extends string>(data: T): Lowercase<T>;\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toLowerCase()(data);\n * @example\n * pipe(\"Hello World\", toLowerCase()); // \"hello world\"\n * @dataLast\n * @category String\n */\nexport function toLowerCase(): <T extends string>(data: T) => Lowercase<T>;\n\nexport function toLowerCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toLowerCaseImplementation, args);\n}\n\nfunction toLowerCaseImplementation<T extends string>(data: T): Lowercase<T> {\n return data.toLowerCase();\n}\n"],"mappings":"mCAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,aAAa"}
1
+ {"version":3,"file":"to-lower-case.js","names":[],"sources":["../src/to-lower-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toLowerCase(data);\n * @example\n * toLowerCase(\"Hello World\"); // \"hello world\"\n * @dataFirst\n * @category String\n */\nexport function toLowerCase<T extends string>(data: T): Lowercase<T>;\n\n/**\n * Replaces all uppercase characters with their lowercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and for display purposes use CSS [`text-transform: lowercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toLowerCase()(data);\n * @example\n * pipe(\"Hello World\", toLowerCase()); // \"hello world\"\n * @dataLast\n * @category String\n */\nexport function toLowerCase(): <T extends string>(data: T) => Lowercase<T>;\n\nexport function toLowerCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toLowerCaseImplementation, args);\n}\n\nfunction toLowerCaseImplementation<T extends string>(data: T): Lowercase<T> {\n return data.toLowerCase();\n}\n"],"mappings":"mCAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,YAAY,CAC1B"}
@@ -0,0 +1,2 @@
1
+ function e(e){return Object.assign(e,{single:!0})}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
2
+ //# sourceMappingURL=to-single-BOkjnmkm.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-single-BunGuk7o.cjs","names":[],"sources":["../src/internal/to-single.ts"],"sourcesContent":["import type { StrictFunction } from './types/strict-function';\n\ntype Single<Func> = Func & { readonly single: true };\n\nexport function toSingle<Func extends StrictFunction>(fn: Func): Single<Func> {\n return Object.assign(fn, { single: true as const });\n}\n"],"mappings":"AAIA,SAAgB,EAAsC,EAAwB,CAC5E,OAAO,OAAO,OAAO,EAAI,CAAE,OAAQ,GAAe,CAAC"}
1
+ {"version":3,"file":"to-single-BOkjnmkm.cjs","names":[],"sources":["../src/internal/to-single.ts"],"sourcesContent":["import type { StrictFunction } from './types/strict-function';\n\ntype Single<Func> = Func & { readonly single: true };\n\nexport function toSingle<Func extends StrictFunction>(fn: Func): Single<Func> {\n return Object.assign(fn, { single: true as const });\n}\n"],"mappings":"AAIA,SAAgB,EAAsC,EAAwB,CAC5E,OAAO,OAAO,OAAO,EAAI,CAAE,OAAQ,EAAc,CAAC,CACpD"}
@@ -1,2 +1,2 @@
1
1
  function e(e){return Object.assign(e,{single:!0})}export{e as t};
2
- //# sourceMappingURL=to-single-XEXXW73e.js.map
2
+ //# sourceMappingURL=to-single-D6t2BxVq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-single-XEXXW73e.js","names":[],"sources":["../src/internal/to-single.ts"],"sourcesContent":["import type { StrictFunction } from './types/strict-function';\n\ntype Single<Func> = Func & { readonly single: true };\n\nexport function toSingle<Func extends StrictFunction>(fn: Func): Single<Func> {\n return Object.assign(fn, { single: true as const });\n}\n"],"mappings":"AAIA,SAAgB,EAAsC,EAAwB,CAC5E,OAAO,OAAO,OAAO,EAAI,CAAE,OAAQ,GAAe,CAAC"}
1
+ {"version":3,"file":"to-single-D6t2BxVq.js","names":[],"sources":["../src/internal/to-single.ts"],"sourcesContent":["import type { StrictFunction } from './types/strict-function';\n\ntype Single<Func> = Func & { readonly single: true };\n\nexport function toSingle<Func extends StrictFunction>(fn: Func): Single<Func> {\n return Object.assign(fn, { single: true as const });\n}\n"],"mappings":"AAIA,SAAgB,EAAsC,EAAwB,CAC5E,OAAO,OAAO,OAAO,EAAI,CAAE,OAAQ,EAAc,CAAC,CACpD"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`),t=require(`./words-C8Rd_80F.cjs`);function n(...t){return e.curry(r,t)}function r(e){return t.t(e).join(`_`).toLowerCase()}exports.toSnakeCase=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs"),t=require("./words-B-9EXtsW.cjs");function n(...t){return e.curry(r,t)}function r(e){return t.t(e).join(`_`).toLowerCase()}exports.toSnakeCase=n;
2
2
  //# sourceMappingURL=to-snake-case.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-snake-case.cjs","names":["curry","words"],"sources":["../src/to-snake-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype SnakeCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '_'>>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toSnakeCase(data);\n * @example\n * toSnakeCase(\"hello world\"); // \"hello_world\"\n * toSnakeCase(\"__HELLO_WORLD__\"); // \"hello_world\"\n * @dataFirst\n * @category String\n */\nexport function toSnakeCase<S extends string>(data: S): SnakeCase<S>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @signature\n * toSnakeCase()(data);\n * @example\n * pipe(\"hello world\", toSnakeCase()); // \"hello_world\"\n * pipe(\"__HELLO_WORLD__\", toSnakeCase()); // \"hello_world\"\n * @dataLast\n * @category String\n */\nexport function toSnakeCase(): <S extends string>(data: S) => SnakeCase<S>;\n\nexport function toSnakeCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toSnakeCaseImplementation, args);\n}\n\nfunction toSnakeCaseImplementation<S extends string>(data: S): SnakeCase<S> {\n return words(data).join('_').toLowerCase();\n}\n"],"mappings":"oIA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAOC,EAAAA,EAAM,EAAK,CAAC,KAAK,IAAI,CAAC,aAAa"}
1
+ {"version":3,"file":"to-snake-case.cjs","names":["curry","words"],"sources":["../src/to-snake-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype SnakeCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '_'>>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toSnakeCase(data);\n * @example\n * toSnakeCase(\"hello world\"); // \"hello_world\"\n * toSnakeCase(\"__HELLO_WORLD__\"); // \"hello_world\"\n * @dataFirst\n * @category String\n */\nexport function toSnakeCase<S extends string>(data: S): SnakeCase<S>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @signature\n * toSnakeCase()(data);\n * @example\n * pipe(\"hello world\", toSnakeCase()); // \"hello_world\"\n * pipe(\"__HELLO_WORLD__\", toSnakeCase()); // \"hello_world\"\n * @dataLast\n * @category String\n */\nexport function toSnakeCase(): <S extends string>(data: S) => SnakeCase<S>;\n\nexport function toSnakeCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toSnakeCaseImplementation, args);\n}\n\nfunction toSnakeCaseImplementation<S extends string>(data: S): SnakeCase<S> {\n return words(data).join('_').toLowerCase();\n}\n"],"mappings":"oIA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAC1E,OAAOC,EAAAA,EAAM,CAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,YAAY,CAC3C"}
@@ -1,2 +1,2 @@
1
- import{curry as e}from"./curry.js";import{t}from"./words-CYZ0Lyko.js";function n(...t){return e(r,t)}function r(e){return t(e).join(`_`).toLowerCase()}export{n as toSnakeCase};
1
+ import{curry as e}from"./curry.js";import{t}from"./words-CN1Qil5U.js";function n(...t){return e(r,t)}function r(e){return t(e).join(`_`).toLowerCase()}export{n as toSnakeCase};
2
2
  //# sourceMappingURL=to-snake-case.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-snake-case.js","names":[],"sources":["../src/to-snake-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype SnakeCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '_'>>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toSnakeCase(data);\n * @example\n * toSnakeCase(\"hello world\"); // \"hello_world\"\n * toSnakeCase(\"__HELLO_WORLD__\"); // \"hello_world\"\n * @dataFirst\n * @category String\n */\nexport function toSnakeCase<S extends string>(data: S): SnakeCase<S>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @signature\n * toSnakeCase()(data);\n * @example\n * pipe(\"hello world\", toSnakeCase()); // \"hello_world\"\n * pipe(\"__HELLO_WORLD__\", toSnakeCase()); // \"hello_world\"\n * @dataLast\n * @category String\n */\nexport function toSnakeCase(): <S extends string>(data: S) => SnakeCase<S>;\n\nexport function toSnakeCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toSnakeCaseImplementation, args);\n}\n\nfunction toSnakeCaseImplementation<S extends string>(data: S): SnakeCase<S> {\n return words(data).join('_').toLowerCase();\n}\n"],"mappings":"sEA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAM,EAAK,CAAC,KAAK,IAAI,CAAC,aAAa"}
1
+ {"version":3,"file":"to-snake-case.js","names":[],"sources":["../src/to-snake-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype SnakeCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '_'>>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toSnakeCase(data);\n * @example\n * toSnakeCase(\"hello world\"); // \"hello_world\"\n * toSnakeCase(\"__HELLO_WORLD__\"); // \"hello_world\"\n * @dataFirst\n * @category String\n */\nexport function toSnakeCase<S extends string>(data: S): SnakeCase<S>;\n\n/**\n * Converts text to **snake_case** by splitting it into words and joining them\n * back together with underscores (`_`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toTitleCase`.\n *\n * For *CONSTANT_CASE* use `toUpperCase(toSnakeCase(data))`.\n *\n * @signature\n * toSnakeCase()(data);\n * @example\n * pipe(\"hello world\", toSnakeCase()); // \"hello_world\"\n * pipe(\"__HELLO_WORLD__\", toSnakeCase()); // \"hello_world\"\n * @dataLast\n * @category String\n */\nexport function toSnakeCase(): <S extends string>(data: S) => SnakeCase<S>;\n\nexport function toSnakeCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toSnakeCaseImplementation, args);\n}\n\nfunction toSnakeCaseImplementation<S extends string>(data: S): SnakeCase<S> {\n return words(data).join('_').toLowerCase();\n}\n"],"mappings":"sEA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAM,CAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,YAAY,CAC3C"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./words-C8Rd_80F.cjs`),t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e.t(t.test(n)?n:n.toLowerCase()).map(e=>`${e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(` `)}exports.toTitleCase=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./words-B-9EXtsW.cjs"),t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e.t(t.test(n)?n:n.toLowerCase()).map(e=>`${e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(` `)}exports.toTitleCase=n;
2
2
  //# sourceMappingURL=to-title-case.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-title-case.cjs","names":["words"],"sources":["../src/to-title-case.ts"],"sourcesContent":["import type { IsEqual, IsLiteral, Join, Words } from 'type-fest';\nimport type { OptionalOptionsWithDefaults } from './internal/types/optional-options-with-defaults';\nimport { words } from './internal/words';\n\nconst LOWER_CASE_CHARACTER_RE = /[a-z]/u;\n\nconst DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE = true;\n\ninterface TitleCaseOptions {\n readonly preserveConsecutiveUppercase?: boolean;\n}\n\ntype TitleCaseOptionsWithDefaults<Options extends TitleCaseOptions>\n = OptionalOptionsWithDefaults<\n TitleCaseOptions,\n Options,\n {\n // We use the runtime const for the default type so they stay coupled.\n preserveConsecutiveUppercase: typeof DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE;\n }\n >;\n\ntype TitleCase<S extends string, Options extends TitleCaseOptions>\n = IsLiteral<S> extends true\n ? Join<\n TitleCasedArray<\n Words<IsEqual<S, Uppercase<S>> extends true ? Lowercase<S> : S>,\n TitleCaseOptionsWithDefaults<Options>\n >,\n ' '\n >\n : string;\n\ntype TitleCasedArray<\n T extends ReadonlyArray<string>,\n Options extends TitleCaseOptions,\n> = {\n [I in keyof T]: Capitalize<\n Options['preserveConsecutiveUppercase'] extends true\n ? T[I]\n : Lowercase<T[I]>\n >;\n};\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param data - A string.\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase(data);\n * toTitleCase(data, { preserveConsecutiveUppercase });\n * @example\n * toTitleCase(\"hello world\"); // \"Hello World\"\n * toTitleCase(\"--foo-bar--\"); // \"Foo Bar\"\n * toTitleCase(\"fooBar\"); // \"Foo Bar\"\n * toTitleCase(\"__FOO_BAR__\"); // \"Foo Bar\"\n * toTitleCase(\"XMLHttpRequest\"); // \"XML Http Request\"\n * toTitleCase(\"XMLHttpRequest\", { preserveConsecutiveUppercase: false }); // \"Xml Http Request\"\n * @dataFirst\n * @category String\n */\nexport function toTitleCase<S extends string, Options extends TitleCaseOptions>(\n data: S,\n options?: Options,\n): TitleCase<S, Options>;\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase()(data);\n * toTitleCase({ preserveConsecutiveUppercase })(data);\n * @example\n * pipe(\"hello world\", toTitleCase()); // \"Hello World\"\n * pipe(\"--foo-bar--\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"fooBar\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"__FOO_BAR__\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"XMLHttpRequest\", toTitleCase()); // \"XML Http Request\"\n * pipe(\n * \"XMLHttpRequest\",\n * toTitleCase({ preserveConsecutiveUppercase: false }),\n * ); // \"Xml Http Request\"\n * @dataLast\n * @category String\n */\nexport function toTitleCase<Options extends TitleCaseOptions>(\n options?: Options,\n): <S extends string>(data: S) => TitleCase<S, Options>;\n\nexport function toTitleCase(\n dataOrOptions?: TitleCaseOptions | string,\n options?: TitleCaseOptions,\n): unknown {\n return typeof dataOrOptions === 'string'\n ? toTitleCaseImplementation(dataOrOptions, options)\n : (data: string) => toTitleCaseImplementation(data, dataOrOptions);\n}\n\n// Similar to the implementation used in toCamelCase\nfunction toTitleCaseImplementation(data: string, {\n preserveConsecutiveUppercase = DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE,\n}: TitleCaseOptions = {}): string {\n return words(\n LOWER_CASE_CHARACTER_RE.test(data)\n ? data\n : // If the text doesn't have **any** lowercase characters, we lowercase\n // everything; otherwise we maintain existing case as it affects word\n // boundaries.\n data.toLowerCase(),\n )\n .map(\n (word) =>\n `${word[0]!.toUpperCase()}${\n preserveConsecutiveUppercase\n ? word.slice(1)\n : word.slice(1).toLowerCase()\n }`,\n )\n .join(' ');\n}\n"],"mappings":"2GAIM,EAA0B,SAqHhC,SAAgB,EACd,EACA,EACS,CACT,OAAO,OAAO,GAAkB,SAC5B,EAA0B,EAAe,EAAQ,CAChD,GAAiB,EAA0B,EAAM,EAAc,CAItE,SAAS,EAA0B,EAAc,CAC/C,+BAA+B,IACX,EAAE,CAAU,CAChC,OAAOA,EAAAA,EACL,EAAwB,KAAK,EAAK,CAC9B,EAIA,EAAK,aAAa,CACvB,CACE,IACE,GACC,GAAG,EAAK,GAAI,aAAa,GACvB,EACI,EAAK,MAAM,EAAE,CACb,EAAK,MAAM,EAAE,CAAC,aAAa,GAEpC,CACA,KAAK,IAAI"}
1
+ {"version":3,"file":"to-title-case.cjs","names":["words"],"sources":["../src/to-title-case.ts"],"sourcesContent":["import type { IsEqual, IsLiteral, Join, Words } from 'type-fest';\nimport type { OptionalOptionsWithDefaults } from './internal/types/optional-options-with-defaults';\nimport { words } from './internal/words';\n\nconst LOWER_CASE_CHARACTER_RE = /[a-z]/u;\n\nconst DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE = true;\n\ninterface TitleCaseOptions {\n readonly preserveConsecutiveUppercase?: boolean;\n}\n\ntype TitleCaseOptionsWithDefaults<Options extends TitleCaseOptions>\n = OptionalOptionsWithDefaults<\n TitleCaseOptions,\n Options,\n {\n // We use the runtime const for the default type so they stay coupled.\n preserveConsecutiveUppercase: typeof DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE;\n }\n >;\n\ntype TitleCase<S extends string, Options extends TitleCaseOptions>\n = IsLiteral<S> extends true\n ? Join<\n TitleCasedArray<\n Words<IsEqual<S, Uppercase<S>> extends true ? Lowercase<S> : S>,\n TitleCaseOptionsWithDefaults<Options>\n >,\n ' '\n >\n : string;\n\ntype TitleCasedArray<\n T extends ReadonlyArray<string>,\n Options extends TitleCaseOptions,\n> = {\n [I in keyof T]: Capitalize<\n Options['preserveConsecutiveUppercase'] extends true\n ? T[I]\n : Lowercase<T[I]>\n >;\n};\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param data - A string.\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase(data);\n * toTitleCase(data, { preserveConsecutiveUppercase });\n * @example\n * toTitleCase(\"hello world\"); // \"Hello World\"\n * toTitleCase(\"--foo-bar--\"); // \"Foo Bar\"\n * toTitleCase(\"fooBar\"); // \"Foo Bar\"\n * toTitleCase(\"__FOO_BAR__\"); // \"Foo Bar\"\n * toTitleCase(\"XMLHttpRequest\"); // \"XML Http Request\"\n * toTitleCase(\"XMLHttpRequest\", { preserveConsecutiveUppercase: false }); // \"Xml Http Request\"\n * @dataFirst\n * @category String\n */\nexport function toTitleCase<S extends string, Options extends TitleCaseOptions>(\n data: S,\n options?: Options,\n): TitleCase<S, Options>;\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase()(data);\n * toTitleCase({ preserveConsecutiveUppercase })(data);\n * @example\n * pipe(\"hello world\", toTitleCase()); // \"Hello World\"\n * pipe(\"--foo-bar--\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"fooBar\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"__FOO_BAR__\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"XMLHttpRequest\", toTitleCase()); // \"XML Http Request\"\n * pipe(\n * \"XMLHttpRequest\",\n * toTitleCase({ preserveConsecutiveUppercase: false }),\n * ); // \"Xml Http Request\"\n * @dataLast\n * @category String\n */\nexport function toTitleCase<Options extends TitleCaseOptions>(\n options?: Options,\n): <S extends string>(data: S) => TitleCase<S, Options>;\n\nexport function toTitleCase(\n dataOrOptions?: TitleCaseOptions | string,\n options?: TitleCaseOptions,\n): unknown {\n return typeof dataOrOptions === 'string'\n ? toTitleCaseImplementation(dataOrOptions, options)\n : (data: string) => toTitleCaseImplementation(data, dataOrOptions);\n}\n\n// Similar to the implementation used in toCamelCase\nfunction toTitleCaseImplementation(data: string, {\n preserveConsecutiveUppercase = DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE,\n}: TitleCaseOptions = {}): string {\n return words(\n LOWER_CASE_CHARACTER_RE.test(data)\n ? data\n : // If the text doesn't have **any** lowercase characters, we lowercase\n // everything; otherwise we maintain existing case as it affects word\n // boundaries.\n data.toLowerCase(),\n )\n .map(\n (word) =>\n `${word[0]!.toUpperCase()}${\n preserveConsecutiveUppercase\n ? word.slice(1)\n : word.slice(1).toLowerCase()\n }`,\n )\n .join(' ');\n}\n"],"mappings":"2GAIM,EAA0B,SAqHhC,SAAgB,EACd,EACA,EACS,CACT,OAAO,OAAO,GAAkB,SAC5B,EAA0B,EAAe,CAAO,EAC/C,GAAiB,EAA0B,EAAM,CAAa,CACrE,CAGA,SAAS,EAA0B,EAAc,CAC/C,+BAA+B,IACX,CAAC,EAAW,CAChC,OAAOA,EAAAA,EACL,EAAwB,KAAK,CAAI,EAC7B,EAIA,EAAK,YAAY,CACvB,CAAC,CACE,IACE,GACC,GAAG,EAAK,EAAE,CAAE,YAAY,IACtB,EACI,EAAK,MAAM,CAAC,EACZ,EAAK,MAAM,CAAC,CAAC,CAAC,YAAY,GAEpC,CAAC,CACA,KAAK,GAAG,CACb"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./words-CYZ0Lyko.js";const t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e(t.test(n)?n:n.toLowerCase()).map(e=>`${e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(` `)}export{n as toTitleCase};
1
+ import{t as e}from"./words-CN1Qil5U.js";const t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e(t.test(n)?n:n.toLowerCase()).map(e=>`${e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(` `)}export{n as toTitleCase};
2
2
  //# sourceMappingURL=to-title-case.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-title-case.js","names":[],"sources":["../src/to-title-case.ts"],"sourcesContent":["import type { IsEqual, IsLiteral, Join, Words } from 'type-fest';\nimport type { OptionalOptionsWithDefaults } from './internal/types/optional-options-with-defaults';\nimport { words } from './internal/words';\n\nconst LOWER_CASE_CHARACTER_RE = /[a-z]/u;\n\nconst DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE = true;\n\ninterface TitleCaseOptions {\n readonly preserveConsecutiveUppercase?: boolean;\n}\n\ntype TitleCaseOptionsWithDefaults<Options extends TitleCaseOptions>\n = OptionalOptionsWithDefaults<\n TitleCaseOptions,\n Options,\n {\n // We use the runtime const for the default type so they stay coupled.\n preserveConsecutiveUppercase: typeof DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE;\n }\n >;\n\ntype TitleCase<S extends string, Options extends TitleCaseOptions>\n = IsLiteral<S> extends true\n ? Join<\n TitleCasedArray<\n Words<IsEqual<S, Uppercase<S>> extends true ? Lowercase<S> : S>,\n TitleCaseOptionsWithDefaults<Options>\n >,\n ' '\n >\n : string;\n\ntype TitleCasedArray<\n T extends ReadonlyArray<string>,\n Options extends TitleCaseOptions,\n> = {\n [I in keyof T]: Capitalize<\n Options['preserveConsecutiveUppercase'] extends true\n ? T[I]\n : Lowercase<T[I]>\n >;\n};\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param data - A string.\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase(data);\n * toTitleCase(data, { preserveConsecutiveUppercase });\n * @example\n * toTitleCase(\"hello world\"); // \"Hello World\"\n * toTitleCase(\"--foo-bar--\"); // \"Foo Bar\"\n * toTitleCase(\"fooBar\"); // \"Foo Bar\"\n * toTitleCase(\"__FOO_BAR__\"); // \"Foo Bar\"\n * toTitleCase(\"XMLHttpRequest\"); // \"XML Http Request\"\n * toTitleCase(\"XMLHttpRequest\", { preserveConsecutiveUppercase: false }); // \"Xml Http Request\"\n * @dataFirst\n * @category String\n */\nexport function toTitleCase<S extends string, Options extends TitleCaseOptions>(\n data: S,\n options?: Options,\n): TitleCase<S, Options>;\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase()(data);\n * toTitleCase({ preserveConsecutiveUppercase })(data);\n * @example\n * pipe(\"hello world\", toTitleCase()); // \"Hello World\"\n * pipe(\"--foo-bar--\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"fooBar\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"__FOO_BAR__\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"XMLHttpRequest\", toTitleCase()); // \"XML Http Request\"\n * pipe(\n * \"XMLHttpRequest\",\n * toTitleCase({ preserveConsecutiveUppercase: false }),\n * ); // \"Xml Http Request\"\n * @dataLast\n * @category String\n */\nexport function toTitleCase<Options extends TitleCaseOptions>(\n options?: Options,\n): <S extends string>(data: S) => TitleCase<S, Options>;\n\nexport function toTitleCase(\n dataOrOptions?: TitleCaseOptions | string,\n options?: TitleCaseOptions,\n): unknown {\n return typeof dataOrOptions === 'string'\n ? toTitleCaseImplementation(dataOrOptions, options)\n : (data: string) => toTitleCaseImplementation(data, dataOrOptions);\n}\n\n// Similar to the implementation used in toCamelCase\nfunction toTitleCaseImplementation(data: string, {\n preserveConsecutiveUppercase = DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE,\n}: TitleCaseOptions = {}): string {\n return words(\n LOWER_CASE_CHARACTER_RE.test(data)\n ? data\n : // If the text doesn't have **any** lowercase characters, we lowercase\n // everything; otherwise we maintain existing case as it affects word\n // boundaries.\n data.toLowerCase(),\n )\n .map(\n (word) =>\n `${word[0]!.toUpperCase()}${\n preserveConsecutiveUppercase\n ? word.slice(1)\n : word.slice(1).toLowerCase()\n }`,\n )\n .join(' ');\n}\n"],"mappings":"wCAIA,MAAM,EAA0B,SAqHhC,SAAgB,EACd,EACA,EACS,CACT,OAAO,OAAO,GAAkB,SAC5B,EAA0B,EAAe,EAAQ,CAChD,GAAiB,EAA0B,EAAM,EAAc,CAItE,SAAS,EAA0B,EAAc,CAC/C,+BAA+B,IACX,EAAE,CAAU,CAChC,OAAO,EACL,EAAwB,KAAK,EAAK,CAC9B,EAIA,EAAK,aAAa,CACvB,CACE,IACE,GACC,GAAG,EAAK,GAAI,aAAa,GACvB,EACI,EAAK,MAAM,EAAE,CACb,EAAK,MAAM,EAAE,CAAC,aAAa,GAEpC,CACA,KAAK,IAAI"}
1
+ {"version":3,"file":"to-title-case.js","names":[],"sources":["../src/to-title-case.ts"],"sourcesContent":["import type { IsEqual, IsLiteral, Join, Words } from 'type-fest';\nimport type { OptionalOptionsWithDefaults } from './internal/types/optional-options-with-defaults';\nimport { words } from './internal/words';\n\nconst LOWER_CASE_CHARACTER_RE = /[a-z]/u;\n\nconst DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE = true;\n\ninterface TitleCaseOptions {\n readonly preserveConsecutiveUppercase?: boolean;\n}\n\ntype TitleCaseOptionsWithDefaults<Options extends TitleCaseOptions>\n = OptionalOptionsWithDefaults<\n TitleCaseOptions,\n Options,\n {\n // We use the runtime const for the default type so they stay coupled.\n preserveConsecutiveUppercase: typeof DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE;\n }\n >;\n\ntype TitleCase<S extends string, Options extends TitleCaseOptions>\n = IsLiteral<S> extends true\n ? Join<\n TitleCasedArray<\n Words<IsEqual<S, Uppercase<S>> extends true ? Lowercase<S> : S>,\n TitleCaseOptionsWithDefaults<Options>\n >,\n ' '\n >\n : string;\n\ntype TitleCasedArray<\n T extends ReadonlyArray<string>,\n Options extends TitleCaseOptions,\n> = {\n [I in keyof T]: Capitalize<\n Options['preserveConsecutiveUppercase'] extends true\n ? T[I]\n : Lowercase<T[I]>\n >;\n};\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param data - A string.\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase(data);\n * toTitleCase(data, { preserveConsecutiveUppercase });\n * @example\n * toTitleCase(\"hello world\"); // \"Hello World\"\n * toTitleCase(\"--foo-bar--\"); // \"Foo Bar\"\n * toTitleCase(\"fooBar\"); // \"Foo Bar\"\n * toTitleCase(\"__FOO_BAR__\"); // \"Foo Bar\"\n * toTitleCase(\"XMLHttpRequest\"); // \"XML Http Request\"\n * toTitleCase(\"XMLHttpRequest\", { preserveConsecutiveUppercase: false }); // \"Xml Http Request\"\n * @dataFirst\n * @category String\n */\nexport function toTitleCase<S extends string, Options extends TitleCaseOptions>(\n data: S,\n options?: Options,\n): TitleCase<S, Options>;\n\n/**\n * Converts text to **Title Case** by splitting it into words, capitalizing the\n * first letter of each word, then joining them back together with spaces.\n *\n * Because it uses the built-in case conversion methods, the function shares\n * their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_,\n * making it best suited for simple strings like identifiers and internal keys.\n * For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters),\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * and [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase)\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, and `toSnakeCase`.\n *\n * @param options - An _optional_ object with the _optional_ property\n * `preserveConsecutiveUppercase` that can be used to change the way consecutive\n * uppercase characters are handled. Defaults to `true`.\n * @signature\n * toTitleCase()(data);\n * toTitleCase({ preserveConsecutiveUppercase })(data);\n * @example\n * pipe(\"hello world\", toTitleCase()); // \"Hello World\"\n * pipe(\"--foo-bar--\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"fooBar\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"__FOO_BAR__\", toTitleCase()); // \"Foo Bar\"\n * pipe(\"XMLHttpRequest\", toTitleCase()); // \"XML Http Request\"\n * pipe(\n * \"XMLHttpRequest\",\n * toTitleCase({ preserveConsecutiveUppercase: false }),\n * ); // \"Xml Http Request\"\n * @dataLast\n * @category String\n */\nexport function toTitleCase<Options extends TitleCaseOptions>(\n options?: Options,\n): <S extends string>(data: S) => TitleCase<S, Options>;\n\nexport function toTitleCase(\n dataOrOptions?: TitleCaseOptions | string,\n options?: TitleCaseOptions,\n): unknown {\n return typeof dataOrOptions === 'string'\n ? toTitleCaseImplementation(dataOrOptions, options)\n : (data: string) => toTitleCaseImplementation(data, dataOrOptions);\n}\n\n// Similar to the implementation used in toCamelCase\nfunction toTitleCaseImplementation(data: string, {\n preserveConsecutiveUppercase = DEFAULT_PRESERVE_CONSECUTIVE_UPPERCASE,\n}: TitleCaseOptions = {}): string {\n return words(\n LOWER_CASE_CHARACTER_RE.test(data)\n ? data\n : // If the text doesn't have **any** lowercase characters, we lowercase\n // everything; otherwise we maintain existing case as it affects word\n // boundaries.\n data.toLowerCase(),\n )\n .map(\n (word) =>\n `${word[0]!.toUpperCase()}${\n preserveConsecutiveUppercase\n ? word.slice(1)\n : word.slice(1).toLowerCase()\n }`,\n )\n .join(' ');\n}\n"],"mappings":"wCAIA,MAAM,EAA0B,SAqHhC,SAAgB,EACd,EACA,EACS,CACT,OAAO,OAAO,GAAkB,SAC5B,EAA0B,EAAe,CAAO,EAC/C,GAAiB,EAA0B,EAAM,CAAa,CACrE,CAGA,SAAS,EAA0B,EAAc,CAC/C,+BAA+B,IACX,CAAC,EAAW,CAChC,OAAO,EACL,EAAwB,KAAK,CAAI,EAC7B,EAIA,EAAK,YAAY,CACvB,CAAC,CACE,IACE,GACC,GAAG,EAAK,EAAE,CAAE,YAAY,IACtB,EACI,EAAK,MAAM,CAAC,EACZ,EAAK,MAAM,CAAC,CAAC,CAAC,YAAY,GAEpC,CAAC,CACA,KAAK,GAAG,CACb"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`);function t(...t){return e.curry(n,t)}function n(e){return e.toUpperCase()}exports.toUpperCase=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e){return e.toUpperCase()}exports.toUpperCase=t;
2
2
  //# sourceMappingURL=to-upper-case.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-upper-case.cjs","names":["curry"],"sources":["../src/to-upper-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toUpperCase(data);\n * @example\n * toUpperCase(\"Hello World\"); // \"HELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function toUpperCase<T extends string>(data: T): Uppercase<T>;\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toUpperCase()(data);\n * @example\n * pipe(\"Hello World\", toUpperCase()); // \"HELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function toUpperCase(): <T extends string>(data: T) => Uppercase<T>;\n\nexport function toUpperCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toUpperCaseImplementation, args);\n}\n\nfunction toUpperCaseImplementation<T extends string>(data: T): Uppercase<T> {\n return data.toUpperCase();\n}\n"],"mappings":"kGAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,aAAa"}
1
+ {"version":3,"file":"to-upper-case.cjs","names":["curry"],"sources":["../src/to-upper-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toUpperCase(data);\n * @example\n * toUpperCase(\"Hello World\"); // \"HELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function toUpperCase<T extends string>(data: T): Uppercase<T>;\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toUpperCase()(data);\n * @example\n * pipe(\"Hello World\", toUpperCase()); // \"HELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function toUpperCase(): <T extends string>(data: T) => Uppercase<T>;\n\nexport function toUpperCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toUpperCaseImplementation, args);\n}\n\nfunction toUpperCaseImplementation<T extends string>(data: T): Uppercase<T> {\n return data.toUpperCase();\n}\n"],"mappings":"kGAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,YAAY,CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"to-upper-case.js","names":[],"sources":["../src/to-upper-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toUpperCase(data);\n * @example\n * toUpperCase(\"Hello World\"); // \"HELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function toUpperCase<T extends string>(data: T): Uppercase<T>;\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toUpperCase()(data);\n * @example\n * pipe(\"Hello World\", toUpperCase()); // \"HELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function toUpperCase(): <T extends string>(data: T) => Uppercase<T>;\n\nexport function toUpperCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toUpperCaseImplementation, args);\n}\n\nfunction toUpperCaseImplementation<T extends string>(data: T): Uppercase<T> {\n return data.toUpperCase();\n}\n"],"mappings":"mCAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,aAAa"}
1
+ {"version":3,"file":"to-upper-case.js","names":[],"sources":["../src/to-upper-case.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * toUpperCase(data);\n * @example\n * toUpperCase(\"Hello World\"); // \"HELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function toUpperCase<T extends string>(data: T): Uppercase<T>;\n\n/**\n * Replaces all lowercase characters with their uppercase equivalents.\n *\n * This function is a wrapper around the built-in\n * [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * method and shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For a more linguistically accurate transformation use [`toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase),\n * and for display purposes use CSS [`text-transform: uppercase;`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform)\n * which *is* locale-aware.\n *\n * For other case manipulations see: `toLowerCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * toUpperCase()(data);\n * @example\n * pipe(\"Hello World\", toUpperCase()); // \"HELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function toUpperCase(): <T extends string>(data: T) => Uppercase<T>;\n\nexport function toUpperCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toUpperCaseImplementation, args);\n}\n\nfunction toUpperCaseImplementation<T extends string>(data: T): Uppercase<T> {\n return data.toUpperCase();\n}\n"],"mappings":"mCAmDA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,CAAI,CAC9C,CAEA,SAAS,EAA4C,EAAuB,CAC1E,OAAO,EAAK,YAAY,CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"truncate.cjs","names":[],"sources":["../src/truncate.ts"],"sourcesContent":["import type {\n And,\n IsEqual,\n IsNever,\n IsStringLiteral,\n NonNegativeInteger,\n} from 'type-fest';\nimport type { ClampedIntegerSubtract } from './internal/types/clamped-integer-subtract';\nimport type { StringLength } from './internal/types/string-length';\n\ninterface TruncateOptions {\n readonly omission?: string;\n readonly separator?: string | RegExp;\n}\n\nconst DEFAULT_OMISSION = '...';\n\ntype Truncate<\n S extends string,\n N extends number,\n Options extends TruncateOptions,\n>\n = IsNever<NonNegativeInteger<N>> extends true\n ? // There's nothing we can say about the output without a literal, valid,\n // truncation length `N`.\n string\n : IsStringLiteral<S> extends true\n ? TruncateWithOptions<\n S,\n N,\n // TODO: I don't like how I handled the default options object; I want to have everything coupled between the runtime and the type system, but this feels both brittle to changes, and over-verbose.\n Options extends Pick<Required<TruncateOptions>, 'omission'>\n ? Options['omission']\n : typeof DEFAULT_OMISSION,\n Options extends Pick<Required<TruncateOptions>, 'separator'>\n ? Options['separator']\n : undefined\n >\n : // There's nothing we can say about the output without a literal input\n // string `S`, the result would always be, at best, just a `string`.\n string;\n\ntype TruncateWithOptions<\n S extends string,\n N extends number,\n Omission extends string,\n Separator extends string | RegExp | undefined,\n>\n // Distribute the result over unions.\n = N extends unknown\n ? // We can short-circuit most of our logic when N is a literal 0.\n IsEqual<N, 0> extends true\n ? ''\n : // Distribute the result over unions.\n Omission extends unknown\n ? // When Omission isn't literal we don't know how long it is.\n IsStringLiteral<Omission> extends true\n ? // This mirrors the runtime logic where if `n - omission.length`\n // is not positive then what we end up truncating is Omission\n // itself and not S.\n IsEqual<\n ClampedIntegerSubtract<N, StringLength<Omission>>,\n 0\n > extends true\n ? TruncateLiterals<Omission, N, ''>\n : And<\n // When S isn't literal the output wouldn't be literal\n // either.\n IsStringLiteral<S>,\n // TODO: Handling non-trivial separators would add a ton of complexity to this type! It's possible (but hard!) to support string literals so I'm leaving this as a TODO; regular expressions are impossible because we can't get the type checker to run them.\n IsEqual<Separator, undefined>\n > extends true\n ? TruncateLiterals<S, N, Omission>\n : string\n : string\n : never\n : never;\n\n/**\n * This is the actual implementation of the truncation logic. It assumes all\n * its params are literals and valid.\n */\ntype TruncateLiterals<\n S extends string,\n N extends number,\n Omission extends string,\n Iteration extends ReadonlyArray<unknown> = [],\n> = S extends `${infer Character}${infer Rest}`\n ? // The cutoff point N - omission.length leaves room for the omission.\n Iteration['length'] extends ClampedIntegerSubtract<\n N,\n StringLength<Omission>\n >\n ? // The string is only truncated if its total length is longer than N; at\n // the cutoff point this is simplified to comparing the remaining suffix\n // length to the omission length.\n IsLongerThan<S, Omission> extends true\n ? Omission\n : S\n : // Reconstruct string character by character until cutoff.\n `${Character}${TruncateLiterals<Rest, N, Omission, [...Iteration, unknown]>}`\n : // Empty input string results in empty output.\n '';\n\n/**\n * An optimized check that efficiently checks if the string A is longer than B.\n */\ntype IsLongerThan<\n A extends string,\n B extends string,\n> = A extends `${string}${infer RestA}`\n ? B extends `${string}${infer RestB}`\n ? IsLongerThan<RestA, RestB>\n : // B is empty and A isn't!\n true\n : // A is empty, even if B is empty, A wouldn't be (strictly) longer.\n false;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param data - The input string.\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(data, n, { omission, separator });\n * @example\n * truncate(\"Hello, world!\", 8); //=> \"Hello...\"\n * truncate(\n * \"cat, dog, mouse\",\n * 12,\n * { omission: \"__\", separator: \",\"},\n * ); //=> \"cat, dog__\"\n * @dataFirst\n * @category String\n */\nexport function truncate<\n S extends string,\n N extends number,\n const Options extends TruncateOptions,\n>(data: S, n: N, options?: Options): Truncate<S, N, Options>;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(n, { omission, separator })(data);\n * @example\n * pipe(\"Hello, world!\" as const, truncate(8)); //=> \"Hello...\"\n * pipe(\n * \"cat, dog, mouse\" as const,\n * truncate(12, { omission: \"__\", separator: \",\"}),\n * ); //=> \"cat, dog__\"\n * @dataLast\n * @category String\n */\nexport function truncate<\n N extends number,\n const Options extends TruncateOptions,\n>(\n n: N,\n options?: Options,\n): <S extends string>(data: S) => Truncate<S, N, Options>;\n\nexport function truncate(\n dataOrN: string | number,\n nOrOptions?: number | TruncateOptions,\n options?: TruncateOptions,\n): unknown {\n return typeof dataOrN === 'string'\n ? truncateImplementation(\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n options,\n )\n : (data: string) =>\n truncateImplementation(\n data,\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n );\n}\n\nfunction truncateImplementation(\n data: string,\n n: number,\n { omission = DEFAULT_OMISSION, separator }: TruncateOptions = {},\n): string {\n if (data.length <= n) {\n // No truncation needed.\n return data;\n }\n\n if (n <= 0) {\n // Avoid weirdness when n isn't positive.\n return '';\n }\n\n if (n < omission.length) {\n // TODO [>3]: This was an oversight, there's no value in returning just parts of the omission string itself, with no actual content. Instead, we should truncate the input without adding the omission at all in cases where the omission would completely eclipse the content.\n // Handle cases where the omission itself is too long.\n return omission.slice(0, n);\n }\n\n // Our trivial cutoff is the point where we can add the omission and reach\n // n exactly, this is what we'll use when no separator is provided.\n let cutoff = n - omission.length;\n\n if (typeof separator === 'string') {\n const lastSeparator = data.lastIndexOf(separator, cutoff);\n if (lastSeparator !== -1) {\n // If we find the separator within the part of the string that would be\n // returned we move the cutoff further so that we also remove it.\n cutoff = lastSeparator;\n }\n } else if (separator !== undefined) {\n const globalSeparator = separator.flags.includes('g')\n ? separator\n : new RegExp(separator.source, `${separator.flags}g`);\n\n let lastSeparator;\n for (const { index } of data.matchAll(globalSeparator)) {\n if (index > cutoff) {\n // We only care about separators within the part of the string that\n // would be returned anyway, once we are past that point we don't care\n // about any further separators.\n break;\n }\n lastSeparator = index;\n }\n if (lastSeparator !== undefined) {\n cutoff = lastSeparator;\n }\n }\n\n // Build the output.\n return `${data.slice(0, cutoff)}${omission}`;\n}\n"],"mappings":"mEAwNA,SAAgB,EACd,EACA,EACA,EACS,CACT,OAAO,OAAO,GAAY,SACtB,EACE,EAIA,EACA,EACD,CACA,GACC,EACE,EACA,EAIA,EACD,CAGT,SAAS,EACP,EACA,EACA,CAAE,WAAW,MAAkB,aAA+B,EAAE,CACxD,CACR,GAAI,EAAK,QAAU,EAEjB,OAAO,EAGT,GAAI,GAAK,EAEP,MAAO,GAGT,GAAI,EAAI,EAAS,OAGf,OAAO,EAAS,MAAM,EAAG,EAAE,CAK7B,IAAI,EAAS,EAAI,EAAS,OAE1B,GAAI,OAAO,GAAc,SAAU,CACjC,IAAM,EAAgB,EAAK,YAAY,EAAW,EAAO,CACrD,IAAkB,KAGpB,EAAS,WAEF,IAAc,IAAA,GAAW,CAClC,IAAM,EAAkB,EAAU,MAAM,SAAS,IAAI,CACjD,EACA,IAAI,OAAO,EAAU,OAAQ,GAAG,EAAU,MAAM,GAAG,CAEnD,EACJ,IAAK,GAAM,CAAE,WAAW,EAAK,SAAS,EAAgB,CAAE,CACtD,GAAI,EAAQ,EAIV,MAEF,EAAgB,EAEd,IAAkB,IAAA,KACpB,EAAS,GAKb,MAAO,GAAG,EAAK,MAAM,EAAG,EAAO,GAAG"}
1
+ {"version":3,"file":"truncate.cjs","names":[],"sources":["../src/truncate.ts"],"sourcesContent":["import type { IsNever, IsStringLiteral, NonNegativeInteger } from 'type-fest';\nimport type { ClampedIntegerSubtract } from './internal/types/clamped-integer-subtract';\nimport type { StringLength } from './internal/types/string-length';\n\ninterface TruncateOptions {\n readonly omission?: string;\n readonly separator?: string | RegExp;\n}\n\nconst DEFAULT_OMISSION = '...';\n\ntype Truncate<\n S extends string,\n N extends number,\n Options extends TruncateOptions,\n>\n = IsNever<NonNegativeInteger<N>> extends true\n ? // There's nothing we can say about the output without a literal, valid,\n // truncation length `N`.\n string\n : IsStringLiteral<S> extends true\n ? TruncateWithOptions<\n S,\n N,\n // TODO: I don't like how I handled the default options object; I want to have everything coupled between the runtime and the type system, but this feels both brittle to changes, and over-verbose.\n Options extends Pick<Required<TruncateOptions>, 'omission'>\n ? Options['omission']\n : typeof DEFAULT_OMISSION,\n Options extends Pick<Required<TruncateOptions>, 'separator'>\n ? Options['separator']\n : undefined\n >\n : // There's nothing we can say about the output without a literal input\n // string `S`, the result would always be, at best, just a `string`.\n string;\n\ntype TruncateWithOptions<\n S extends string,\n N extends number,\n Omission extends string,\n Separator extends string | RegExp | undefined,\n>\n // Distribute the result over unions.\n = N extends unknown\n ? // We can short-circuit most of our logic when N is a literal 0.\n [N] extends [0]\n ? ''\n : // Distribute the result over unions.\n Omission extends unknown\n ? // When Omission isn't literal we don't know how long it is.\n IsStringLiteral<Omission> extends true\n ? // This mirrors the runtime logic where if `n - omission.length`\n // is not positive then what we end up truncating is Omission\n // itself and not S.\n [ClampedIntegerSubtract<N, StringLength<Omission>>] extends [0]\n ? TruncateLiterals<Omission, N, ''>\n : // When S isn't literal the output wouldn't be literal either.\n IsStringLiteral<S> extends true\n ? // TODO: Handling non-trivial separators would add a ton of complexity to this type! It's possible (but hard!) to support string literals so I'm leaving this as a TODO; regular expressions are impossible because we can't get the type checker to run them.\n [Separator] extends [undefined]\n ? TruncateLiterals<S, N, Omission>\n : string\n : string\n : string\n : never\n : never;\n\n/**\n * This is the actual implementation of the truncation logic. It assumes all\n * its params are literals and valid.\n */\ntype TruncateLiterals<\n S extends string,\n N extends number,\n Omission extends string,\n Iteration extends ReadonlyArray<unknown> = [],\n> = S extends `${infer Character}${infer Rest}`\n ? // The cutoff point N - omission.length leaves room for the omission.\n Iteration['length'] extends ClampedIntegerSubtract<\n N,\n StringLength<Omission>\n >\n ? // The string is only truncated if its total length is longer than N; at\n // the cutoff point this is simplified to comparing the remaining suffix\n // length to the omission length.\n IsLongerThan<S, Omission> extends true\n ? Omission\n : S\n : // Reconstruct string character by character until cutoff.\n `${Character}${TruncateLiterals<Rest, N, Omission, [...Iteration, unknown]>}`\n : // Empty input string results in empty output.\n '';\n\n/**\n * An optimized check that efficiently checks if the string A is longer than B.\n */\ntype IsLongerThan<\n A extends string,\n B extends string,\n> = A extends `${string}${infer RestA}`\n ? B extends `${string}${infer RestB}`\n ? IsLongerThan<RestA, RestB>\n : // B is empty and A isn't!\n true\n : // A is empty, even if B is empty, A wouldn't be (strictly) longer.\n false;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param data - The input string.\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(data, n, { omission, separator });\n * @example\n * truncate(\"Hello, world!\", 8); //=> \"Hello...\"\n * truncate(\n * \"cat, dog, mouse\",\n * 12,\n * { omission: \"__\", separator: \",\"},\n * ); //=> \"cat, dog__\"\n * @dataFirst\n * @category String\n */\nexport function truncate<\n S extends string,\n N extends number,\n const Options extends TruncateOptions,\n>(data: S, n: N, options?: Options): Truncate<S, N, Options>;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(n, { omission, separator })(data);\n * @example\n * pipe(\"Hello, world!\" as const, truncate(8)); //=> \"Hello...\"\n * pipe(\n * \"cat, dog, mouse\" as const,\n * truncate(12, { omission: \"__\", separator: \",\"}),\n * ); //=> \"cat, dog__\"\n * @dataLast\n * @category String\n */\nexport function truncate<\n N extends number,\n const Options extends TruncateOptions,\n>(\n n: N,\n options?: Options,\n): <S extends string>(data: S) => Truncate<S, N, Options>;\n\nexport function truncate(\n dataOrN: string | number,\n nOrOptions?: number | TruncateOptions,\n options?: TruncateOptions,\n): unknown {\n return typeof dataOrN === 'string'\n ? truncateImplementation(\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n options,\n )\n : (data: string) =>\n truncateImplementation(\n data,\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n );\n}\n\nfunction truncateImplementation(\n data: string,\n n: number,\n { omission = DEFAULT_OMISSION, separator }: TruncateOptions = {},\n): string {\n if (data.length <= n) {\n // No truncation needed.\n return data;\n }\n\n if (n <= 0) {\n // Avoid weirdness when n isn't positive.\n return '';\n }\n\n if (n < omission.length) {\n // TODO [>3]: This was an oversight, there's no value in returning just parts of the omission string itself, with no actual content. Instead, we should truncate the input without adding the omission at all in cases where the omission would completely eclipse the content.\n // Handle cases where the omission itself is too long.\n return omission.slice(0, n);\n }\n\n // Our trivial cutoff is the point where we can add the omission and reach\n // n exactly, this is what we'll use when no separator is provided.\n let cutoff = n - omission.length;\n\n if (typeof separator === 'string') {\n const lastSeparator = data.lastIndexOf(separator, cutoff);\n if (lastSeparator !== -1) {\n // If we find the separator within the part of the string that would be\n // returned we move the cutoff further so that we also remove it.\n cutoff = lastSeparator;\n }\n } else if (separator !== undefined) {\n const globalSeparator = separator.flags.includes('g')\n ? separator\n : new RegExp(separator.source, `${separator.flags}g`);\n\n let lastSeparator;\n for (const { index } of data.matchAll(globalSeparator)) {\n if (index > cutoff) {\n // We only care about separators within the part of the string that\n // would be returned anyway, once we are past that point we don't care\n // about any further separators.\n break;\n }\n lastSeparator = index;\n }\n if (lastSeparator !== undefined) {\n cutoff = lastSeparator;\n }\n }\n\n // Build the output.\n return `${data.slice(0, cutoff)}${omission}`;\n}\n"],"mappings":"mEA6MA,SAAgB,EACd,EACA,EACA,EACS,CACT,OAAO,OAAO,GAAY,SACtB,EACE,EAIA,EACA,CACF,EACC,GACC,EACE,EACA,EAIA,CACF,CACR,CAEA,SAAS,EACP,EACA,EACA,CAAE,WAAW,MAAkB,aAA+B,CAAC,EACvD,CACR,GAAI,EAAK,QAAU,EAEjB,OAAO,EAGT,GAAI,GAAK,EAEP,MAAO,GAGT,GAAI,EAAI,EAAS,OAGf,OAAO,EAAS,MAAM,EAAG,CAAC,EAK5B,IAAI,EAAS,EAAI,EAAS,OAE1B,GAAI,OAAO,GAAc,SAAU,CACjC,IAAM,EAAgB,EAAK,YAAY,EAAW,CAAM,EACpD,IAAkB,KAGpB,EAAS,EAEb,MAAO,GAAI,IAAc,IAAA,GAAW,CAClC,IAAM,EAAkB,EAAU,MAAM,SAAS,GAAG,EAChD,EACA,IAAI,OAAO,EAAU,OAAQ,GAAG,EAAU,MAAM,EAAE,EAElD,EACJ,IAAK,GAAM,CAAE,WAAW,EAAK,SAAS,CAAe,EAAG,CACtD,GAAI,EAAQ,EAIV,MAEF,EAAgB,CAClB,CACI,IAAkB,IAAA,KACpB,EAAS,EAEb,CAGA,MAAO,GAAG,EAAK,MAAM,EAAG,CAAM,IAAI,GACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"truncate.js","names":[],"sources":["../src/truncate.ts"],"sourcesContent":["import type {\n And,\n IsEqual,\n IsNever,\n IsStringLiteral,\n NonNegativeInteger,\n} from 'type-fest';\nimport type { ClampedIntegerSubtract } from './internal/types/clamped-integer-subtract';\nimport type { StringLength } from './internal/types/string-length';\n\ninterface TruncateOptions {\n readonly omission?: string;\n readonly separator?: string | RegExp;\n}\n\nconst DEFAULT_OMISSION = '...';\n\ntype Truncate<\n S extends string,\n N extends number,\n Options extends TruncateOptions,\n>\n = IsNever<NonNegativeInteger<N>> extends true\n ? // There's nothing we can say about the output without a literal, valid,\n // truncation length `N`.\n string\n : IsStringLiteral<S> extends true\n ? TruncateWithOptions<\n S,\n N,\n // TODO: I don't like how I handled the default options object; I want to have everything coupled between the runtime and the type system, but this feels both brittle to changes, and over-verbose.\n Options extends Pick<Required<TruncateOptions>, 'omission'>\n ? Options['omission']\n : typeof DEFAULT_OMISSION,\n Options extends Pick<Required<TruncateOptions>, 'separator'>\n ? Options['separator']\n : undefined\n >\n : // There's nothing we can say about the output without a literal input\n // string `S`, the result would always be, at best, just a `string`.\n string;\n\ntype TruncateWithOptions<\n S extends string,\n N extends number,\n Omission extends string,\n Separator extends string | RegExp | undefined,\n>\n // Distribute the result over unions.\n = N extends unknown\n ? // We can short-circuit most of our logic when N is a literal 0.\n IsEqual<N, 0> extends true\n ? ''\n : // Distribute the result over unions.\n Omission extends unknown\n ? // When Omission isn't literal we don't know how long it is.\n IsStringLiteral<Omission> extends true\n ? // This mirrors the runtime logic where if `n - omission.length`\n // is not positive then what we end up truncating is Omission\n // itself and not S.\n IsEqual<\n ClampedIntegerSubtract<N, StringLength<Omission>>,\n 0\n > extends true\n ? TruncateLiterals<Omission, N, ''>\n : And<\n // When S isn't literal the output wouldn't be literal\n // either.\n IsStringLiteral<S>,\n // TODO: Handling non-trivial separators would add a ton of complexity to this type! It's possible (but hard!) to support string literals so I'm leaving this as a TODO; regular expressions are impossible because we can't get the type checker to run them.\n IsEqual<Separator, undefined>\n > extends true\n ? TruncateLiterals<S, N, Omission>\n : string\n : string\n : never\n : never;\n\n/**\n * This is the actual implementation of the truncation logic. It assumes all\n * its params are literals and valid.\n */\ntype TruncateLiterals<\n S extends string,\n N extends number,\n Omission extends string,\n Iteration extends ReadonlyArray<unknown> = [],\n> = S extends `${infer Character}${infer Rest}`\n ? // The cutoff point N - omission.length leaves room for the omission.\n Iteration['length'] extends ClampedIntegerSubtract<\n N,\n StringLength<Omission>\n >\n ? // The string is only truncated if its total length is longer than N; at\n // the cutoff point this is simplified to comparing the remaining suffix\n // length to the omission length.\n IsLongerThan<S, Omission> extends true\n ? Omission\n : S\n : // Reconstruct string character by character until cutoff.\n `${Character}${TruncateLiterals<Rest, N, Omission, [...Iteration, unknown]>}`\n : // Empty input string results in empty output.\n '';\n\n/**\n * An optimized check that efficiently checks if the string A is longer than B.\n */\ntype IsLongerThan<\n A extends string,\n B extends string,\n> = A extends `${string}${infer RestA}`\n ? B extends `${string}${infer RestB}`\n ? IsLongerThan<RestA, RestB>\n : // B is empty and A isn't!\n true\n : // A is empty, even if B is empty, A wouldn't be (strictly) longer.\n false;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param data - The input string.\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(data, n, { omission, separator });\n * @example\n * truncate(\"Hello, world!\", 8); //=> \"Hello...\"\n * truncate(\n * \"cat, dog, mouse\",\n * 12,\n * { omission: \"__\", separator: \",\"},\n * ); //=> \"cat, dog__\"\n * @dataFirst\n * @category String\n */\nexport function truncate<\n S extends string,\n N extends number,\n const Options extends TruncateOptions,\n>(data: S, n: N, options?: Options): Truncate<S, N, Options>;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(n, { omission, separator })(data);\n * @example\n * pipe(\"Hello, world!\" as const, truncate(8)); //=> \"Hello...\"\n * pipe(\n * \"cat, dog, mouse\" as const,\n * truncate(12, { omission: \"__\", separator: \",\"}),\n * ); //=> \"cat, dog__\"\n * @dataLast\n * @category String\n */\nexport function truncate<\n N extends number,\n const Options extends TruncateOptions,\n>(\n n: N,\n options?: Options,\n): <S extends string>(data: S) => Truncate<S, N, Options>;\n\nexport function truncate(\n dataOrN: string | number,\n nOrOptions?: number | TruncateOptions,\n options?: TruncateOptions,\n): unknown {\n return typeof dataOrN === 'string'\n ? truncateImplementation(\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n options,\n )\n : (data: string) =>\n truncateImplementation(\n data,\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n );\n}\n\nfunction truncateImplementation(\n data: string,\n n: number,\n { omission = DEFAULT_OMISSION, separator }: TruncateOptions = {},\n): string {\n if (data.length <= n) {\n // No truncation needed.\n return data;\n }\n\n if (n <= 0) {\n // Avoid weirdness when n isn't positive.\n return '';\n }\n\n if (n < omission.length) {\n // TODO [>3]: This was an oversight, there's no value in returning just parts of the omission string itself, with no actual content. Instead, we should truncate the input without adding the omission at all in cases where the omission would completely eclipse the content.\n // Handle cases where the omission itself is too long.\n return omission.slice(0, n);\n }\n\n // Our trivial cutoff is the point where we can add the omission and reach\n // n exactly, this is what we'll use when no separator is provided.\n let cutoff = n - omission.length;\n\n if (typeof separator === 'string') {\n const lastSeparator = data.lastIndexOf(separator, cutoff);\n if (lastSeparator !== -1) {\n // If we find the separator within the part of the string that would be\n // returned we move the cutoff further so that we also remove it.\n cutoff = lastSeparator;\n }\n } else if (separator !== undefined) {\n const globalSeparator = separator.flags.includes('g')\n ? separator\n : new RegExp(separator.source, `${separator.flags}g`);\n\n let lastSeparator;\n for (const { index } of data.matchAll(globalSeparator)) {\n if (index > cutoff) {\n // We only care about separators within the part of the string that\n // would be returned anyway, once we are past that point we don't care\n // about any further separators.\n break;\n }\n lastSeparator = index;\n }\n if (lastSeparator !== undefined) {\n cutoff = lastSeparator;\n }\n }\n\n // Build the output.\n return `${data.slice(0, cutoff)}${omission}`;\n}\n"],"mappings":"AAwNA,SAAgB,EACd,EACA,EACA,EACS,CACT,OAAO,OAAO,GAAY,SACtB,EACE,EAIA,EACA,EACD,CACA,GACC,EACE,EACA,EAIA,EACD,CAGT,SAAS,EACP,EACA,EACA,CAAE,WAAW,MAAkB,aAA+B,EAAE,CACxD,CACR,GAAI,EAAK,QAAU,EAEjB,OAAO,EAGT,GAAI,GAAK,EAEP,MAAO,GAGT,GAAI,EAAI,EAAS,OAGf,OAAO,EAAS,MAAM,EAAG,EAAE,CAK7B,IAAI,EAAS,EAAI,EAAS,OAE1B,GAAI,OAAO,GAAc,SAAU,CACjC,IAAM,EAAgB,EAAK,YAAY,EAAW,EAAO,CACrD,IAAkB,KAGpB,EAAS,WAEF,IAAc,IAAA,GAAW,CAClC,IAAM,EAAkB,EAAU,MAAM,SAAS,IAAI,CACjD,EACA,IAAI,OAAO,EAAU,OAAQ,GAAG,EAAU,MAAM,GAAG,CAEnD,EACJ,IAAK,GAAM,CAAE,WAAW,EAAK,SAAS,EAAgB,CAAE,CACtD,GAAI,EAAQ,EAIV,MAEF,EAAgB,EAEd,IAAkB,IAAA,KACpB,EAAS,GAKb,MAAO,GAAG,EAAK,MAAM,EAAG,EAAO,GAAG"}
1
+ {"version":3,"file":"truncate.js","names":[],"sources":["../src/truncate.ts"],"sourcesContent":["import type { IsNever, IsStringLiteral, NonNegativeInteger } from 'type-fest';\nimport type { ClampedIntegerSubtract } from './internal/types/clamped-integer-subtract';\nimport type { StringLength } from './internal/types/string-length';\n\ninterface TruncateOptions {\n readonly omission?: string;\n readonly separator?: string | RegExp;\n}\n\nconst DEFAULT_OMISSION = '...';\n\ntype Truncate<\n S extends string,\n N extends number,\n Options extends TruncateOptions,\n>\n = IsNever<NonNegativeInteger<N>> extends true\n ? // There's nothing we can say about the output without a literal, valid,\n // truncation length `N`.\n string\n : IsStringLiteral<S> extends true\n ? TruncateWithOptions<\n S,\n N,\n // TODO: I don't like how I handled the default options object; I want to have everything coupled between the runtime and the type system, but this feels both brittle to changes, and over-verbose.\n Options extends Pick<Required<TruncateOptions>, 'omission'>\n ? Options['omission']\n : typeof DEFAULT_OMISSION,\n Options extends Pick<Required<TruncateOptions>, 'separator'>\n ? Options['separator']\n : undefined\n >\n : // There's nothing we can say about the output without a literal input\n // string `S`, the result would always be, at best, just a `string`.\n string;\n\ntype TruncateWithOptions<\n S extends string,\n N extends number,\n Omission extends string,\n Separator extends string | RegExp | undefined,\n>\n // Distribute the result over unions.\n = N extends unknown\n ? // We can short-circuit most of our logic when N is a literal 0.\n [N] extends [0]\n ? ''\n : // Distribute the result over unions.\n Omission extends unknown\n ? // When Omission isn't literal we don't know how long it is.\n IsStringLiteral<Omission> extends true\n ? // This mirrors the runtime logic where if `n - omission.length`\n // is not positive then what we end up truncating is Omission\n // itself and not S.\n [ClampedIntegerSubtract<N, StringLength<Omission>>] extends [0]\n ? TruncateLiterals<Omission, N, ''>\n : // When S isn't literal the output wouldn't be literal either.\n IsStringLiteral<S> extends true\n ? // TODO: Handling non-trivial separators would add a ton of complexity to this type! It's possible (but hard!) to support string literals so I'm leaving this as a TODO; regular expressions are impossible because we can't get the type checker to run them.\n [Separator] extends [undefined]\n ? TruncateLiterals<S, N, Omission>\n : string\n : string\n : string\n : never\n : never;\n\n/**\n * This is the actual implementation of the truncation logic. It assumes all\n * its params are literals and valid.\n */\ntype TruncateLiterals<\n S extends string,\n N extends number,\n Omission extends string,\n Iteration extends ReadonlyArray<unknown> = [],\n> = S extends `${infer Character}${infer Rest}`\n ? // The cutoff point N - omission.length leaves room for the omission.\n Iteration['length'] extends ClampedIntegerSubtract<\n N,\n StringLength<Omission>\n >\n ? // The string is only truncated if its total length is longer than N; at\n // the cutoff point this is simplified to comparing the remaining suffix\n // length to the omission length.\n IsLongerThan<S, Omission> extends true\n ? Omission\n : S\n : // Reconstruct string character by character until cutoff.\n `${Character}${TruncateLiterals<Rest, N, Omission, [...Iteration, unknown]>}`\n : // Empty input string results in empty output.\n '';\n\n/**\n * An optimized check that efficiently checks if the string A is longer than B.\n */\ntype IsLongerThan<\n A extends string,\n B extends string,\n> = A extends `${string}${infer RestA}`\n ? B extends `${string}${infer RestB}`\n ? IsLongerThan<RestA, RestB>\n : // B is empty and A isn't!\n true\n : // A is empty, even if B is empty, A wouldn't be (strictly) longer.\n false;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param data - The input string.\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(data, n, { omission, separator });\n * @example\n * truncate(\"Hello, world!\", 8); //=> \"Hello...\"\n * truncate(\n * \"cat, dog, mouse\",\n * 12,\n * { omission: \"__\", separator: \",\"},\n * ); //=> \"cat, dog__\"\n * @dataFirst\n * @category String\n */\nexport function truncate<\n S extends string,\n N extends number,\n const Options extends TruncateOptions,\n>(data: S, n: N, options?: Options): Truncate<S, N, Options>;\n\n/**\n * Truncates strings to a maximum length, adding an ellipsis when truncated.\n *\n * Shorter strings are returned unchanged. If the omission marker is longer than\n * the maximum length, it will be truncated as well.\n *\n * The `separator` argument provides more control by optimistically searching\n * for a matching cutoff point, which could be used to avoid truncating in the\n * middle of a word or other semantic boundary.\n *\n * If you just need to limit the total length of the string, without adding an\n * `omission` or optimizing the cutoff point via `separator`, prefer\n * `sliceString` instead, which runs more efficiently.\n *\n * The function counts Unicode characters, not visual graphemes, and may split\n * emojis, denormalized diacritics, or combining characters, in the middle. For\n * display purposes, prefer CSS [`text-overflow: ellipsis`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis)\n * which is locale-aware and purpose-built for this task.\n *\n * @param n - The maximum length of the output string. The output will **never**\n * exceed this length.\n * @param options - An optional options object.\n * @param options.omission - The string that is appended to the end of the\n * output *whenever the input string is truncated*. Default: '...'.\n * @param options.separator - A string or regular expression that defines a\n * cutoff point for the truncation. If multiple cutoff points are found, the one\n * closest to `n` will be used, and if no cutoff point is found then the\n * function will fallback to the trivial cutoff point. Regular expressions are\n * also supported. Default: <none> (which is equivalent to `\"\"` or the regular\n * expression `/./`).\n * @signature\n * truncate(n, { omission, separator })(data);\n * @example\n * pipe(\"Hello, world!\" as const, truncate(8)); //=> \"Hello...\"\n * pipe(\n * \"cat, dog, mouse\" as const,\n * truncate(12, { omission: \"__\", separator: \",\"}),\n * ); //=> \"cat, dog__\"\n * @dataLast\n * @category String\n */\nexport function truncate<\n N extends number,\n const Options extends TruncateOptions,\n>(\n n: N,\n options?: Options,\n): <S extends string>(data: S) => Truncate<S, N, Options>;\n\nexport function truncate(\n dataOrN: string | number,\n nOrOptions?: number | TruncateOptions,\n options?: TruncateOptions,\n): unknown {\n return typeof dataOrN === 'string'\n ? truncateImplementation(\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n options,\n )\n : (data: string) =>\n truncateImplementation(\n data,\n dataOrN,\n // @ts-expect-error [ts2345] -- We want to reduce runtime checks to a\n // minimum, and there's no (easy) way to couple params so that when we\n // check one, the others are inferred accordingly.\n nOrOptions,\n );\n}\n\nfunction truncateImplementation(\n data: string,\n n: number,\n { omission = DEFAULT_OMISSION, separator }: TruncateOptions = {},\n): string {\n if (data.length <= n) {\n // No truncation needed.\n return data;\n }\n\n if (n <= 0) {\n // Avoid weirdness when n isn't positive.\n return '';\n }\n\n if (n < omission.length) {\n // TODO [>3]: This was an oversight, there's no value in returning just parts of the omission string itself, with no actual content. Instead, we should truncate the input without adding the omission at all in cases where the omission would completely eclipse the content.\n // Handle cases where the omission itself is too long.\n return omission.slice(0, n);\n }\n\n // Our trivial cutoff is the point where we can add the omission and reach\n // n exactly, this is what we'll use when no separator is provided.\n let cutoff = n - omission.length;\n\n if (typeof separator === 'string') {\n const lastSeparator = data.lastIndexOf(separator, cutoff);\n if (lastSeparator !== -1) {\n // If we find the separator within the part of the string that would be\n // returned we move the cutoff further so that we also remove it.\n cutoff = lastSeparator;\n }\n } else if (separator !== undefined) {\n const globalSeparator = separator.flags.includes('g')\n ? separator\n : new RegExp(separator.source, `${separator.flags}g`);\n\n let lastSeparator;\n for (const { index } of data.matchAll(globalSeparator)) {\n if (index > cutoff) {\n // We only care about separators within the part of the string that\n // would be returned anyway, once we are past that point we don't care\n // about any further separators.\n break;\n }\n lastSeparator = index;\n }\n if (lastSeparator !== undefined) {\n cutoff = lastSeparator;\n }\n }\n\n // Build the output.\n return `${data.slice(0, cutoff)}${omission}`;\n}\n"],"mappings":"AA6MA,SAAgB,EACd,EACA,EACA,EACS,CACT,OAAO,OAAO,GAAY,SACtB,EACE,EAIA,EACA,CACF,EACC,GACC,EACE,EACA,EAIA,CACF,CACR,CAEA,SAAS,EACP,EACA,EACA,CAAE,WAAW,MAAkB,aAA+B,CAAC,EACvD,CACR,GAAI,EAAK,QAAU,EAEjB,OAAO,EAGT,GAAI,GAAK,EAEP,MAAO,GAGT,GAAI,EAAI,EAAS,OAGf,OAAO,EAAS,MAAM,EAAG,CAAC,EAK5B,IAAI,EAAS,EAAI,EAAS,OAE1B,GAAI,OAAO,GAAc,SAAU,CACjC,IAAM,EAAgB,EAAK,YAAY,EAAW,CAAM,EACpD,IAAkB,KAGpB,EAAS,EAEb,MAAO,GAAI,IAAc,IAAA,GAAW,CAClC,IAAM,EAAkB,EAAU,MAAM,SAAS,GAAG,EAChD,EACA,IAAI,OAAO,EAAU,OAAQ,GAAG,EAAU,MAAM,EAAE,EAElD,EACJ,IAAK,GAAM,CAAE,WAAW,EAAK,SAAS,CAAe,EAAG,CACtD,GAAI,EAAQ,EAIV,MAEF,EAAgB,CAClB,CACI,IAAkB,IAAA,KACpB,EAAS,EAEb,CAGA,MAAO,GAAG,EAAK,MAAM,EAAG,CAAM,IAAI,GACpC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`);function t(...t){return e.curry(n,t)}function n(e){return`${e[0]?.toLowerCase()??``}${e.slice(1)}`}exports.uncapitalize=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./curry.cjs");function t(...t){return e.curry(n,t)}function n(e){return`${e[0]?.toLowerCase()??``}${e.slice(1)}`}exports.uncapitalize=t;
2
2
  //# sourceMappingURL=uncapitalize.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"uncapitalize.cjs","names":["curry"],"sources":["../src/uncapitalize.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * uncapitalize(data);\n * @example\n * uncapitalize(\"HELLO WORLD\"); // \"hELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function uncapitalize<T extends string>(data: T): Uncapitalize<T>;\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @signature\n * uncapitalize()(data);\n * @example\n * pipe(\"HELLO WORLD\", uncapitalize()); // \"hELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function uncapitalize(): <T extends string>(data: T) => Uncapitalize<T>;\n\nexport function uncapitalize(...args: ReadonlyArray<unknown>): unknown {\n return curry(uncapitalizeImplementation, args);\n}\n\nfunction uncapitalizeImplementation<T extends string>(data: T): Uncapitalize<T> {\n return `${data[0]?.toLowerCase() ?? ''}${data.slice(1)}` as Uncapitalize<T>;\n}\n"],"mappings":"kGAmDA,SAAgB,EAAa,GAAG,EAAuC,CACrE,OAAOA,EAAAA,MAAM,EAA4B,EAAK,CAGhD,SAAS,EAA6C,EAA0B,CAC9E,MAAO,GAAG,EAAK,IAAI,aAAa,EAAI,KAAK,EAAK,MAAM,EAAE"}
1
+ {"version":3,"file":"uncapitalize.cjs","names":["curry"],"sources":["../src/uncapitalize.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * uncapitalize(data);\n * @example\n * uncapitalize(\"HELLO WORLD\"); // \"hELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function uncapitalize<T extends string>(data: T): Uncapitalize<T>;\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @signature\n * uncapitalize()(data);\n * @example\n * pipe(\"HELLO WORLD\", uncapitalize()); // \"hELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function uncapitalize(): <T extends string>(data: T) => Uncapitalize<T>;\n\nexport function uncapitalize(...args: ReadonlyArray<unknown>): unknown {\n return curry(uncapitalizeImplementation, args);\n}\n\nfunction uncapitalizeImplementation<T extends string>(data: T): Uncapitalize<T> {\n return `${data[0]?.toLowerCase() ?? ''}${data.slice(1)}` as Uncapitalize<T>;\n}\n"],"mappings":"kGAmDA,SAAgB,EAAa,GAAG,EAAuC,CACrE,OAAOA,EAAAA,MAAM,EAA4B,CAAI,CAC/C,CAEA,SAAS,EAA6C,EAA0B,CAC9E,MAAO,GAAG,EAAK,EAAE,EAAE,YAAY,GAAK,KAAK,EAAK,MAAM,CAAC,GACvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"uncapitalize.js","names":[],"sources":["../src/uncapitalize.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * uncapitalize(data);\n * @example\n * uncapitalize(\"HELLO WORLD\"); // \"hELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function uncapitalize<T extends string>(data: T): Uncapitalize<T>;\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @signature\n * uncapitalize()(data);\n * @example\n * pipe(\"HELLO WORLD\", uncapitalize()); // \"hELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function uncapitalize(): <T extends string>(data: T) => Uncapitalize<T>;\n\nexport function uncapitalize(...args: ReadonlyArray<unknown>): unknown {\n return curry(uncapitalizeImplementation, args);\n}\n\nfunction uncapitalizeImplementation<T extends string>(data: T): Uncapitalize<T> {\n return `${data[0]?.toLowerCase() ?? ''}${data.slice(1)}` as Uncapitalize<T>;\n}\n"],"mappings":"mCAmDA,SAAgB,EAAa,GAAG,EAAuC,CACrE,OAAO,EAAM,EAA4B,EAAK,CAGhD,SAAS,EAA6C,EAA0B,CAC9E,MAAO,GAAG,EAAK,IAAI,aAAa,EAAI,KAAK,EAAK,MAAM,EAAE"}
1
+ {"version":3,"file":"uncapitalize.js","names":[],"sources":["../src/uncapitalize.ts"],"sourcesContent":["import { curry } from './curry';\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * uncapitalize(data);\n * @example\n * uncapitalize(\"HELLO WORLD\"); // \"hELLO WORLD\"\n * @dataFirst\n * @category String\n */\nexport function uncapitalize<T extends string>(data: T): Uncapitalize<T>;\n\n/**\n * Makes the first character of a string lowercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase)\n * for the runtime and the built-in [`Uncapitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#Uncapitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: lowercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#lowercase)\n * to lowercase it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`, `capitalize`,\n * `toCamelCase`, `toKebabCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * @signature\n * uncapitalize()(data);\n * @example\n * pipe(\"HELLO WORLD\", uncapitalize()); // \"hELLO WORLD\"\n * @dataLast\n * @category String\n */\nexport function uncapitalize(): <T extends string>(data: T) => Uncapitalize<T>;\n\nexport function uncapitalize(...args: ReadonlyArray<unknown>): unknown {\n return curry(uncapitalizeImplementation, args);\n}\n\nfunction uncapitalizeImplementation<T extends string>(data: T): Uncapitalize<T> {\n return `${data[0]?.toLowerCase() ?? ''}${data.slice(1)}` as Uncapitalize<T>;\n}\n"],"mappings":"mCAmDA,SAAgB,EAAa,GAAG,EAAuC,CACrE,OAAO,EAAM,EAA4B,CAAI,CAC/C,CAEA,SAAS,EAA6C,EAA0B,CAC9E,MAAO,GAAG,EAAK,EAAE,EAAE,YAAY,GAAK,KAAK,EAAK,MAAM,CAAC,GACvD"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./utility-evaluators-C8koSp9T.cjs`),t=require(`./curry-from-lazy-BvN_VKlH.cjs`);function n(...e){return t.t(r,e)}function r(t){let n=t,r=new Set;return(t,i,a)=>{let o=n(t,i,a);return r.has(o)?e.t:(r.add(o),{done:!1,hasNext:!0,next:t})}}exports.uniqueBy=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utility-evaluators-BGM19SpK.cjs"),t=require("./curry-from-lazy-mdjeRP1g.cjs");function n(...e){return t.t(r,e)}function r(t){let n=t,r=new Set;return(t,i,a)=>{let o=n(t,i,a);return r.has(o)?e.t:(r.add(o),{done:!1,hasNext:!0,next:t})}}exports.uniqueBy=n;
2
2
  //# sourceMappingURL=unique-by.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"unique-by.cjs","names":["curryFromLazy","SKIP_ITEM"],"sources":["../src/unique-by.ts"],"sourcesContent":["import type { BrandedReturn } from './internal/types/branded-return';\nimport type { Deduped } from './internal/types/deduped';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curryFromLazy } from './internal/curry-from-lazy';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param data - The array to filter.\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(data, keyFunction)\n * @example\n * uniqueBy(\n * [{ n: 1 }, { n: 2 }, { n: 2 }, { n: 5 }, { n: 1 }, { n: 6 }, { n: 7 }],\n * (obj) => obj.n,\n * ) // => [{n: 1}, {n: 2}, {n: 5}, {n: 6}, {n: 7}]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n data: T,\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): Deduped<T>;\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(keyFunction)(data)\n * @example\n * pipe(\n * [{n: 1}, {n: 2}, {n: 2}, {n: 5}, {n: 1}, {n: 6}, {n: 7}], // only 4 iterations\n * uniqueBy(obj => obj.n),\n * take(3)\n * ) // => [{n: 1}, {n: 2}, {n: 5}]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): (data: T) => Deduped<T>;\n\nexport function uniqueBy(...args: ReadonlyArray<unknown>): unknown {\n return curryFromLazy(lazyImplementation, args);\n}\n\nfunction lazyImplementation<T>(\n keyFunction: (item: T, index: number, data: ReadonlyArray<T>) => unknown,\n): LazyEvaluator<T> {\n // @see https://github.com/typescript-eslint/typescript-eslint/issues/9885\n const brandedKeyFunction = keyFunction as BrandedReturn<typeof keyFunction>;\n\n const set = new Set<ReturnType<typeof brandedKeyFunction>>();\n return (value, index, data) => {\n const key = brandedKeyFunction(value, index, data);\n if (set.has(key)) {\n return SKIP_ITEM;\n }\n\n set.add(key);\n return { done: false, hasNext: true, next: value };\n };\n}\n"],"mappings":"oKAkDA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAOA,EAAAA,EAAc,EAAoB,EAAK,CAGhD,SAAS,EACP,EACkB,CAElB,IAAM,EAAqB,EAErB,EAAM,IAAI,IAChB,OAAQ,EAAO,EAAO,IAAS,CAC7B,IAAM,EAAM,EAAmB,EAAO,EAAO,EAAK,CAMlD,OALI,EAAI,IAAI,EAAI,CACPC,EAAAA,GAGT,EAAI,IAAI,EAAI,CACL,CAAE,KAAM,GAAO,QAAS,GAAM,KAAM,EAAO"}
1
+ {"version":3,"file":"unique-by.cjs","names":["curryFromLazy","SKIP_ITEM"],"sources":["../src/unique-by.ts"],"sourcesContent":["import type { BrandedReturn } from './internal/types/branded-return';\nimport type { Deduped } from './internal/types/deduped';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curryFromLazy } from './internal/curry-from-lazy';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param data - The array to filter.\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(data, keyFunction)\n * @example\n * uniqueBy(\n * [{ n: 1 }, { n: 2 }, { n: 2 }, { n: 5 }, { n: 1 }, { n: 6 }, { n: 7 }],\n * (obj) => obj.n,\n * ) // => [{n: 1}, {n: 2}, {n: 5}, {n: 6}, {n: 7}]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n data: T,\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): Deduped<T>;\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(keyFunction)(data)\n * @example\n * pipe(\n * [{n: 1}, {n: 2}, {n: 2}, {n: 5}, {n: 1}, {n: 6}, {n: 7}], // only 4 iterations\n * uniqueBy(obj => obj.n),\n * take(3)\n * ) // => [{n: 1}, {n: 2}, {n: 5}]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): (data: T) => Deduped<T>;\n\nexport function uniqueBy(...args: ReadonlyArray<unknown>): unknown {\n return curryFromLazy(lazyImplementation, args);\n}\n\nfunction lazyImplementation<T>(\n keyFunction: (item: T, index: number, data: ReadonlyArray<T>) => unknown,\n): LazyEvaluator<T> {\n // @see https://github.com/typescript-eslint/typescript-eslint/issues/9885\n const brandedKeyFunction = keyFunction as BrandedReturn<typeof keyFunction>;\n\n const set = new Set<ReturnType<typeof brandedKeyFunction>>();\n return (value, index, data) => {\n const key = brandedKeyFunction(value, index, data);\n if (set.has(key)) {\n return SKIP_ITEM;\n }\n\n set.add(key);\n return { done: false, hasNext: true, next: value };\n };\n}\n"],"mappings":"oKAkDA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAOA,EAAAA,EAAc,EAAoB,CAAI,CAC/C,CAEA,SAAS,EACP,EACkB,CAElB,IAAM,EAAqB,EAErB,EAAM,IAAI,IAChB,OAAQ,EAAO,EAAO,IAAS,CAC7B,IAAM,EAAM,EAAmB,EAAO,EAAO,CAAI,EAMjD,OALI,EAAI,IAAI,CAAG,EACNC,EAAAA,GAGT,EAAI,IAAI,CAAG,EACJ,CAAE,KAAM,GAAO,QAAS,GAAM,KAAM,CAAM,EACnD,CACF"}
package/dist/unique-by.js CHANGED
@@ -1,2 +1,2 @@
1
- import{t as e}from"./utility-evaluators-ZAaUtL2Z.js";import{t}from"./curry-from-lazy-CtH1dp14.js";function n(...e){return t(r,e)}function r(t){let n=t,r=new Set;return(t,i,a)=>{let o=n(t,i,a);return r.has(o)?e:(r.add(o),{done:!1,hasNext:!0,next:t})}}export{n as uniqueBy};
1
+ import{t as e}from"./utility-evaluators-DDW55xeL.js";import{t}from"./curry-from-lazy-BoPMn2L_.js";function n(...e){return t(r,e)}function r(t){let n=t,r=new Set;return(t,i,a)=>{let o=n(t,i,a);return r.has(o)?e:(r.add(o),{done:!1,hasNext:!0,next:t})}}export{n as uniqueBy};
2
2
  //# sourceMappingURL=unique-by.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unique-by.js","names":[],"sources":["../src/unique-by.ts"],"sourcesContent":["import type { BrandedReturn } from './internal/types/branded-return';\nimport type { Deduped } from './internal/types/deduped';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curryFromLazy } from './internal/curry-from-lazy';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param data - The array to filter.\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(data, keyFunction)\n * @example\n * uniqueBy(\n * [{ n: 1 }, { n: 2 }, { n: 2 }, { n: 5 }, { n: 1 }, { n: 6 }, { n: 7 }],\n * (obj) => obj.n,\n * ) // => [{n: 1}, {n: 2}, {n: 5}, {n: 6}, {n: 7}]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n data: T,\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): Deduped<T>;\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(keyFunction)(data)\n * @example\n * pipe(\n * [{n: 1}, {n: 2}, {n: 2}, {n: 5}, {n: 1}, {n: 6}, {n: 7}], // only 4 iterations\n * uniqueBy(obj => obj.n),\n * take(3)\n * ) // => [{n: 1}, {n: 2}, {n: 5}]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): (data: T) => Deduped<T>;\n\nexport function uniqueBy(...args: ReadonlyArray<unknown>): unknown {\n return curryFromLazy(lazyImplementation, args);\n}\n\nfunction lazyImplementation<T>(\n keyFunction: (item: T, index: number, data: ReadonlyArray<T>) => unknown,\n): LazyEvaluator<T> {\n // @see https://github.com/typescript-eslint/typescript-eslint/issues/9885\n const brandedKeyFunction = keyFunction as BrandedReturn<typeof keyFunction>;\n\n const set = new Set<ReturnType<typeof brandedKeyFunction>>();\n return (value, index, data) => {\n const key = brandedKeyFunction(value, index, data);\n if (set.has(key)) {\n return SKIP_ITEM;\n }\n\n set.add(key);\n return { done: false, hasNext: true, next: value };\n };\n}\n"],"mappings":"kGAkDA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAO,EAAc,EAAoB,EAAK,CAGhD,SAAS,EACP,EACkB,CAElB,IAAM,EAAqB,EAErB,EAAM,IAAI,IAChB,OAAQ,EAAO,EAAO,IAAS,CAC7B,IAAM,EAAM,EAAmB,EAAO,EAAO,EAAK,CAMlD,OALI,EAAI,IAAI,EAAI,CACP,GAGT,EAAI,IAAI,EAAI,CACL,CAAE,KAAM,GAAO,QAAS,GAAM,KAAM,EAAO"}
1
+ {"version":3,"file":"unique-by.js","names":[],"sources":["../src/unique-by.ts"],"sourcesContent":["import type { BrandedReturn } from './internal/types/branded-return';\nimport type { Deduped } from './internal/types/deduped';\nimport type { IterableContainer } from './internal/types/iterable-container';\nimport type { LazyEvaluator } from './internal/types/lazy-evaluator';\nimport { curryFromLazy } from './internal/curry-from-lazy';\nimport { SKIP_ITEM } from './internal/utility-evaluators';\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param data - The array to filter.\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(data, keyFunction)\n * @example\n * uniqueBy(\n * [{ n: 1 }, { n: 2 }, { n: 2 }, { n: 5 }, { n: 1 }, { n: 6 }, { n: 7 }],\n * (obj) => obj.n,\n * ) // => [{n: 1}, {n: 2}, {n: 5}, {n: 6}, {n: 7}]\n * @dataFirst\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n data: T,\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): Deduped<T>;\n\n/**\n * Returns a new array containing only one copy of each element in the original\n * list transformed by a function. Elements are compared by reference using Set.\n *\n * @param keyFunction - Extracts a value that would be used to compare elements.\n * @signature\n * uniqueBy(keyFunction)(data)\n * @example\n * pipe(\n * [{n: 1}, {n: 2}, {n: 2}, {n: 5}, {n: 1}, {n: 6}, {n: 7}], // only 4 iterations\n * uniqueBy(obj => obj.n),\n * take(3)\n * ) // => [{n: 1}, {n: 2}, {n: 5}]\n * @dataLast\n * @lazy\n * @category Array\n */\nexport function uniqueBy<T extends IterableContainer>(\n keyFunction: (item: T[number], index: number, data: T) => unknown,\n): (data: T) => Deduped<T>;\n\nexport function uniqueBy(...args: ReadonlyArray<unknown>): unknown {\n return curryFromLazy(lazyImplementation, args);\n}\n\nfunction lazyImplementation<T>(\n keyFunction: (item: T, index: number, data: ReadonlyArray<T>) => unknown,\n): LazyEvaluator<T> {\n // @see https://github.com/typescript-eslint/typescript-eslint/issues/9885\n const brandedKeyFunction = keyFunction as BrandedReturn<typeof keyFunction>;\n\n const set = new Set<ReturnType<typeof brandedKeyFunction>>();\n return (value, index, data) => {\n const key = brandedKeyFunction(value, index, data);\n if (set.has(key)) {\n return SKIP_ITEM;\n }\n\n set.add(key);\n return { done: false, hasNext: true, next: value };\n };\n}\n"],"mappings":"kGAkDA,SAAgB,EAAS,GAAG,EAAuC,CACjE,OAAO,EAAc,EAAoB,CAAI,CAC/C,CAEA,SAAS,EACP,EACkB,CAElB,IAAM,EAAqB,EAErB,EAAM,IAAI,IAChB,OAAQ,EAAO,EAAO,IAAS,CAC7B,IAAM,EAAM,EAAmB,EAAO,EAAO,CAAI,EAMjD,OALI,EAAI,IAAI,CAAG,EACN,GAGT,EAAI,IAAI,CAAG,EACJ,CAAE,KAAM,GAAO,QAAS,GAAM,KAAM,CAAM,EACnD,CACF"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./utility-evaluators-C8koSp9T.cjs`),t=require(`./curry-from-lazy-BvN_VKlH.cjs`);function n(...e){return t.t(r,e)}function r(t){return(n,r,i)=>i.findIndex((e,i)=>r===i||t(n,e))===r?{done:!1,hasNext:!0,next:n}:e.t}exports.uniqueWith=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utility-evaluators-BGM19SpK.cjs"),t=require("./curry-from-lazy-mdjeRP1g.cjs");function n(...e){return t.t(r,e)}function r(t){return(n,r,i)=>i.findIndex((e,i)=>r===i||t(n,e))===r?{done:!1,hasNext:!0,next:n}:e.t}exports.uniqueWith=n;
2
2
  //# sourceMappingURL=unique-with.cjs.map