es-toolkit 1.50.0 → 1.51.0-dev.2065

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 (355) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/NOTICE +39 -0
  3. package/README.md +2 -2
  4. package/bigint.d.ts +1 -0
  5. package/bigint.js +1 -0
  6. package/dist/_internal/NonPlainObject.d.mts +8 -0
  7. package/dist/_internal/NonPlainObject.d.ts +8 -0
  8. package/dist/_internal/bigIntRangeLength.js +19 -0
  9. package/dist/_internal/bigIntRangeLength.mjs +19 -0
  10. package/dist/_internal/isMergeableValue.js +17 -0
  11. package/dist/_internal/isMergeableValue.mjs +17 -0
  12. package/dist/_internal/isUnsafeProperty.js +7 -4
  13. package/dist/_internal/isUnsafeProperty.mjs +7 -4
  14. package/dist/_internal/isUnsafeToWriteProperty.js +22 -0
  15. package/dist/_internal/isUnsafeToWriteProperty.mjs +22 -0
  16. package/dist/array/at.d.mts +1 -1
  17. package/dist/array/at.d.ts +1 -1
  18. package/dist/array/filterAsync.js +1 -1
  19. package/dist/array/filterAsync.mjs +1 -1
  20. package/dist/array/flatMapAsync.js +1 -1
  21. package/dist/array/flatMapAsync.mjs +1 -1
  22. package/dist/array/forEachAsync.js +1 -1
  23. package/dist/array/forEachAsync.mjs +1 -1
  24. package/dist/array/index.js +1 -1
  25. package/dist/array/index.mjs +1 -1
  26. package/dist/array/limitAsync.d.mts +4 -28
  27. package/dist/array/limitAsync.d.ts +4 -28
  28. package/dist/array/limitAsync.js +2 -39
  29. package/dist/array/limitAsync.mjs +3 -39
  30. package/dist/array/mapAsync.js +1 -1
  31. package/dist/array/mapAsync.mjs +1 -1
  32. package/dist/array/orderBy.d.mts +1 -1
  33. package/dist/array/orderBy.d.ts +1 -1
  34. package/dist/array/pullAt.d.mts +1 -1
  35. package/dist/array/pullAt.d.ts +1 -1
  36. package/dist/array/pullAt.js +1 -1
  37. package/dist/array/pullAt.mjs +1 -1
  38. package/dist/array/sortBy.d.mts +1 -1
  39. package/dist/array/sortBy.d.ts +1 -1
  40. package/dist/array/unzip.d.mts +3 -0
  41. package/dist/array/unzip.d.ts +3 -0
  42. package/dist/array/unzip.js +3 -0
  43. package/dist/array/unzip.mjs +3 -0
  44. package/dist/bigint/clamp.d.mts +37 -0
  45. package/dist/bigint/clamp.d.ts +37 -0
  46. package/dist/bigint/clamp.js +16 -0
  47. package/dist/bigint/clamp.mjs +16 -0
  48. package/dist/bigint/inRange.d.mts +37 -0
  49. package/dist/bigint/inRange.d.ts +37 -0
  50. package/dist/bigint/inRange.js +20 -0
  51. package/dist/bigint/inRange.mjs +20 -0
  52. package/dist/bigint/index.d.mts +14 -0
  53. package/dist/bigint/index.d.ts +14 -0
  54. package/dist/bigint/index.js +27 -0
  55. package/dist/bigint/index.mjs +14 -0
  56. package/dist/bigint/max.d.mts +21 -0
  57. package/dist/bigint/max.d.ts +21 -0
  58. package/dist/bigint/max.js +26 -0
  59. package/dist/bigint/max.mjs +26 -0
  60. package/dist/bigint/maxBy.d.mts +21 -0
  61. package/dist/bigint/maxBy.d.ts +21 -0
  62. package/dist/bigint/maxBy.js +34 -0
  63. package/dist/bigint/maxBy.mjs +34 -0
  64. package/dist/bigint/median.d.mts +22 -0
  65. package/dist/bigint/median.d.ts +22 -0
  66. package/dist/bigint/median.js +28 -0
  67. package/dist/bigint/median.mjs +28 -0
  68. package/dist/bigint/medianBy.d.mts +21 -0
  69. package/dist/bigint/medianBy.d.ts +21 -0
  70. package/dist/bigint/medianBy.js +24 -0
  71. package/dist/bigint/medianBy.mjs +24 -0
  72. package/dist/bigint/min.d.mts +18 -0
  73. package/dist/bigint/min.d.ts +18 -0
  74. package/dist/bigint/min.js +23 -0
  75. package/dist/bigint/min.mjs +23 -0
  76. package/dist/bigint/minBy.d.mts +21 -0
  77. package/dist/bigint/minBy.d.ts +21 -0
  78. package/dist/bigint/minBy.js +34 -0
  79. package/dist/bigint/minBy.mjs +34 -0
  80. package/dist/bigint/percentile.d.mts +23 -0
  81. package/dist/bigint/percentile.d.ts +23 -0
  82. package/dist/bigint/percentile.js +31 -0
  83. package/dist/bigint/percentile.mjs +31 -0
  84. package/dist/bigint/range.d.mts +45 -0
  85. package/dist/bigint/range.d.ts +45 -0
  86. package/dist/bigint/range.js +24 -0
  87. package/dist/bigint/range.mjs +24 -0
  88. package/dist/bigint/rangeRight.d.mts +43 -0
  89. package/dist/bigint/rangeRight.d.ts +43 -0
  90. package/dist/bigint/rangeRight.js +25 -0
  91. package/dist/bigint/rangeRight.mjs +25 -0
  92. package/dist/bigint/sum.d.mts +18 -0
  93. package/dist/bigint/sum.d.ts +18 -0
  94. package/dist/bigint/sum.js +22 -0
  95. package/dist/bigint/sum.mjs +22 -0
  96. package/dist/bigint/sumBy.d.mts +20 -0
  97. package/dist/bigint/sumBy.d.ts +20 -0
  98. package/dist/bigint/sumBy.js +24 -0
  99. package/dist/bigint/sumBy.mjs +24 -0
  100. package/dist/browser.global.js +6 -3
  101. package/dist/compat/_internal/normalizeZero.js +13 -0
  102. package/dist/compat/_internal/normalizeZero.mjs +13 -0
  103. package/dist/compat/_internal/toKey.js +1 -1
  104. package/dist/compat/_internal/toKey.mjs +1 -1
  105. package/dist/compat/_internal/unicodeSize.js +45 -0
  106. package/dist/compat/_internal/unicodeSize.mjs +45 -0
  107. package/dist/compat/array/chunk.js +1 -0
  108. package/dist/compat/array/chunk.mjs +1 -0
  109. package/dist/compat/array/difference.js +2 -1
  110. package/dist/compat/array/difference.mjs +2 -1
  111. package/dist/compat/array/differenceBy.js +3 -2
  112. package/dist/compat/array/differenceBy.mjs +3 -2
  113. package/dist/compat/array/drop.d.mts +1 -1
  114. package/dist/compat/array/drop.d.ts +1 -1
  115. package/dist/compat/array/dropRight.d.mts +2 -3
  116. package/dist/compat/array/dropRight.d.ts +2 -3
  117. package/dist/compat/array/dropRight.js +4 -4
  118. package/dist/compat/array/dropRight.mjs +4 -4
  119. package/dist/compat/array/every.js +9 -9
  120. package/dist/compat/array/every.mjs +9 -9
  121. package/dist/compat/array/fill.js +8 -2
  122. package/dist/compat/array/fill.mjs +8 -2
  123. package/dist/compat/array/find.js +14 -13
  124. package/dist/compat/array/find.mjs +14 -13
  125. package/dist/compat/array/findIndex.js +3 -19
  126. package/dist/compat/array/findIndex.mjs +3 -19
  127. package/dist/compat/array/findLast.js +3 -3
  128. package/dist/compat/array/findLast.mjs +3 -3
  129. package/dist/compat/array/flatMap.js +3 -8
  130. package/dist/compat/array/flatMap.mjs +3 -7
  131. package/dist/compat/array/flatMapDepth.js +1 -1
  132. package/dist/compat/array/flatMapDepth.mjs +1 -1
  133. package/dist/compat/array/forEach.js +1 -1
  134. package/dist/compat/array/forEach.mjs +1 -1
  135. package/dist/compat/array/includes.js +13 -13
  136. package/dist/compat/array/includes.mjs +13 -13
  137. package/dist/compat/array/indexOf.js +2 -1
  138. package/dist/compat/array/indexOf.mjs +2 -1
  139. package/dist/compat/array/intersection.js +3 -2
  140. package/dist/compat/array/intersection.mjs +3 -2
  141. package/dist/compat/array/intersectionBy.js +7 -11
  142. package/dist/compat/array/intersectionBy.mjs +7 -11
  143. package/dist/compat/array/intersectionWith.js +6 -18
  144. package/dist/compat/array/intersectionWith.mjs +6 -18
  145. package/dist/compat/array/last.js +1 -1
  146. package/dist/compat/array/last.mjs +1 -1
  147. package/dist/compat/array/lastIndexOf.js +3 -1
  148. package/dist/compat/array/lastIndexOf.mjs +3 -1
  149. package/dist/compat/array/map.js +3 -3
  150. package/dist/compat/array/map.mjs +3 -3
  151. package/dist/compat/array/orderBy.js +8 -6
  152. package/dist/compat/array/orderBy.mjs +8 -6
  153. package/dist/compat/array/partition.js +6 -6
  154. package/dist/compat/array/partition.mjs +6 -6
  155. package/dist/compat/array/pull.js +1 -1
  156. package/dist/compat/array/pull.mjs +1 -1
  157. package/dist/compat/array/pullAll.js +2 -0
  158. package/dist/compat/array/pullAll.mjs +2 -0
  159. package/dist/compat/array/remove.js +8 -4
  160. package/dist/compat/array/remove.mjs +8 -4
  161. package/dist/compat/array/reverse.js +1 -1
  162. package/dist/compat/array/reverse.mjs +1 -1
  163. package/dist/compat/array/sampleSize.js +2 -1
  164. package/dist/compat/array/sampleSize.mjs +2 -1
  165. package/dist/compat/array/size.js +2 -1
  166. package/dist/compat/array/size.mjs +2 -1
  167. package/dist/compat/array/some.js +2 -1
  168. package/dist/compat/array/some.mjs +2 -1
  169. package/dist/compat/array/takeRightWhile.js +2 -2
  170. package/dist/compat/array/takeRightWhile.mjs +2 -2
  171. package/dist/compat/array/takeWhile.js +2 -2
  172. package/dist/compat/array/takeWhile.mjs +2 -2
  173. package/dist/compat/array/unionBy.js +2 -1
  174. package/dist/compat/array/unionBy.mjs +2 -1
  175. package/dist/compat/array/uniqBy.js +4 -3
  176. package/dist/compat/array/uniqBy.mjs +4 -3
  177. package/dist/compat/array/unzip.d.mts +3 -0
  178. package/dist/compat/array/unzip.d.ts +3 -0
  179. package/dist/compat/array/unzip.js +3 -0
  180. package/dist/compat/array/unzip.mjs +3 -0
  181. package/dist/compat/array/unzipWith.js +1 -1
  182. package/dist/compat/array/unzipWith.mjs +1 -1
  183. package/dist/compat/array/zipObject.js +2 -0
  184. package/dist/compat/array/zipObject.mjs +2 -0
  185. package/dist/compat/compat.d.mts +3 -3
  186. package/dist/compat/compat.d.ts +3 -3
  187. package/dist/compat/compat.js +8 -4
  188. package/dist/compat/compat.mjs +8 -4
  189. package/dist/compat/function/curry.d.mts +1 -1
  190. package/dist/compat/function/curry.d.ts +1 -1
  191. package/dist/compat/function/flowRight.d.mts +1 -1
  192. package/dist/compat/function/flowRight.d.ts +1 -1
  193. package/dist/compat/function/partial.d.mts +1 -1
  194. package/dist/compat/function/partial.d.ts +1 -1
  195. package/dist/compat/function/rest.d.mts +1 -1
  196. package/dist/compat/function/rest.d.ts +1 -1
  197. package/dist/compat/function/rest.js +1 -1
  198. package/dist/compat/function/rest.mjs +1 -1
  199. package/dist/compat/index.d.mts +3 -3
  200. package/dist/compat/index.d.ts +3 -3
  201. package/dist/compat/index.js +6 -4
  202. package/dist/compat/index.mjs +5 -5
  203. package/dist/compat/math/maxBy.js +1 -1
  204. package/dist/compat/math/maxBy.mjs +1 -1
  205. package/dist/compat/math/meanBy.d.mts +4 -0
  206. package/dist/compat/math/meanBy.d.ts +4 -0
  207. package/dist/compat/math/meanBy.js +8 -3
  208. package/dist/compat/math/meanBy.mjs +8 -3
  209. package/dist/compat/math/minBy.js +1 -1
  210. package/dist/compat/math/minBy.mjs +1 -1
  211. package/dist/compat/object/cloneDeep.d.mts +5 -5
  212. package/dist/compat/object/cloneDeep.d.ts +5 -5
  213. package/dist/compat/object/cloneDeep.js +5 -5
  214. package/dist/compat/object/cloneDeep.mjs +5 -5
  215. package/dist/compat/object/cloneDeepWith.js +3 -1
  216. package/dist/compat/object/cloneDeepWith.mjs +3 -1
  217. package/dist/compat/object/cloneWith.d.mts +1 -1
  218. package/dist/compat/object/cloneWith.d.ts +1 -1
  219. package/dist/compat/object/cloneWith.js +1 -1
  220. package/dist/compat/object/cloneWith.mjs +1 -1
  221. package/dist/compat/object/entries.d.mts +1 -0
  222. package/dist/compat/object/entries.d.ts +1 -0
  223. package/dist/compat/object/entries.js +1 -0
  224. package/dist/compat/object/entries.mjs +1 -0
  225. package/dist/compat/object/entriesIn.d.mts +1 -0
  226. package/dist/compat/object/entriesIn.d.ts +1 -0
  227. package/dist/compat/object/entriesIn.js +1 -0
  228. package/dist/compat/object/entriesIn.mjs +1 -0
  229. package/dist/compat/object/omit.js +5 -5
  230. package/dist/compat/object/omit.mjs +5 -5
  231. package/dist/compat/object/transform.js +1 -1
  232. package/dist/compat/object/transform.mjs +1 -1
  233. package/dist/compat/object/updateWith.js +2 -2
  234. package/dist/compat/object/updateWith.mjs +2 -2
  235. package/dist/compat/predicate/isMatchWith.js +14 -5
  236. package/dist/compat/predicate/isMatchWith.mjs +14 -5
  237. package/dist/compat/string/template.js +2 -1
  238. package/dist/compat/string/template.mjs +2 -1
  239. package/dist/compat/string/words.js +17 -13
  240. package/dist/compat/string/words.mjs +17 -13
  241. package/dist/compat/util/iteratee.js +1 -3
  242. package/dist/compat/util/iteratee.mjs +1 -3
  243. package/dist/compat/util/toArray.d.mts +5 -5
  244. package/dist/compat/util/toArray.d.ts +5 -5
  245. package/dist/compat/util/toArray.js +9 -5
  246. package/dist/compat/util/toArray.mjs +9 -5
  247. package/dist/compat/util/toPath.js +11 -3
  248. package/dist/compat/util/toPath.mjs +11 -3
  249. package/dist/compat/util/toString.js +4 -1
  250. package/dist/compat/util/toString.mjs +4 -1
  251. package/dist/fp/array/at.d.mts +1 -1
  252. package/dist/fp/array/at.d.ts +1 -1
  253. package/dist/fp/array/orderBy.d.mts +1 -1
  254. package/dist/fp/array/orderBy.d.ts +1 -1
  255. package/dist/fp/array/sortBy.d.mts +1 -1
  256. package/dist/fp/array/sortBy.d.ts +1 -1
  257. package/dist/fp/array/unzip.d.mts +3 -0
  258. package/dist/fp/array/unzip.d.ts +3 -0
  259. package/dist/fp/array/unzip.js +3 -0
  260. package/dist/fp/array/unzip.mjs +3 -0
  261. package/dist/function/memoize.d.mts +3 -2
  262. package/dist/function/memoize.d.ts +3 -2
  263. package/dist/function/memoize.js +3 -2
  264. package/dist/function/memoize.mjs +3 -2
  265. package/dist/function/partial.d.mts +2 -2
  266. package/dist/function/partial.d.ts +2 -2
  267. package/dist/function/partialRight.d.mts +5 -5
  268. package/dist/function/partialRight.d.ts +5 -5
  269. package/dist/function/rest.d.mts +1 -1
  270. package/dist/function/rest.d.ts +1 -1
  271. package/dist/function/rest.js +1 -1
  272. package/dist/function/rest.mjs +1 -1
  273. package/dist/function/retry.d.mts +7 -4
  274. package/dist/function/retry.d.ts +7 -4
  275. package/dist/function/retry.js +4 -2
  276. package/dist/function/retry.mjs +1 -1
  277. package/dist/index.d.mts +9 -2
  278. package/dist/index.d.ts +9 -2
  279. package/dist/index.js +18 -4
  280. package/dist/index.mjs +12 -5
  281. package/dist/object/cloneDeepWith.d.mts +3 -1
  282. package/dist/object/cloneDeepWith.d.ts +3 -1
  283. package/dist/object/cloneDeepWith.js +3 -1
  284. package/dist/object/cloneDeepWith.mjs +3 -1
  285. package/dist/object/deepFreeze.d.mts +20 -0
  286. package/dist/object/deepFreeze.d.ts +20 -0
  287. package/dist/object/deepFreeze.js +29 -0
  288. package/dist/object/deepFreeze.mjs +29 -0
  289. package/dist/object/flattenObject.d.mts +16 -1
  290. package/dist/object/flattenObject.d.ts +16 -1
  291. package/dist/object/flattenObject.js +15 -6
  292. package/dist/object/flattenObject.mjs +15 -6
  293. package/dist/object/index.d.mts +7 -1
  294. package/dist/object/index.d.ts +7 -1
  295. package/dist/object/index.js +12 -0
  296. package/dist/object/index.mjs +7 -1
  297. package/dist/object/mapKeysAsync.d.mts +25 -0
  298. package/dist/object/mapKeysAsync.d.ts +25 -0
  299. package/dist/object/mapKeysAsync.js +32 -0
  300. package/dist/object/mapKeysAsync.mjs +32 -0
  301. package/dist/object/mapValuesAsync.d.mts +26 -0
  302. package/dist/object/mapValuesAsync.d.ts +26 -0
  303. package/dist/object/mapValuesAsync.js +32 -0
  304. package/dist/object/mapValuesAsync.mjs +32 -0
  305. package/dist/object/merge.js +2 -4
  306. package/dist/object/merge.mjs +1 -3
  307. package/dist/object/mergeWith.js +4 -4
  308. package/dist/object/mergeWith.mjs +4 -4
  309. package/dist/object/toCamelCaseKeys.d.mts +2 -6
  310. package/dist/object/toCamelCaseKeys.d.ts +2 -6
  311. package/dist/object/toConstantCaseKeys.d.mts +52 -0
  312. package/dist/object/toConstantCaseKeys.d.ts +52 -0
  313. package/dist/object/toConstantCaseKeys.js +66 -0
  314. package/dist/object/toConstantCaseKeys.mjs +66 -0
  315. package/dist/object/toKebabCaseKeys.d.mts +52 -0
  316. package/dist/object/toKebabCaseKeys.d.ts +52 -0
  317. package/dist/object/toKebabCaseKeys.js +66 -0
  318. package/dist/object/toKebabCaseKeys.mjs +66 -0
  319. package/dist/object/toMerged.js +4 -4
  320. package/dist/object/toMerged.mjs +4 -4
  321. package/dist/object/toPascalCaseKeys.d.mts +52 -0
  322. package/dist/object/toPascalCaseKeys.d.ts +52 -0
  323. package/dist/object/toPascalCaseKeys.js +66 -0
  324. package/dist/object/toPascalCaseKeys.mjs +66 -0
  325. package/dist/object/toSnakeCaseKeys.d.mts +2 -3
  326. package/dist/object/toSnakeCaseKeys.d.ts +2 -3
  327. package/dist/promise/index.d.mts +2 -1
  328. package/dist/promise/index.d.ts +2 -1
  329. package/dist/promise/index.js +2 -0
  330. package/dist/promise/index.mjs +2 -1
  331. package/dist/promise/limitAsync.d.mts +35 -0
  332. package/dist/promise/limitAsync.d.ts +35 -0
  333. package/dist/promise/limitAsync.js +46 -0
  334. package/dist/promise/limitAsync.mjs +46 -0
  335. package/dist/string/dedent.d.mts +37 -0
  336. package/dist/string/dedent.d.ts +37 -0
  337. package/dist/string/dedent.js +38 -0
  338. package/dist/string/dedent.mjs +38 -0
  339. package/dist/string/index.d.mts +2 -1
  340. package/dist/string/index.d.ts +2 -1
  341. package/dist/string/index.js +5 -3
  342. package/dist/string/index.mjs +5 -4
  343. package/dist/types/ToCamelCaseKeys.d.mts +24 -0
  344. package/dist/types/ToCamelCaseKeys.d.ts +24 -0
  345. package/dist/types/ToConstantCaseKeys.d.mts +21 -0
  346. package/dist/types/ToConstantCaseKeys.d.ts +21 -0
  347. package/dist/types/ToKebabCaseKeys.d.mts +23 -0
  348. package/dist/types/ToKebabCaseKeys.d.ts +23 -0
  349. package/dist/types/ToPascalCaseKeys.d.mts +24 -0
  350. package/dist/types/ToPascalCaseKeys.d.ts +24 -0
  351. package/dist/types/ToSnakeCaseKeys.d.mts +21 -0
  352. package/dist/types/ToSnakeCaseKeys.d.ts +21 -0
  353. package/dist/types/index.d.mts +6 -1
  354. package/dist/types/index.d.ts +6 -1
  355. package/package.json +27 -2
@@ -0,0 +1,24 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.mjs";
2
+
3
+ //#region src/types/ToCamelCaseKeys.d.ts
4
+ type SnakeToCamel<S extends string> = S extends `${infer H}_${infer T}` ? `${Lowercase<H>}${Capitalize<SnakeToCamel<T>>}` : Lowercase<S>;
5
+ type PascalToCamel<S extends string> = S extends `${infer F}${infer R}` ? `${Lowercase<F>}${R}` : S;
6
+ /** If it's snake_case, apply the snake_case rule; for uppercase keys, lowercase the entire string; otherwise, just lowercase the first letter (including PascalCase → camelCase). */
7
+ type AnyToCamel<S extends string> = S extends `${string}_${string}` ? SnakeToCamel<S> : S extends Uppercase<S> ? Lowercase<S> : PascalToCamel<S>;
8
+ /**
9
+ * Converts the keys of `T` to camelCase recursively.
10
+ *
11
+ * This is the return type of the `toCamelCaseKeys` function. Recurses into
12
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
13
+ * pass through unchanged.
14
+ *
15
+ * @template T - The type whose keys are converted.
16
+ *
17
+ * @example
18
+ * type Response = { user_id: number; first_name: string };
19
+ * type Converted = ToCamelCaseKeys<Response>;
20
+ * // => { userId: number; firstName: string }
21
+ */
22
+ type ToCamelCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToCamelCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as AnyToCamel<Extract<K, string>>]: ToCamelCaseKeys<T[K]> } : T;
23
+ //#endregion
24
+ export { ToCamelCaseKeys };
@@ -0,0 +1,24 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.js";
2
+
3
+ //#region src/types/ToCamelCaseKeys.d.ts
4
+ type SnakeToCamel<S extends string> = S extends `${infer H}_${infer T}` ? `${Lowercase<H>}${Capitalize<SnakeToCamel<T>>}` : Lowercase<S>;
5
+ type PascalToCamel<S extends string> = S extends `${infer F}${infer R}` ? `${Lowercase<F>}${R}` : S;
6
+ /** If it's snake_case, apply the snake_case rule; for uppercase keys, lowercase the entire string; otherwise, just lowercase the first letter (including PascalCase → camelCase). */
7
+ type AnyToCamel<S extends string> = S extends `${string}_${string}` ? SnakeToCamel<S> : S extends Uppercase<S> ? Lowercase<S> : PascalToCamel<S>;
8
+ /**
9
+ * Converts the keys of `T` to camelCase recursively.
10
+ *
11
+ * This is the return type of the `toCamelCaseKeys` function. Recurses into
12
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
13
+ * pass through unchanged.
14
+ *
15
+ * @template T - The type whose keys are converted.
16
+ *
17
+ * @example
18
+ * type Response = { user_id: number; first_name: string };
19
+ * type Converted = ToCamelCaseKeys<Response>;
20
+ * // => { userId: number; firstName: string }
21
+ */
22
+ type ToCamelCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToCamelCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as AnyToCamel<Extract<K, string>>]: ToCamelCaseKeys<T[K]> } : T;
23
+ //#endregion
24
+ export { ToCamelCaseKeys };
@@ -0,0 +1,21 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.mjs";
2
+
3
+ //#region src/types/ToConstantCaseKeys.d.ts
4
+ type ConstantCase<S extends string> = S extends Lowercase<S> ? Uppercase<S> : S extends `${infer P1}${infer P2}` ? P2 extends Uncapitalize<P2> ? `${Uppercase<P1>}${ConstantCase<P2>}` : `${Uppercase<P1>}_${ConstantCase<Uncapitalize<P2>>}` : Uppercase<S>;
5
+ /**
6
+ * Converts the keys of `T` to CONSTANT_CASE recursively.
7
+ *
8
+ * This is the return type of the `toConstantCaseKeys` function. Recurses into
9
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
10
+ * pass through unchanged.
11
+ *
12
+ * @template T - The type whose keys are converted.
13
+ *
14
+ * @example
15
+ * type Response = { userId: number; firstName: string };
16
+ * type Converted = ToConstantCaseKeys<Response>;
17
+ * // => { USER_ID: number; FIRST_NAME: string }
18
+ */
19
+ type ToConstantCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToConstantCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as ConstantCase<string & K>]: ToConstantCaseKeys<T[K]> } : T;
20
+ //#endregion
21
+ export { ToConstantCaseKeys };
@@ -0,0 +1,21 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.js";
2
+
3
+ //#region src/types/ToConstantCaseKeys.d.ts
4
+ type ConstantCase<S extends string> = S extends Lowercase<S> ? Uppercase<S> : S extends `${infer P1}${infer P2}` ? P2 extends Uncapitalize<P2> ? `${Uppercase<P1>}${ConstantCase<P2>}` : `${Uppercase<P1>}_${ConstantCase<Uncapitalize<P2>>}` : Uppercase<S>;
5
+ /**
6
+ * Converts the keys of `T` to CONSTANT_CASE recursively.
7
+ *
8
+ * This is the return type of the `toConstantCaseKeys` function. Recurses into
9
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
10
+ * pass through unchanged.
11
+ *
12
+ * @template T - The type whose keys are converted.
13
+ *
14
+ * @example
15
+ * type Response = { userId: number; firstName: string };
16
+ * type Converted = ToConstantCaseKeys<Response>;
17
+ * // => { USER_ID: number; FIRST_NAME: string }
18
+ */
19
+ type ToConstantCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToConstantCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as ConstantCase<string & K>]: ToConstantCaseKeys<T[K]> } : T;
20
+ //#endregion
21
+ export { ToConstantCaseKeys };
@@ -0,0 +1,23 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.mjs";
2
+
3
+ //#region src/types/ToKebabCaseKeys.d.ts
4
+ type SnakeToKebab<S extends string> = S extends `${infer P1}_${infer P2}` ? Lowercase<`${P1}-${SnakeToKebab<P2>}`> : Lowercase<S>;
5
+ type CamelToKebab<S extends string> = S extends `${infer P1}${infer P2}` ? P2 extends Uncapitalize<P2> ? `${Lowercase<P1>}${CamelToKebab<P2>}` : `${Lowercase<P1>}-${CamelToKebab<Uncapitalize<P2>>}` : S;
6
+ type KebabCase<S extends string> = S extends `${string}_${string}` ? SnakeToKebab<S> : S extends Uppercase<S> ? Lowercase<S> : CamelToKebab<S>;
7
+ /**
8
+ * Converts the keys of `T` to kebab-case recursively.
9
+ *
10
+ * This is the return type of the `toKebabCaseKeys` function. Recurses into
11
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
12
+ * pass through unchanged.
13
+ *
14
+ * @template T - The type whose keys are converted.
15
+ *
16
+ * @example
17
+ * type Response = { userId: number; firstName: string };
18
+ * type Converted = ToKebabCaseKeys<Response>;
19
+ * // => { 'user-id': number; 'first-name': string }
20
+ */
21
+ type ToKebabCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToKebabCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as KebabCase<string & K>]: ToKebabCaseKeys<T[K]> } : T;
22
+ //#endregion
23
+ export { ToKebabCaseKeys };
@@ -0,0 +1,23 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.js";
2
+
3
+ //#region src/types/ToKebabCaseKeys.d.ts
4
+ type SnakeToKebab<S extends string> = S extends `${infer P1}_${infer P2}` ? Lowercase<`${P1}-${SnakeToKebab<P2>}`> : Lowercase<S>;
5
+ type CamelToKebab<S extends string> = S extends `${infer P1}${infer P2}` ? P2 extends Uncapitalize<P2> ? `${Lowercase<P1>}${CamelToKebab<P2>}` : `${Lowercase<P1>}-${CamelToKebab<Uncapitalize<P2>>}` : S;
6
+ type KebabCase<S extends string> = S extends `${string}_${string}` ? SnakeToKebab<S> : S extends Uppercase<S> ? Lowercase<S> : CamelToKebab<S>;
7
+ /**
8
+ * Converts the keys of `T` to kebab-case recursively.
9
+ *
10
+ * This is the return type of the `toKebabCaseKeys` function. Recurses into
11
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
12
+ * pass through unchanged.
13
+ *
14
+ * @template T - The type whose keys are converted.
15
+ *
16
+ * @example
17
+ * type Response = { userId: number; firstName: string };
18
+ * type Converted = ToKebabCaseKeys<Response>;
19
+ * // => { 'user-id': number; 'first-name': string }
20
+ */
21
+ type ToKebabCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToKebabCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as KebabCase<string & K>]: ToKebabCaseKeys<T[K]> } : T;
22
+ //#endregion
23
+ export { ToKebabCaseKeys };
@@ -0,0 +1,24 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.mjs";
2
+
3
+ //#region src/types/ToPascalCaseKeys.d.ts
4
+ type SnakeToPascal<S extends string> = S extends `${infer H}_${infer T}` ? `${Capitalize<Lowercase<H>>}${Capitalize<SnakeToPascal<T>>}` : Capitalize<Lowercase<S>>;
5
+ type CamelToPascal<S extends string> = S extends `${infer F}${infer R}` ? `${Uppercase<F>}${R}` : S;
6
+ /** If it's snake_case, apply the snake_case rule; for uppercase keys, lowercase and capitalize the entire string; otherwise, just uppercase the first letter (including camelCase → PascalCase). */
7
+ type AnyToPascal<S extends string> = S extends `${string}_${string}` ? SnakeToPascal<S> : S extends Uppercase<S> ? Capitalize<Lowercase<S>> : CamelToPascal<S>;
8
+ /**
9
+ * Converts the keys of `T` to PascalCase recursively.
10
+ *
11
+ * This is the return type of the `toPascalCaseKeys` function. Recurses into
12
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
13
+ * pass through unchanged.
14
+ *
15
+ * @template T - The type whose keys are converted.
16
+ *
17
+ * @example
18
+ * type Response = { userId: number; firstName: string };
19
+ * type Converted = ToPascalCaseKeys<Response>;
20
+ * // => { UserId: number; FirstName: string }
21
+ */
22
+ type ToPascalCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToPascalCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as AnyToPascal<Extract<K, string>>]: ToPascalCaseKeys<T[K]> } : T;
23
+ //#endregion
24
+ export { ToPascalCaseKeys };
@@ -0,0 +1,24 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.js";
2
+
3
+ //#region src/types/ToPascalCaseKeys.d.ts
4
+ type SnakeToPascal<S extends string> = S extends `${infer H}_${infer T}` ? `${Capitalize<Lowercase<H>>}${Capitalize<SnakeToPascal<T>>}` : Capitalize<Lowercase<S>>;
5
+ type CamelToPascal<S extends string> = S extends `${infer F}${infer R}` ? `${Uppercase<F>}${R}` : S;
6
+ /** If it's snake_case, apply the snake_case rule; for uppercase keys, lowercase and capitalize the entire string; otherwise, just uppercase the first letter (including camelCase → PascalCase). */
7
+ type AnyToPascal<S extends string> = S extends `${string}_${string}` ? SnakeToPascal<S> : S extends Uppercase<S> ? Capitalize<Lowercase<S>> : CamelToPascal<S>;
8
+ /**
9
+ * Converts the keys of `T` to PascalCase recursively.
10
+ *
11
+ * This is the return type of the `toPascalCaseKeys` function. Recurses into
12
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
13
+ * pass through unchanged.
14
+ *
15
+ * @template T - The type whose keys are converted.
16
+ *
17
+ * @example
18
+ * type Response = { userId: number; firstName: string };
19
+ * type Converted = ToPascalCaseKeys<Response>;
20
+ * // => { UserId: number; FirstName: string }
21
+ */
22
+ type ToPascalCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToPascalCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as AnyToPascal<Extract<K, string>>]: ToPascalCaseKeys<T[K]> } : T;
23
+ //#endregion
24
+ export { ToPascalCaseKeys };
@@ -0,0 +1,21 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.mjs";
2
+
3
+ //#region src/types/ToSnakeCaseKeys.d.ts
4
+ type SnakeCase<S extends string> = S extends Uppercase<S> ? Lowercase<S> : S extends `${infer P1}${infer P2}` ? P2 extends Uncapitalize<P2> ? `${Lowercase<P1>}${SnakeCase<P2>}` : `${Lowercase<P1>}_${SnakeCase<Uncapitalize<P2>>}` : Lowercase<S>;
5
+ /**
6
+ * Converts the keys of `T` to snake_case recursively.
7
+ *
8
+ * This is the return type of the `toSnakeCaseKeys` function. Recurses into
9
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
10
+ * pass through unchanged.
11
+ *
12
+ * @template T - The type whose keys are converted.
13
+ *
14
+ * @example
15
+ * type Request = { userId: number; firstName: string };
16
+ * type Converted = ToSnakeCaseKeys<Request>;
17
+ * // => { user_id: number; first_name: string }
18
+ */
19
+ type ToSnakeCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToSnakeCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as SnakeCase<string & K>]: ToSnakeCaseKeys<T[K]> } : T;
20
+ //#endregion
21
+ export { ToSnakeCaseKeys };
@@ -0,0 +1,21 @@
1
+ import { NonPlainObject } from "../_internal/NonPlainObject.js";
2
+
3
+ //#region src/types/ToSnakeCaseKeys.d.ts
4
+ type SnakeCase<S extends string> = S extends Uppercase<S> ? Lowercase<S> : S extends `${infer P1}${infer P2}` ? P2 extends Uncapitalize<P2> ? `${Lowercase<P1>}${SnakeCase<P2>}` : `${Lowercase<P1>}_${SnakeCase<Uncapitalize<P2>>}` : Lowercase<S>;
5
+ /**
6
+ * Converts the keys of `T` to snake_case recursively.
7
+ *
8
+ * This is the return type of the `toSnakeCaseKeys` function. Recurses into
9
+ * plain objects and arrays; built-in objects like `Date`, `Map`, and functions
10
+ * pass through unchanged.
11
+ *
12
+ * @template T - The type whose keys are converted.
13
+ *
14
+ * @example
15
+ * type Request = { userId: number; firstName: string };
16
+ * type Converted = ToSnakeCaseKeys<Request>;
17
+ * // => { user_id: number; first_name: string }
18
+ */
19
+ type ToSnakeCaseKeys<T> = T extends NonPlainObject ? T : T extends any[] ? Array<ToSnakeCaseKeys<T[number]>> : T extends Record<string, any> ? { [K in keyof T as SnakeCase<string & K>]: ToSnakeCaseKeys<T[K]> } : T;
20
+ //#endregion
21
+ export { ToSnakeCaseKeys };
@@ -1,7 +1,12 @@
1
+ import { ToCamelCaseKeys } from "./ToCamelCaseKeys.mjs";
2
+ import { ToConstantCaseKeys } from "./ToConstantCaseKeys.mjs";
3
+ import { ToKebabCaseKeys } from "./ToKebabCaseKeys.mjs";
4
+ import { ToPascalCaseKeys } from "./ToPascalCaseKeys.mjs";
5
+ import { ToSnakeCaseKeys } from "./ToSnakeCaseKeys.mjs";
1
6
  import { DeepPartial } from "./DeepPartial.mjs";
2
7
  import { DeepReadonly } from "./DeepReadonly.mjs";
3
8
  import { NonEmptyArray } from "./NonEmptyArray.mjs";
4
9
  import { Simplify } from "./Simplify.mjs";
5
10
  import { ValueOf } from "./ValueOf.mjs";
6
11
  import { Writable } from "./Writable.mjs";
7
- export { type DeepPartial, type DeepReadonly, type NonEmptyArray, type Simplify, type ValueOf, type Writable };
12
+ export { type DeepPartial, type DeepReadonly, type NonEmptyArray, type Simplify, type ToCamelCaseKeys, type ToConstantCaseKeys, type ToKebabCaseKeys, type ToPascalCaseKeys, type ToSnakeCaseKeys, type ValueOf, type Writable };
@@ -1,7 +1,12 @@
1
+ import { ToCamelCaseKeys } from "./ToCamelCaseKeys.js";
2
+ import { ToConstantCaseKeys } from "./ToConstantCaseKeys.js";
3
+ import { ToKebabCaseKeys } from "./ToKebabCaseKeys.js";
4
+ import { ToPascalCaseKeys } from "./ToPascalCaseKeys.js";
5
+ import { ToSnakeCaseKeys } from "./ToSnakeCaseKeys.js";
1
6
  import { DeepPartial } from "./DeepPartial.js";
2
7
  import { DeepReadonly } from "./DeepReadonly.js";
3
8
  import { NonEmptyArray } from "./NonEmptyArray.js";
4
9
  import { Simplify } from "./Simplify.js";
5
10
  import { ValueOf } from "./ValueOf.js";
6
11
  import { Writable } from "./Writable.js";
7
- export { type DeepPartial, type DeepReadonly, type NonEmptyArray, type Simplify, type ValueOf, type Writable };
12
+ export { type DeepPartial, type DeepReadonly, type NonEmptyArray, type Simplify, type ToCamelCaseKeys, type ToConstantCaseKeys, type ToKebabCaseKeys, type ToPascalCaseKeys, type ToSnakeCaseKeys, type ValueOf, type Writable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
- "version": "1.50.0",
3
+ "version": "1.51.0-dev.2065+5dc4477f",
4
4
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
5
5
  "homepage": "https://es-toolkit.dev",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
@@ -34,6 +34,16 @@
34
34
  "default": "./dist/array/index.js"
35
35
  }
36
36
  },
37
+ "./bigint": {
38
+ "import": {
39
+ "types": "./dist/bigint/index.d.mts",
40
+ "default": "./dist/bigint/index.mjs"
41
+ },
42
+ "require": {
43
+ "types": "./dist/bigint/index.d.ts",
44
+ "default": "./dist/bigint/index.js"
45
+ }
46
+ },
37
47
  "./compat": {
38
48
  "import": {
39
49
  "types": "./dist/compat/index.d.mts",
@@ -185,10 +195,12 @@
185
195
  "./package.json": "./package.json"
186
196
  },
187
197
  "files": [
198
+ "NOTICE",
188
199
  "dist",
189
200
  "compat",
190
201
  "*.d.ts",
191
202
  "array.js",
203
+ "bigint.js",
192
204
  "compat.js",
193
205
  "error.js",
194
206
  "fp.js",
@@ -206,7 +218,8 @@
206
218
  "workspaces": [
207
219
  "docs",
208
220
  "benchmarks",
209
- "tests/types"
221
+ "tests/types",
222
+ "tests/browser-compat"
210
223
  ],
211
224
  "scripts": {
212
225
  "bench": "yarn workspace benchmarks bench",
@@ -238,6 +251,8 @@
238
251
  "broken-link-checker": "0.7.8",
239
252
  "eslint": "^9.39.2",
240
253
  "eslint-config-prettier": "^9.1.0",
254
+ "eslint-plugin-compat": "^7.0.2",
255
+ "eslint-plugin-es-x": "^10.0.0",
241
256
  "eslint-plugin-no-for-of-array": "^0.0.1",
242
257
  "eslint-plugin-prettier": "^5.2.1",
243
258
  "eslint-plugin-vue": "^9.28.0",
@@ -283,6 +298,16 @@
283
298
  "default": "./dist/array/index.js"
284
299
  }
285
300
  },
301
+ "./bigint": {
302
+ "import": {
303
+ "types": "./dist/bigint/index.d.mts",
304
+ "default": "./dist/bigint/index.mjs"
305
+ },
306
+ "require": {
307
+ "types": "./dist/bigint/index.d.ts",
308
+ "default": "./dist/bigint/index.js"
309
+ }
310
+ },
286
311
  "./compat": {
287
312
  "import": {
288
313
  "types": "./dist/compat/index.d.mts",