es-toolkit 1.13.1-dev.353 → 1.13.1-dev.355

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 (305) hide show
  1. package/dist/_chunk/index-CwRt_M.js +0 -1
  2. package/dist/_chunk/isPlainObject-bK22pA.js +0 -1
  3. package/dist/_chunk/randomInt-CF7bZK.js +0 -1
  4. package/dist/_chunk/union-CdQeDK.js +0 -1
  5. package/dist/array/chunk.mjs +0 -1
  6. package/dist/array/compact.mjs +0 -1
  7. package/dist/array/countBy.mjs +0 -1
  8. package/dist/array/difference.mjs +0 -1
  9. package/dist/array/differenceBy.mjs +0 -1
  10. package/dist/array/differenceWith.mjs +0 -1
  11. package/dist/array/drop.mjs +0 -1
  12. package/dist/array/dropRight.mjs +0 -1
  13. package/dist/array/dropRightWhile.mjs +0 -1
  14. package/dist/array/dropWhile.mjs +0 -1
  15. package/dist/array/fill.mjs +0 -1
  16. package/dist/array/flatMap.mjs +0 -1
  17. package/dist/array/flatten.mjs +0 -1
  18. package/dist/array/flattenDeep.mjs +0 -1
  19. package/dist/array/forEachRight.mjs +0 -1
  20. package/dist/array/groupBy.mjs +0 -1
  21. package/dist/array/head.mjs +0 -1
  22. package/dist/array/index.js +0 -1
  23. package/dist/array/index.mjs +0 -1
  24. package/dist/array/initial.mjs +0 -1
  25. package/dist/array/intersection.mjs +0 -1
  26. package/dist/array/intersectionBy.mjs +0 -1
  27. package/dist/array/intersectionWith.mjs +0 -1
  28. package/dist/array/keyBy.mjs +0 -1
  29. package/dist/array/last.mjs +0 -1
  30. package/dist/array/maxBy.mjs +0 -1
  31. package/dist/array/minBy.mjs +0 -1
  32. package/dist/array/orderBy.mjs +0 -1
  33. package/dist/array/partition.mjs +0 -1
  34. package/dist/array/sample.mjs +0 -1
  35. package/dist/array/sampleSize.mjs +0 -1
  36. package/dist/array/shuffle.mjs +0 -1
  37. package/dist/array/tail.mjs +0 -1
  38. package/dist/array/take.mjs +0 -1
  39. package/dist/array/takeRight.mjs +0 -1
  40. package/dist/array/takeRightWhile.mjs +0 -1
  41. package/dist/array/takeWhile.mjs +0 -1
  42. package/dist/array/toFilled.mjs +0 -1
  43. package/dist/array/union.mjs +0 -1
  44. package/dist/array/unionBy.mjs +0 -1
  45. package/dist/array/unionWith.mjs +0 -1
  46. package/dist/array/uniq.mjs +0 -1
  47. package/dist/array/uniqBy.mjs +0 -1
  48. package/dist/array/uniqWith.mjs +0 -1
  49. package/dist/array/unzip.mjs +0 -1
  50. package/dist/array/unzipWith.mjs +0 -1
  51. package/dist/array/without.mjs +0 -1
  52. package/dist/array/xor.mjs +0 -1
  53. package/dist/array/xorBy.mjs +0 -1
  54. package/dist/array/xorWith.mjs +0 -1
  55. package/dist/array/zip.mjs +0 -1
  56. package/dist/array/zipObject.mjs +0 -1
  57. package/dist/array/zipWith.mjs +0 -1
  58. package/dist/browser.global.js +1 -1
  59. package/dist/browser.global.js.map +1 -1
  60. package/dist/compat/_internal/getTag.mjs +0 -1
  61. package/dist/compat/_internal/identity.mjs +0 -1
  62. package/dist/compat/_internal/isArrayMatch.mjs +0 -1
  63. package/dist/compat/_internal/isDeepKey.mjs +0 -1
  64. package/dist/compat/_internal/isIndex.mjs +0 -1
  65. package/dist/compat/_internal/isMapMatch.mjs +0 -1
  66. package/dist/compat/_internal/isSetMatch.mjs +0 -1
  67. package/dist/compat/_internal/toPath.mjs +0 -1
  68. package/dist/compat/array/chunk.mjs +0 -1
  69. package/dist/compat/array/concat.mjs +0 -1
  70. package/dist/compat/array/difference.mjs +0 -1
  71. package/dist/compat/array/fill.mjs +0 -1
  72. package/dist/compat/array/zipObjectDeep.mjs +0 -1
  73. package/dist/compat/index.js +0 -1
  74. package/dist/compat/index.mjs +0 -1
  75. package/dist/compat/math/max.mjs +0 -1
  76. package/dist/compat/math/min.mjs +0 -1
  77. package/dist/compat/object/get.mjs +0 -1
  78. package/dist/compat/object/mapKeys.mjs +0 -1
  79. package/dist/compat/object/property.mjs +0 -1
  80. package/dist/compat/object/set.mjs +0 -1
  81. package/dist/compat/predicate/isArray.mjs +0 -1
  82. package/dist/compat/predicate/isMatch.mjs +0 -1
  83. package/dist/compat/predicate/isPlainObject.mjs +0 -1
  84. package/dist/compat/predicate/isTypedArray.mjs +0 -1
  85. package/dist/compat/predicate/matches.mjs +0 -1
  86. package/dist/compat/string/endsWith.mjs +0 -1
  87. package/dist/compat/string/startsWith.mjs +0 -1
  88. package/dist/error/AbortError.mjs +0 -1
  89. package/dist/error/TimeoutError.mjs +0 -1
  90. package/dist/function/after.mjs +0 -1
  91. package/dist/function/before.mjs +0 -1
  92. package/dist/function/debounce.mjs +0 -1
  93. package/dist/function/index.js +0 -1
  94. package/dist/function/index.mjs +0 -1
  95. package/dist/function/negate.mjs +0 -1
  96. package/dist/function/noop.mjs +0 -1
  97. package/dist/function/once.mjs +0 -1
  98. package/dist/function/throttle.mjs +0 -1
  99. package/dist/index.js +0 -1
  100. package/dist/index.mjs +0 -1
  101. package/dist/math/clamp.mjs +0 -1
  102. package/dist/math/inRange.mjs +0 -1
  103. package/dist/math/index.js +0 -1
  104. package/dist/math/index.mjs +0 -1
  105. package/dist/math/mean.mjs +0 -1
  106. package/dist/math/meanBy.mjs +0 -1
  107. package/dist/math/random.mjs +0 -1
  108. package/dist/math/randomInt.mjs +0 -1
  109. package/dist/math/range.mjs +0 -1
  110. package/dist/math/round.mjs +0 -1
  111. package/dist/math/sum.mjs +0 -1
  112. package/dist/math/sumBy.mjs +0 -1
  113. package/dist/object/clone.mjs +0 -1
  114. package/dist/object/cloneDeep.mjs +0 -1
  115. package/dist/object/flattenObject.mjs +0 -1
  116. package/dist/object/index.js +0 -1
  117. package/dist/object/index.mjs +0 -1
  118. package/dist/object/invert.mjs +0 -1
  119. package/dist/object/mapKeys.mjs +0 -1
  120. package/dist/object/mapValues.mjs +0 -1
  121. package/dist/object/omit.mjs +0 -1
  122. package/dist/object/omitBy.mjs +0 -1
  123. package/dist/object/pick.mjs +0 -1
  124. package/dist/object/pickBy.mjs +0 -1
  125. package/dist/predicate/index.js +0 -1
  126. package/dist/predicate/index.mjs +0 -1
  127. package/dist/predicate/isArguments.mjs +0 -1
  128. package/dist/predicate/isArrayLike.mjs +0 -1
  129. package/dist/predicate/isEqual.mjs +0 -1
  130. package/dist/predicate/isFunction.mjs +0 -1
  131. package/dist/predicate/isLength.mjs +0 -1
  132. package/dist/predicate/isNil.mjs +0 -1
  133. package/dist/predicate/isNotNil.mjs +0 -1
  134. package/dist/predicate/isNull.mjs +0 -1
  135. package/dist/predicate/isObjectLike.mjs +0 -1
  136. package/dist/predicate/isPlainObject.mjs +0 -1
  137. package/dist/predicate/isPrimitive.mjs +0 -1
  138. package/dist/predicate/isTypedArray.mjs +0 -1
  139. package/dist/predicate/isUndefined.mjs +0 -1
  140. package/dist/promise/delay.mjs +0 -1
  141. package/dist/promise/index.js +0 -1
  142. package/dist/promise/index.mjs +0 -1
  143. package/dist/promise/timeout.mjs +0 -1
  144. package/dist/promise/withTimeout.mjs +0 -1
  145. package/dist/string/_internal/getWords.mjs +0 -1
  146. package/dist/string/camelCase.mjs +0 -1
  147. package/dist/string/capitalize.mjs +0 -1
  148. package/dist/string/index.js +0 -1
  149. package/dist/string/index.mjs +0 -1
  150. package/dist/string/kebabCase.mjs +0 -1
  151. package/dist/string/lowerCase.mjs +0 -1
  152. package/dist/string/snakeCase.mjs +0 -1
  153. package/dist/string/startCase.mjs +0 -1
  154. package/package.json +1 -1
  155. package/dist/_chunk/index-CwRt_M.js.map +0 -1
  156. package/dist/_chunk/isPlainObject-bK22pA.js.map +0 -1
  157. package/dist/_chunk/randomInt-CF7bZK.js.map +0 -1
  158. package/dist/_chunk/union-CdQeDK.js.map +0 -1
  159. package/dist/array/chunk.mjs.map +0 -1
  160. package/dist/array/compact.mjs.map +0 -1
  161. package/dist/array/countBy.mjs.map +0 -1
  162. package/dist/array/difference.mjs.map +0 -1
  163. package/dist/array/differenceBy.mjs.map +0 -1
  164. package/dist/array/differenceWith.mjs.map +0 -1
  165. package/dist/array/drop.mjs.map +0 -1
  166. package/dist/array/dropRight.mjs.map +0 -1
  167. package/dist/array/dropRightWhile.mjs.map +0 -1
  168. package/dist/array/dropWhile.mjs.map +0 -1
  169. package/dist/array/fill.mjs.map +0 -1
  170. package/dist/array/flatMap.mjs.map +0 -1
  171. package/dist/array/flatten.mjs.map +0 -1
  172. package/dist/array/flattenDeep.mjs.map +0 -1
  173. package/dist/array/forEachRight.mjs.map +0 -1
  174. package/dist/array/groupBy.mjs.map +0 -1
  175. package/dist/array/head.mjs.map +0 -1
  176. package/dist/array/index.js.map +0 -1
  177. package/dist/array/index.mjs.map +0 -1
  178. package/dist/array/initial.mjs.map +0 -1
  179. package/dist/array/intersection.mjs.map +0 -1
  180. package/dist/array/intersectionBy.mjs.map +0 -1
  181. package/dist/array/intersectionWith.mjs.map +0 -1
  182. package/dist/array/keyBy.mjs.map +0 -1
  183. package/dist/array/last.mjs.map +0 -1
  184. package/dist/array/maxBy.mjs.map +0 -1
  185. package/dist/array/minBy.mjs.map +0 -1
  186. package/dist/array/orderBy.mjs.map +0 -1
  187. package/dist/array/partition.mjs.map +0 -1
  188. package/dist/array/sample.mjs.map +0 -1
  189. package/dist/array/sampleSize.mjs.map +0 -1
  190. package/dist/array/shuffle.mjs.map +0 -1
  191. package/dist/array/tail.mjs.map +0 -1
  192. package/dist/array/take.mjs.map +0 -1
  193. package/dist/array/takeRight.mjs.map +0 -1
  194. package/dist/array/takeRightWhile.mjs.map +0 -1
  195. package/dist/array/takeWhile.mjs.map +0 -1
  196. package/dist/array/toFilled.mjs.map +0 -1
  197. package/dist/array/union.mjs.map +0 -1
  198. package/dist/array/unionBy.mjs.map +0 -1
  199. package/dist/array/unionWith.mjs.map +0 -1
  200. package/dist/array/uniq.mjs.map +0 -1
  201. package/dist/array/uniqBy.mjs.map +0 -1
  202. package/dist/array/uniqWith.mjs.map +0 -1
  203. package/dist/array/unzip.mjs.map +0 -1
  204. package/dist/array/unzipWith.mjs.map +0 -1
  205. package/dist/array/without.mjs.map +0 -1
  206. package/dist/array/xor.mjs.map +0 -1
  207. package/dist/array/xorBy.mjs.map +0 -1
  208. package/dist/array/xorWith.mjs.map +0 -1
  209. package/dist/array/zip.mjs.map +0 -1
  210. package/dist/array/zipObject.mjs.map +0 -1
  211. package/dist/array/zipWith.mjs.map +0 -1
  212. package/dist/compat/_internal/getTag.mjs.map +0 -1
  213. package/dist/compat/_internal/identity.mjs.map +0 -1
  214. package/dist/compat/_internal/isArrayMatch.mjs.map +0 -1
  215. package/dist/compat/_internal/isDeepKey.mjs.map +0 -1
  216. package/dist/compat/_internal/isIndex.mjs.map +0 -1
  217. package/dist/compat/_internal/isMapMatch.mjs.map +0 -1
  218. package/dist/compat/_internal/isSetMatch.mjs.map +0 -1
  219. package/dist/compat/_internal/toPath.mjs.map +0 -1
  220. package/dist/compat/array/chunk.mjs.map +0 -1
  221. package/dist/compat/array/concat.mjs.map +0 -1
  222. package/dist/compat/array/difference.mjs.map +0 -1
  223. package/dist/compat/array/fill.mjs.map +0 -1
  224. package/dist/compat/array/zipObjectDeep.mjs.map +0 -1
  225. package/dist/compat/index.js.map +0 -1
  226. package/dist/compat/index.mjs.map +0 -1
  227. package/dist/compat/math/max.mjs.map +0 -1
  228. package/dist/compat/math/min.mjs.map +0 -1
  229. package/dist/compat/object/get.mjs.map +0 -1
  230. package/dist/compat/object/mapKeys.mjs.map +0 -1
  231. package/dist/compat/object/property.mjs.map +0 -1
  232. package/dist/compat/object/set.mjs.map +0 -1
  233. package/dist/compat/predicate/isArray.mjs.map +0 -1
  234. package/dist/compat/predicate/isMatch.mjs.map +0 -1
  235. package/dist/compat/predicate/isPlainObject.mjs.map +0 -1
  236. package/dist/compat/predicate/isTypedArray.mjs.map +0 -1
  237. package/dist/compat/predicate/matches.mjs.map +0 -1
  238. package/dist/compat/string/endsWith.mjs.map +0 -1
  239. package/dist/compat/string/startsWith.mjs.map +0 -1
  240. package/dist/error/AbortError.mjs.map +0 -1
  241. package/dist/error/TimeoutError.mjs.map +0 -1
  242. package/dist/function/after.mjs.map +0 -1
  243. package/dist/function/before.mjs.map +0 -1
  244. package/dist/function/debounce.mjs.map +0 -1
  245. package/dist/function/index.js.map +0 -1
  246. package/dist/function/index.mjs.map +0 -1
  247. package/dist/function/negate.mjs.map +0 -1
  248. package/dist/function/noop.mjs.map +0 -1
  249. package/dist/function/once.mjs.map +0 -1
  250. package/dist/function/throttle.mjs.map +0 -1
  251. package/dist/index.js.map +0 -1
  252. package/dist/index.mjs.map +0 -1
  253. package/dist/math/clamp.mjs.map +0 -1
  254. package/dist/math/inRange.mjs.map +0 -1
  255. package/dist/math/index.js.map +0 -1
  256. package/dist/math/index.mjs.map +0 -1
  257. package/dist/math/mean.mjs.map +0 -1
  258. package/dist/math/meanBy.mjs.map +0 -1
  259. package/dist/math/random.mjs.map +0 -1
  260. package/dist/math/randomInt.mjs.map +0 -1
  261. package/dist/math/range.mjs.map +0 -1
  262. package/dist/math/round.mjs.map +0 -1
  263. package/dist/math/sum.mjs.map +0 -1
  264. package/dist/math/sumBy.mjs.map +0 -1
  265. package/dist/object/clone.mjs.map +0 -1
  266. package/dist/object/cloneDeep.mjs.map +0 -1
  267. package/dist/object/flattenObject.mjs.map +0 -1
  268. package/dist/object/index.js.map +0 -1
  269. package/dist/object/index.mjs.map +0 -1
  270. package/dist/object/invert.mjs.map +0 -1
  271. package/dist/object/mapKeys.mjs.map +0 -1
  272. package/dist/object/mapValues.mjs.map +0 -1
  273. package/dist/object/omit.mjs.map +0 -1
  274. package/dist/object/omitBy.mjs.map +0 -1
  275. package/dist/object/pick.mjs.map +0 -1
  276. package/dist/object/pickBy.mjs.map +0 -1
  277. package/dist/predicate/index.js.map +0 -1
  278. package/dist/predicate/index.mjs.map +0 -1
  279. package/dist/predicate/isArguments.mjs.map +0 -1
  280. package/dist/predicate/isArrayLike.mjs.map +0 -1
  281. package/dist/predicate/isEqual.mjs.map +0 -1
  282. package/dist/predicate/isFunction.mjs.map +0 -1
  283. package/dist/predicate/isLength.mjs.map +0 -1
  284. package/dist/predicate/isNil.mjs.map +0 -1
  285. package/dist/predicate/isNotNil.mjs.map +0 -1
  286. package/dist/predicate/isNull.mjs.map +0 -1
  287. package/dist/predicate/isObjectLike.mjs.map +0 -1
  288. package/dist/predicate/isPlainObject.mjs.map +0 -1
  289. package/dist/predicate/isPrimitive.mjs.map +0 -1
  290. package/dist/predicate/isTypedArray.mjs.map +0 -1
  291. package/dist/predicate/isUndefined.mjs.map +0 -1
  292. package/dist/promise/delay.mjs.map +0 -1
  293. package/dist/promise/index.js.map +0 -1
  294. package/dist/promise/index.mjs.map +0 -1
  295. package/dist/promise/timeout.mjs.map +0 -1
  296. package/dist/promise/withTimeout.mjs.map +0 -1
  297. package/dist/string/_internal/getWords.mjs.map +0 -1
  298. package/dist/string/camelCase.mjs.map +0 -1
  299. package/dist/string/capitalize.mjs.map +0 -1
  300. package/dist/string/index.js.map +0 -1
  301. package/dist/string/index.mjs.map +0 -1
  302. package/dist/string/kebabCase.mjs.map +0 -1
  303. package/dist/string/lowerCase.mjs.map +0 -1
  304. package/dist/string/snakeCase.mjs.map +0 -1
  305. package/dist/string/startCase.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"clone.mjs","sources":["../../src/object/clone.ts"],"sourcesContent":["/**\n * Creates a shallow clone of the given object.\n *\n * @template T - The type of the object.\n * @param {T} obj - The object to clone.\n * @returns {T} - A shallow clone of the given object.\n *\n * @example\n * // Clone a primitive values\n * const num = 29;\n * const clonedNum = clone(num);\n * console.log(clonedNum); // 29\n * console.log(clonedNum === num) ; // true\n *\n * @example\n * // Clone an array\n * const arr = [1, 2, 3];\n * const clonedArr = clone(arr);\n * console.log(clonedArr); // [1, 2, 3]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an object\n * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };\n * const clonedObj = clone(obj);\n * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }\n * console.log(clonedObj === obj); // false\n */\nexport function clone<T>(obj: T): T {\n if (isPrimitive(obj)) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.slice() as T;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as T;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as T;\n }\n\n if (obj instanceof Map) {\n const result = new Map();\n for (const [key, value] of obj) {\n result.set(key, value);\n }\n return result as T;\n }\n\n if (obj instanceof Set) {\n const result = new Set();\n for (const value of obj) {\n result.add(value);\n }\n return result as T;\n }\n\n if (typeof obj === 'object') {\n const prototype = Object.getPrototypeOf(obj);\n const result = Object.create(prototype)\n return Object.assign(result, obj);\n }\n return obj;\n}\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\n\nfunction isPrimitive(value: unknown): value is Primitive {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n"],"names":[],"mappings":"AA4BM,SAAU,KAAK,CAAI,GAAM,EAAA;AAC7B,IAAA,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE;AACpB,QAAA,OAAO,GAAG,CAAC;KACZ;AAED,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;AACtB,QAAA,OAAO,GAAG,CAAC,KAAK,EAAO,CAAC;KACzB;AAED,IAAA,IAAI,GAAG,YAAY,IAAI,EAAE;QACvB,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAM,CAAC;KACrC;AAED,IAAA,IAAI,GAAG,YAAY,MAAM,EAAE;QACzB,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAM,CAAC;KAC/C;AAED,IAAA,IAAI,GAAG,YAAY,GAAG,EAAE;AACtB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,GAAG,EAAE;AAC9B,YAAA,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACxB;AACD,QAAA,OAAO,MAAW,CAAC;KACpB;AAED,IAAA,IAAI,GAAG,YAAY,GAAG,EAAE;AACtB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;AACzB,QAAA,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE;AACvB,YAAA,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACnB;AACD,QAAA,OAAO,MAAW,CAAC;KACpB;AAED,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QACvC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACnC;AACD,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;AAID,SAAS,WAAW,CAAC,KAAc,EAAA;AACjC,IAAA,OAAO,KAAK,IAAI,IAAI,KAAK,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC;AACrF;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloneDeep.mjs","sources":["../../src/object/cloneDeep.ts"],"sourcesContent":["/**\n * Creates a deep clone of the given object.\n *\n * @template T - The type of the object.\n * @param {T} obj - The object to clone.\n * @returns {T} - A deep clone of the given object.\n *\n * @example\n * // Clone a primitive values\n * const num = 29;\n * const clonedNum = clone(num);\n * console.log(clonedNum); // 29\n * console.log(clonedNum === num) ; // true\n *\n * @example\n * // Clone an array\n * const arr = [1, 2, 3];\n * const clonedArr = clone(arr);\n * console.log(clonedArr); // [1, 2, 3]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an array with nested objects\n * const arr = [1, { a: 1 }, [1, 2, 3]];\n * const clonedArr = clone(arr);\n * arr[1].a = 2;\n * console.log(arr); // [2, { a: 2 }, [1, 2, 3]]\n * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an object\n * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };\n * const clonedObj = clone(obj);\n * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }\n * console.log(clonedObj === obj); // false\n *\n * @example\n * // Clone an object with nested objects\n * const obj = { a: 1, b: { c: 1 } };\n * const clonedObj = clone(obj);\n * obj.b.c = 2;\n * console.log(obj); // { a: 1, b: { c: 2 } }\n * console.log(clonedObj); // { a: 1, b: { c: 1 } }\n * console.log(clonedObj === obj); // false\n */\nexport function cloneDeep<T>(obj: T): Resolved<T> {\n if (isPrimitive(obj)) {\n return obj as Resolved<T>;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => cloneDeep(item)) as Resolved<T>;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as Resolved<T>;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as Resolved<T>;\n }\n\n if (obj instanceof Map) {\n const result = new Map();\n for (const [key, value] of obj.entries()) {\n result.set(key, cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof Set) {\n const result = new Set();\n for (const value of obj.values()) {\n result.add(cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (isTypedArray(obj)) {\n const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);\n for (let i = 0; i < obj.length; i++) {\n result[i] = cloneDeep(obj[i]);\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof ArrayBuffer || (typeof SharedArrayBuffer !== 'undefined' && obj instanceof SharedArrayBuffer)) {\n return obj.slice(0) as Resolved<T>;\n }\n\n if (obj instanceof DataView) {\n const result = new DataView(obj.buffer.slice(0));\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n // For legacy NodeJS support\n if (typeof File !== 'undefined' && obj instanceof File) {\n const result = new File([obj], obj.name, { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Blob) {\n const result = new Blob([obj], { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Error) {\n const result = new (obj.constructor as { new(): Error })();\n result.message = obj.message;\n result.name = obj.name;\n result.stack = obj.stack;\n result.cause = obj.cause;\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const result = {};\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n return obj as Resolved<T>;\n}\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\nfunction isPrimitive(value: unknown): value is Primitive {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n\n// eslint-disable-next-line\nfunction cloneDeepHelper(obj: any, clonedObj: any): void {\n const keys = Object.keys(obj);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const descriptor = Object.getOwnPropertyDescriptor(obj, key);\n\n if ((descriptor?.writable || descriptor?.set)) {\n clonedObj[key] = cloneDeep(obj[key]);\n }\n }\n}\n\nfunction isTypedArray(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n obj: any\n): obj is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n obj instanceof Uint8Array ||\n obj instanceof Uint8ClampedArray ||\n obj instanceof Uint16Array ||\n obj instanceof Uint32Array ||\n obj instanceof BigUint64Array ||\n obj instanceof Int8Array ||\n obj instanceof Int16Array ||\n obj instanceof Int32Array ||\n obj instanceof BigInt64Array ||\n obj instanceof Float32Array ||\n obj instanceof Float64Array\n );\n}\n\nexport type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;\n\ntype Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;\n\ntype ResolvedMain<T> = T extends [never]\n ? never // (special trick for jsonable | null) type\n : ValueOf<T> extends boolean | number | bigint | string\n ? ValueOf<T>\n : T extends (...args: any[]) => any\n ? never\n : T extends object\n ? ResolvedObject<T>\n : ValueOf<T>;\n\ntype ResolvedObject<T extends object> =\n T extends Array<infer U>\n ? IsTuple<T> extends true\n ? ResolvedTuple<T>\n : Array<ResolvedMain<U>>\n : T extends Set<infer U>\n ? Set<ResolvedMain<U>>\n : T extends Map<infer K, infer V>\n ? Map<ResolvedMain<K>, ResolvedMain<V>>\n : T extends WeakSet<any> | WeakMap<any, any>\n ? never\n : T extends\n | Date\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array\n | ArrayBuffer\n | SharedArrayBuffer\n | DataView\n | Blob\n | File\n ? T\n : {\n [P in keyof T]: ResolvedMain<T[P]>;\n };\n\ntype ResolvedTuple<T extends readonly any[]> = T extends []\n ? []\n : T extends [infer F]\n ? [ResolvedMain<F>]\n : T extends [infer F, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]\n : T extends [(infer F)?]\n ? [ResolvedMain<F>?]\n : T extends [(infer F)?, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]\n : [];\n\ntype IsTuple<T extends readonly any[] | { length: number }> = [T] extends [never]\n ? false\n : T extends readonly any[]\n ? number extends T['length']\n ? false\n : true\n : false;\n\ntype ValueOf<Instance> =\n IsValueOf<Instance, boolean> extends true\n ? boolean\n : IsValueOf<Instance, number> extends true\n ? number\n : IsValueOf<Instance, string> extends true\n ? string\n : Instance;\n\ntype IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O\n ? O extends IValueOf<infer Primitive>\n ? Instance extends Primitive\n ? false\n : true // not Primitive, but Object\n : false // cannot be\n : false;\n\ninterface IValueOf<T> {\n valueOf(): T;\n}\n"],"names":[],"mappings":"AA8CM,SAAU,SAAS,CAAI,GAAM,EAAA;AACjC,IAAA,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE;AACpB,QAAA,OAAO,GAAkB,CAAC;KAC3B;AAED,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;AACtB,QAAA,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,CAAgB,CAAC;KACxD;AAED,IAAA,IAAI,GAAG,YAAY,IAAI,EAAE;QACvB,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAgB,CAAC;KAC/C;AAED,IAAA,IAAI,GAAG,YAAY,MAAM,EAAE;QACzB,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAgB,CAAC;KACzD;AAED,IAAA,IAAI,GAAG,YAAY,GAAG,EAAE;AACtB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;AACzB,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE;YACxC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SACnC;AACD,QAAA,OAAO,MAAqB,CAAC;KAC9B;AAED,IAAA,IAAI,GAAG,YAAY,GAAG,EAAE;AACtB,QAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE;YAChC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;SAC9B;AACD,QAAA,OAAO,MAAqB,CAAC;KAC9B;AAED,IAAA,IAAI,YAAY,CAAC,GAA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CAAC,CAAC;QACpB,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAE7D,KAAK,UAAU,EAAE,QAAQ,IAAI,UAAU,EAAE,GAAG,GAAG;YAC7C,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SACtC;KACF;AACH,CAAC;AAED,SAAS,YAAY,CAEnB,GAAQ,EAAA;IAaR,QACE,GAAG,YAAY,UAAU;AACzB,QAAA,GAAG,YAAY,iBAAiB;AAChC,QAAA,GAAG,YAAY,WAAW;AAC1B,QAAA,GAAG,YAAY,WAAW;AAC1B,QAAA,GAAG,YAAY,cAAc;AAC7B,QAAA,GAAG,YAAY,SAAS;AACxB,QAAA,GAAG,YAAY,UAAU;AACzB,QAAA,GAAG,YAAY,UAAU;AACzB,QAAA,GAAG,YAAY,aAAa;AAC5B,QAAA,GAAG,YAAY,YAAY;QAC3B,GAAG,YAAY,YAAY,EAC3B;AACJ;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"flattenObject.mjs","sources":["../../src/object/flattenObject.ts"],"sourcesContent":["import { isPlainObject } from \"../predicate/isPlainObject.ts\";\n\n/**\n * Flattens a nested object into a single level object with dot-separated keys.\n * \n * @param {object} object - The object to flatten.\n * @returns {Record<string, any>} - The flattened object.\n * \n * @example\n * const nestedObject = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: [2, 3]\n * };\n * \n * const flattened = flattenObject(nestedObject);\n * console.log(flattened); \n * // Output:\n * // {\n * // 'a.b.c': 1,\n * // 'd.0': 2,\n * // 'd.1': 3\n * // }\n */\nexport function flattenObject(object: object): Record<string, any> {\n return flattenObjectImpl(object);\n}\n\nfunction flattenObjectImpl(object: object, prefix = ''): Record<string, any> {\n const result: Record<string, any> = {};\n const keys = Object.keys(object);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = (object as any)[key];\n\n const prefixedKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(value) && Object.keys(value).length > 0) {\n Object.assign(result, flattenObjectImpl(value, prefixedKey));\n continue;\n }\n\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) {\n result[`${prefixedKey}.${index}`] = value[index];\n }\n continue;\n }\n\n result[prefixedKey] = value;\n }\n\n return result;\n}"],"names":[],"mappings":";;AA2BM,SAAU,aAAa,CAAC,MAAc,EAAA;AAC1C,IAAA,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc,EAAE,MAAM,GAAG,EAAE,EAAA;IACpD,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEjC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,QAAA,MAAM,KAAK,GAAI,MAAc,CAAC,GAAG,CAAC,CAAC;AAEnC,QAAA,MAAM,WAAW,GAAG,MAAM,GAAG,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,GAAG,CAAE,CAAA,GAAG,GAAG,CAAC;AAEtD,QAAA,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AACzD,YAAA,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;YAC7D,SAAS;SACV;AAED,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACxB,YAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;AACjD,gBAAA,MAAM,CAAC,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;aAClD;YACD,SAAS;SACV;AAED,QAAA,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;KAC7B;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/object/omit.ts","../../src/object/omitBy.ts","../../src/object/pick.ts","../../src/object/pickBy.ts","../../src/object/invert.ts","../../src/object/clone.ts","../../src/object/flattenObject.ts","../../src/object/mapKeys.ts","../../src/object/mapValues.ts","../../src/object/cloneDeep.ts"],"sourcesContent":["/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n","/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n","/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n","/**\n * Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.\n *\n * This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values,\n * the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping\n * of the input object's key-value pairs.\n *\n * @template K - Type of the keys in the input object (string, number, symbol)\n * @template V - Type of the values in the input object (string, number, symbol)\n * @param {Record<K, V>} obj - The input object whose keys and values are to be inverted\n * @returns {{ [key in V]: K }} - A new object with keys and values inverted\n *\n * @example\n * invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' }\n * invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' }\n * invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }\n * invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }\n */\nexport function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {\n const result = {} as { [key in V]: K };\n\n const keys = Object.keys(obj) as K[];\n \n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = obj[key];\n result[value] = key;\n }\n\n return result;\n}\n","/**\n * Creates a shallow clone of the given object.\n *\n * @template T - The type of the object.\n * @param {T} obj - The object to clone.\n * @returns {T} - A shallow clone of the given object.\n *\n * @example\n * // Clone a primitive values\n * const num = 29;\n * const clonedNum = clone(num);\n * console.log(clonedNum); // 29\n * console.log(clonedNum === num) ; // true\n *\n * @example\n * // Clone an array\n * const arr = [1, 2, 3];\n * const clonedArr = clone(arr);\n * console.log(clonedArr); // [1, 2, 3]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an object\n * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };\n * const clonedObj = clone(obj);\n * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }\n * console.log(clonedObj === obj); // false\n */\nexport function clone<T>(obj: T): T {\n if (isPrimitive(obj)) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.slice() as T;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as T;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as T;\n }\n\n if (obj instanceof Map) {\n const result = new Map();\n for (const [key, value] of obj) {\n result.set(key, value);\n }\n return result as T;\n }\n\n if (obj instanceof Set) {\n const result = new Set();\n for (const value of obj) {\n result.add(value);\n }\n return result as T;\n }\n\n if (typeof obj === 'object') {\n const prototype = Object.getPrototypeOf(obj);\n const result = Object.create(prototype)\n return Object.assign(result, obj);\n }\n return obj;\n}\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\n\nfunction isPrimitive(value: unknown): value is Primitive {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n","import { isPlainObject } from \"../predicate/isPlainObject.ts\";\n\n/**\n * Flattens a nested object into a single level object with dot-separated keys.\n * \n * @param {object} object - The object to flatten.\n * @returns {Record<string, any>} - The flattened object.\n * \n * @example\n * const nestedObject = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: [2, 3]\n * };\n * \n * const flattened = flattenObject(nestedObject);\n * console.log(flattened); \n * // Output:\n * // {\n * // 'a.b.c': 1,\n * // 'd.0': 2,\n * // 'd.1': 3\n * // }\n */\nexport function flattenObject(object: object): Record<string, any> {\n return flattenObjectImpl(object);\n}\n\nfunction flattenObjectImpl(object: object, prefix = ''): Record<string, any> {\n const result: Record<string, any> = {};\n const keys = Object.keys(object);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = (object as any)[key];\n\n const prefixedKey = prefix ? `${prefix}.${key}` : key;\n\n if (isPlainObject(value) && Object.keys(value).length > 0) {\n Object.assign(result, flattenObjectImpl(value, prefixedKey));\n continue;\n }\n\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) {\n result[`${prefixedKey}.${index}`] = value[index];\n }\n continue;\n }\n\n result[prefixedKey] = value;\n }\n\n return result;\n}","/**\n * Creates a new object with the same values as the given object, but with keys generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the keys in the object.\n * @template K2 - The type of the new keys generated by the iteratee function.\n *\n * @param {T} object - The object to iterate over.\n * @param {(value: T[K1], key: K1, object: T) => K2} getNewKey - The function invoked per own enumerable property.\n * @returns {Record<K2, T[K1]>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapKeys(obj, (value, key) => key + value);\n * console.log(result); // { a1: 1, b2: 2 }\n */\nexport function mapKeys<T extends {}, K1 extends keyof T, K2 extends PropertyKey>(\n object: T,\n getNewKey: (value: T[K1], key: K1, object: T) => K2\n): Record<K2, T[K1]> {\n const result = {} as Record<K2, T[K1]>;\n const keys = Object.keys(object);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i] as K1;\n const value = object[key];\n\n result[getNewKey(value, key, object)] = value as any;\n }\n\n return result;\n}\n","/**\n * Creates a new object with the same keys as the given object, but with values generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K - The type of the keys in the object.\n * @template V - The type of the new values generated by the iteratee function.\n *\n * @param {T} object - The object to iterate over.\n * @param {(value: T[K], key: K, object: T) => V} getNewValue - The function invoked per own enumerable property.\n * @returns {Record<K, V>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapValues(obj, (value) => value * 2);\n * console.log(result); // { a: 2, b: 4 }\n */\nexport function mapValues<T extends Record<PropertyKey, unknown>, K extends keyof T, V>(\n object: T,\n getNewValue: (value: T[K], key: K, object: T) => V\n): Record<K, V> {\n const result = {} as Record<K, V>;\n const keys = Object.keys(object);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i] as K;\n const value = object[key];\n\n result[key] = getNewValue(value, key, object);\n }\n\n return result;\n}\n","/**\n * Creates a deep clone of the given object.\n *\n * @template T - The type of the object.\n * @param {T} obj - The object to clone.\n * @returns {T} - A deep clone of the given object.\n *\n * @example\n * // Clone a primitive values\n * const num = 29;\n * const clonedNum = clone(num);\n * console.log(clonedNum); // 29\n * console.log(clonedNum === num) ; // true\n *\n * @example\n * // Clone an array\n * const arr = [1, 2, 3];\n * const clonedArr = clone(arr);\n * console.log(clonedArr); // [1, 2, 3]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an array with nested objects\n * const arr = [1, { a: 1 }, [1, 2, 3]];\n * const clonedArr = clone(arr);\n * arr[1].a = 2;\n * console.log(arr); // [2, { a: 2 }, [1, 2, 3]]\n * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]\n * console.log(clonedArr === arr); // false\n *\n * @example\n * // Clone an object\n * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };\n * const clonedObj = clone(obj);\n * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }\n * console.log(clonedObj === obj); // false\n *\n * @example\n * // Clone an object with nested objects\n * const obj = { a: 1, b: { c: 1 } };\n * const clonedObj = clone(obj);\n * obj.b.c = 2;\n * console.log(obj); // { a: 1, b: { c: 2 } }\n * console.log(clonedObj); // { a: 1, b: { c: 1 } }\n * console.log(clonedObj === obj); // false\n */\nexport function cloneDeep<T>(obj: T): Resolved<T> {\n if (isPrimitive(obj)) {\n return obj as Resolved<T>;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(item => cloneDeep(item)) as Resolved<T>;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as Resolved<T>;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as Resolved<T>;\n }\n\n if (obj instanceof Map) {\n const result = new Map();\n for (const [key, value] of obj.entries()) {\n result.set(key, cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof Set) {\n const result = new Set();\n for (const value of obj.values()) {\n result.add(cloneDeep(value));\n }\n return result as Resolved<T>;\n }\n\n if (isTypedArray(obj)) {\n const result = new (Object.getPrototypeOf(obj).constructor)(obj.length);\n for (let i = 0; i < obj.length; i++) {\n result[i] = cloneDeep(obj[i]);\n }\n return result as Resolved<T>;\n }\n\n if (obj instanceof ArrayBuffer || (typeof SharedArrayBuffer !== 'undefined' && obj instanceof SharedArrayBuffer)) {\n return obj.slice(0) as Resolved<T>;\n }\n\n if (obj instanceof DataView) {\n const result = new DataView(obj.buffer.slice(0));\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n // For legacy NodeJS support\n if (typeof File !== 'undefined' && obj instanceof File) {\n const result = new File([obj], obj.name, { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Blob) {\n const result = new Blob([obj], { type: obj.type });\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (obj instanceof Error) {\n const result = new (obj.constructor as { new(): Error })();\n result.message = obj.message;\n result.name = obj.name;\n result.stack = obj.stack;\n result.cause = obj.cause;\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const result = {};\n cloneDeepHelper(obj, result);\n return result as Resolved<T>;\n }\n\n return obj as Resolved<T>;\n}\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint;\nfunction isPrimitive(value: unknown): value is Primitive {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n\n// eslint-disable-next-line\nfunction cloneDeepHelper(obj: any, clonedObj: any): void {\n const keys = Object.keys(obj);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const descriptor = Object.getOwnPropertyDescriptor(obj, key);\n\n if ((descriptor?.writable || descriptor?.set)) {\n clonedObj[key] = cloneDeep(obj[key]);\n }\n }\n}\n\nfunction isTypedArray(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n obj: any\n): obj is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n obj instanceof Uint8Array ||\n obj instanceof Uint8ClampedArray ||\n obj instanceof Uint16Array ||\n obj instanceof Uint32Array ||\n obj instanceof BigUint64Array ||\n obj instanceof Int8Array ||\n obj instanceof Int16Array ||\n obj instanceof Int32Array ||\n obj instanceof BigInt64Array ||\n obj instanceof Float32Array ||\n obj instanceof Float64Array\n );\n}\n\nexport type Resolved<T> = Equal<T, ResolvedMain<T>> extends true ? T : ResolvedMain<T>;\n\ntype Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;\n\ntype ResolvedMain<T> = T extends [never]\n ? never // (special trick for jsonable | null) type\n : ValueOf<T> extends boolean | number | bigint | string\n ? ValueOf<T>\n : T extends (...args: any[]) => any\n ? never\n : T extends object\n ? ResolvedObject<T>\n : ValueOf<T>;\n\ntype ResolvedObject<T extends object> =\n T extends Array<infer U>\n ? IsTuple<T> extends true\n ? ResolvedTuple<T>\n : Array<ResolvedMain<U>>\n : T extends Set<infer U>\n ? Set<ResolvedMain<U>>\n : T extends Map<infer K, infer V>\n ? Map<ResolvedMain<K>, ResolvedMain<V>>\n : T extends WeakSet<any> | WeakMap<any, any>\n ? never\n : T extends\n | Date\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array\n | ArrayBuffer\n | SharedArrayBuffer\n | DataView\n | Blob\n | File\n ? T\n : {\n [P in keyof T]: ResolvedMain<T[P]>;\n };\n\ntype ResolvedTuple<T extends readonly any[]> = T extends []\n ? []\n : T extends [infer F]\n ? [ResolvedMain<F>]\n : T extends [infer F, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]\n : T extends [(infer F)?]\n ? [ResolvedMain<F>?]\n : T extends [(infer F)?, ...infer Rest extends readonly any[]]\n ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]\n : [];\n\ntype IsTuple<T extends readonly any[] | { length: number }> = [T] extends [never]\n ? false\n : T extends readonly any[]\n ? number extends T['length']\n ? false\n : true\n : false;\n\ntype ValueOf<Instance> =\n IsValueOf<Instance, boolean> extends true\n ? boolean\n : IsValueOf<Instance, number> extends true\n ? number\n : IsValueOf<Instance, string> extends true\n ? string\n : Instance;\n\ntype IsValueOf<Instance, O extends IValueOf<any>> = Instance extends O\n ? O extends IValueOf<infer Primitive>\n ? Instance extends Primitive\n ? false\n : true // not Primitive, but Object\n : false // cannot be\n : false;\n\ninterface IValueOf<T> {\n valueOf(): T;\n}\n"],"names":["isPrimitive","isPlainObject"],"mappings":";;;;;;AAiBgB,SAAA,IAAI,CAAmD,GAAM,EAAE,IAAS,EAAA;AACtF,IAAA,MAAM,MAAM,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;AAE1B,IAAA,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;AACtB,QAAA,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;KACpB;AAED,IAAA,OAAO,MAAoB,CAAC;AAC9B;;ACNgB,SAAA,MAAM,CACpB,GAAM,EACN,UAAwD,EAAA;IAExD,MAAM,MAAM,GAAe,EAAE,CAAC;AAE9B,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;AAC9C,QAAA,IAAI,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;YAC1B,SAAS;SACV;AAEA,QAAA,MAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KAC9B;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;ACjBgB,SAAA,IAAI,CAAmD,GAAM,EAAE,IAAS,EAAA;IACtF,MAAM,MAAM,GAAG,EAAgB,CAAC;AAEhC,IAAA,KAAK,MAAM,GAAG,IAAI,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,QAAA,GAAG,YAAY,WAAW;AAC1B,QAAA,GAAG,YAAY,WAAW;AAC1B,QAAA,GAAG,YAAY,cAAc;AAC7B,QAAA,GAAG,YAAY,SAAS;AACxB,QAAA,GAAG,YAAY,UAAU;AACzB,QAAA,GAAG,YAAY,UAAU;AACzB,QAAA,GAAG,YAAY,aAAa;AAC5B,QAAA,GAAG,YAAY,YAAY;QAC3B,GAAG,YAAY,YAAY,EAC3B;AACJ;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"invert.mjs","sources":["../../src/object/invert.ts"],"sourcesContent":["/**\n * Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa.\n *\n * This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values,\n * the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping\n * of the input object's key-value pairs.\n *\n * @template K - Type of the keys in the input object (string, number, symbol)\n * @template V - Type of the values in the input object (string, number, symbol)\n * @param {Record<K, V>} obj - The input object whose keys and values are to be inverted\n * @returns {{ [key in V]: K }} - A new object with keys and values inverted\n *\n * @example\n * invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' }\n * invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' }\n * invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' }\n * invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' }\n */\nexport function invert<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): { [key in V]: K } {\n const result = {} as { [key in V]: K };\n\n const keys = Object.keys(obj) as K[];\n \n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = obj[key];\n result[value] = key;\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAkBM,SAAU,MAAM,CAA+C,GAAiB,EAAA;IACpF,MAAM,MAAM,GAAG,EAAuB,CAAC;IAEvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAQ,CAAC;AAErC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,QAAA,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;AACvB,QAAA,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;KACrB;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapKeys.mjs","sources":["../../src/object/mapKeys.ts"],"sourcesContent":["/**\n * Creates a new object with the same values as the given object, but with keys generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K1 - The type of the keys in the object.\n * @template K2 - The type of the new keys generated by the iteratee function.\n *\n * @param {T} object - The object to iterate over.\n * @param {(value: T[K1], key: K1, object: T) => K2} getNewKey - The function invoked per own enumerable property.\n * @returns {Record<K2, T[K1]>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapKeys(obj, (value, key) => key + value);\n * console.log(result); // { a1: 1, b2: 2 }\n */\nexport function mapKeys<T extends {}, K1 extends keyof T, K2 extends PropertyKey>(\n object: T,\n getNewKey: (value: T[K1], key: K1, object: T) => K2\n): Record<K2, T[K1]> {\n const result = {} as Record<K2, T[K1]>;\n const keys = Object.keys(object);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i] as K1;\n const value = object[key];\n\n result[getNewKey(value, key, object)] = value as any;\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAkBgB,SAAA,OAAO,CACrB,MAAS,EACT,SAAmD,EAAA;IAEnD,MAAM,MAAM,GAAG,EAAuB,CAAC;IACvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEjC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAO,CAAC;AAC1B,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAE1B,QAAA,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,KAAY,CAAC;KACtD;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapValues.mjs","sources":["../../src/object/mapValues.ts"],"sourcesContent":["/**\n * Creates a new object with the same keys as the given object, but with values generated\n * by running each own enumerable property of the object through the iteratee function.\n *\n * @template T - The type of the object.\n * @template K - The type of the keys in the object.\n * @template V - The type of the new values generated by the iteratee function.\n *\n * @param {T} object - The object to iterate over.\n * @param {(value: T[K], key: K, object: T) => V} getNewValue - The function invoked per own enumerable property.\n * @returns {Record<K, V>} - Returns the new mapped object.\n *\n * @example\n * // Example usage:\n * const obj = { a: 1, b: 2 };\n * const result = mapValues(obj, (value) => value * 2);\n * console.log(result); // { a: 2, b: 4 }\n */\nexport function mapValues<T extends Record<PropertyKey, unknown>, K extends keyof T, V>(\n object: T,\n getNewValue: (value: T[K], key: K, object: T) => V\n): Record<K, V> {\n const result = {} as Record<K, V>;\n const keys = Object.keys(object);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i] as K;\n const value = object[key];\n\n result[key] = getNewValue(value, key, object);\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAkBgB,SAAA,SAAS,CACvB,MAAS,EACT,WAAkD,EAAA;IAElD,MAAM,MAAM,GAAG,EAAkB,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEjC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAM,CAAC;AACzB,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAE1B,QAAA,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;KAC/C;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"omit.mjs","sources":["../../src/object/omit.ts"],"sourcesContent":["/**\n * Creates a new object with specified keys omitted.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * excludes the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to omit keys from.\n * @param {K[]} keys - An array of keys to be omitted from the object.\n * @returns {Omit<T, K>} A new object with the specified keys omitted.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = omit(obj, ['b', 'c']);\n * // result will be { a: 1 }\n */\nexport function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n\n for (const key of keys) {\n delete result[key];\n }\n\n return result as Omit<T, K>;\n}\n"],"names":[],"mappings":"AAiBgB,SAAA,IAAI,CAAmD,GAAM,EAAE,IAAS,EAAA;AACtF,IAAA,MAAM,MAAM,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;AAE1B,IAAA,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;AACtB,QAAA,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;KACpB;AAED,IAAA,OAAO,MAAoB,CAAC;AAC9B;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"omitBy.mjs","sources":["../../src/object/omitBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that do not satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns false.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to omit properties from.\n * @param {(value: T[string], key: keyof T) => boolean} shouldOmit - A predicate function that determines\n * whether a property should be omitted. It takes the property's key and value as arguments and returns `true`\n * if the property should be omitted, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that do not satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'omit', c: 3 };\n * const shouldOmit = (key, value) => typeof value === 'string';\n * const result = omitBy(obj, shouldOmit);\n * // result will be { a: 1, c: 3 }\n */\nexport function omitBy<T extends Record<string, any>>(\n obj: T,\n shouldOmit: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (shouldOmit(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAmBgB,SAAA,MAAM,CACpB,GAAM,EACN,UAAwD,EAAA;IAExD,MAAM,MAAM,GAAe,EAAE,CAAC;AAE9B,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;AAC9C,QAAA,IAAI,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;YAC1B,SAAS;SACV;AAEA,QAAA,MAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KAC9B;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pick.mjs","sources":["../../src/object/pick.ts"],"sourcesContent":["/**\n * Creates a new object composed of the picked object properties.\n *\n * This function takes an object and an array of keys, and returns a new object that\n * includes only the properties corresponding to the specified keys.\n *\n * @template T - The type of object.\n * @template K - The type of keys in object.\n * @param {T} obj - The object to pick keys from.\n * @param {K[]} keys - An array of keys to be picked from the object.\n * @returns {Pick<T, K>} A new object with the specified keys picked.\n *\n * @example\n * const obj = { a: 1, b: 2, c: 3 };\n * const result = pick(obj, ['a', 'c']);\n * // result will be { a: 1, c: 3 }\n */\nexport function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n\n for (const key of keys) {\n result[key] = obj[key];\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAiBgB,SAAA,IAAI,CAAmD,GAAM,EAAE,IAAS,EAAA;IACtF,MAAM,MAAM,GAAG,EAAgB,CAAC;AAEhC,IAAA,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;KACxB;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pickBy.mjs","sources":["../../src/object/pickBy.ts"],"sourcesContent":["/**\n * Creates a new object composed of the properties that satisfy the predicate function.\n *\n * This function takes an object and a predicate function, and returns a new object that\n * includes only the properties for which the predicate function returns true.\n *\n * @template T - The type of object.\n * @param {T} obj - The object to pick properties from.\n * @param {(value: T[keyof T], key: keyof T) => boolean} shouldPick - A predicate function that determines\n * whether a property should be picked. It takes the property's key and value as arguments and returns `true`\n * if the property should be picked, and `false` otherwise.\n * @returns {Partial<T>} A new object with the properties that satisfy the predicate function.\n *\n * @example\n * const obj = { a: 1, b: 'pick', c: 3 };\n * const shouldPick = (value) => typeof value === 'string';\n * const result = pickBy(obj, shouldPick);\n * // result will be { b: 'pick' }\n */\nexport function pickBy<T extends Record<string, any>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!shouldPick(value, key)) {\n continue;\n }\n\n (result as any)[key] = value;\n }\n\n return result;\n}\n"],"names":[],"mappings":"AAmBgB,SAAA,MAAM,CACpB,GAAM,EACN,UAAwD,EAAA;IAExD,MAAM,MAAM,GAAe,EAAE,CAAC;AAE9B,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC9C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;YAC3B,SAAS;SACV;AAEA,QAAA,MAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KAC9B;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/predicate/isEqual.ts","../../src/predicate/isNil.ts","../../src/predicate/isNotNil.ts","../../src/predicate/isNull.ts","../../src/predicate/isUndefined.ts","../../src/predicate/isLength.ts","../../src/predicate/isFunction.ts","../../src/predicate/isArrayLike.ts","../../src/predicate/isTypedArray.ts","../../src/predicate/isPrimitive.ts","../../src/predicate/isObjectLike.ts","../../src/compat/_internal/getTag.ts","../../src/predicate/isArguments.ts"],"sourcesContent":["import { union } from \"../array/union.ts\";\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @param {unknown} a - The first value to compare.\n * @param {unknown} b - The second value to compare.\n * @returns {boolean} `true` if the values are equal, otherwise `false`.\n *\n * @example\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n // check if all keys in both arrays match\n if (union(aKeys, bKeys).length !== aKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const propKey = aKeys[i];\n const aProp = (a as any)[propKey];\n const bProp = (b as any)[propKey];\n \n if (!isEqual(aProp, bProp)) {\n return false;\n }\n }\n\n return true;\n}\n","/**\n * Checks if a given value is null or undefined.\n *\n * This function tests whether the provided value is either `null` or `undefined`.\n * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.\n *\n * @param {unknown} x - The value to test for null or undefined.\n * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * const result1 = isNil(value1); // true\n * const result2 = isNil(value2); // true\n * const result3 = isNil(value3); // false\n */\nexport function isNil(x: unknown): x is null | undefined {\n return x == null;\n}\n","/**\n * Checks if the given value is not null nor undefined.\n *\n * The main use of this function is to be used with TypeScript as a type predicate.\n *\n * @template T - The type of value.\n * @param {T | null | undefined} x - The value to test if it is not null nor undefined.\n * @returns {x is T} True if the value is not null nor undefined, false otherwise.\n *\n * @example\n * // Here the type of `arr` is (number | undefined)[]\n * const arr = [1, undefined, 3];\n * // Here the type of `result` is number[]\n * const result = arr.filter(isNotNil);\n * // result will be [1, 3]\n */\nexport function isNotNil<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n","/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`.\n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n *\n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n *\n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n","/**\n * Checks if the given value is undefined.\n *\n * This function tests whether the provided value is strictly equal to `undefined`.\n * It returns `true` if the value is `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.\n *\n * @param {unknown} x - The value to test if it is undefined.\n * @returns {x is undefined} true if the value is undefined, false otherwise.\n *\n * @example\n * const value1 = undefined;\n * const value2 = null;\n * const value3 = 42;\n *\n * console.log(isUndefined(value1)); // true\n * console.log(isUndefined(value2)); // false\n * console.log(isUndefined(value3)); // false\n */\nexport function isUndefined(x: unknown): x is undefined {\n return x === undefined;\n}\n","export function isLength(value: unknown): value is number {\n return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;\n}\n","/**\n * Checks if `value` is a function.\n *\n * @param {unknown} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n *\n * @example\n * isFunction(Array.prototype.slice); // true\n * isFunction(async function () {}); // true\n * isFunction(function* () {}); // true\n * isFunction(Proxy); // true\n * isFunction(Int8Array); // true\n */\nexport function isFunction(value: unknown): value is (...args: unknown[]) => unknown {\n return typeof value === 'function';\n}\n","import { isLength } from \"./isLength.ts\";\n\n/**\n * Checks if `value` is array-like.\n *\n * @param {unknown} value The value to check.\n * @returns {value is ArrayLike<unknown>} Returns `true` if `value` is array-like, else `false`.\n *\n * @example\n * isArrayLike([1, 2, 3]); // true\n * isArrayLike('abc'); // true\n * isArrayLike({ 0: 'a', length: 1 }); // true\n * isArrayLike({}); // false\n * isArrayLike(null); // false\n * isArrayLike(undefined); // false\n */\nexport function isArrayLike(value: unknown): value is ArrayLike<unknown> {\n return value != null && typeof value !== \"function\" &&\n isLength((value as ArrayLike<unknown>).length);\n}\n","/**\n * Checks if a value is a TypedArray.\n * @param {unknown} x The value to check.\n * @returns {x is\n * | Uint8Array\n * | Uint8ClampedArray\n * | Uint16Array\n * | Uint32Array\n * | BigUint64Array\n * | Int8Array\n * | Int16Array\n * | Int32Array\n * | BigInt64Array\n * | Float32Array\n * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.\n */\nexport function isTypedArray(\n x: unknown\n): x is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n x instanceof Uint8Array ||\n x instanceof Uint8ClampedArray ||\n x instanceof Uint16Array ||\n x instanceof Uint32Array ||\n x instanceof BigUint64Array ||\n x instanceof Int8Array ||\n x instanceof Int16Array ||\n x instanceof Int32Array ||\n x instanceof BigInt64Array ||\n x instanceof Float32Array ||\n x instanceof Float64Array\n );\n}\n","/**\n * Checks whether a value is a JavaScript primitive.\n * JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.\n *\n * @param {unknown} x The value to check.\n * @returns {x is\n * | null\n * | undefined\n * | string\n * | number\n * | boolean\n * | symbol\n * | bigint} Returns true if `x` is a primitive, false otherwise.\n */\nexport function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n","/**\n * Checks if the given value is an object-like.\n *\n * This function tests whether the provided value is an object-like or not.\n * It returns `true` if the value is an object-like, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like.\n *\n * @template T - The type of value.\n * @param {T} value - The value to test if it is an object-like.\n * @returns {value is Extract<T, object>} `true` if the value is an object-like, `false` otherwise.\n *\n * @example\n * const value1 = { a: 1 };\n * const value2 = [1, 2, 3];\n * const value3 = 'abc';\n * const value4 = () => {};\n * const value5 = null;\n *\n * console.log(isObjectLike(value1)); // true\n * console.log(isObjectLike(value2)); // true\n * console.log(isObjectLike(value3)); // false\n * console.log(isObjectLike(value4)); // false\n */\n\nexport function isObjectLike<T>(value: T): value is Extract<T, object> {\n return typeof value === 'object' && value !== null;\n}\n","/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {T} value The value to query.\n * @returns {string} Returns the `Object.prototype.toString.call` result.\n */\nexport function getTag<T>(value: T) {\n if (value == null) {\n return value === undefined ? '[object Undefined]' : '[object Null]';\n }\n return Object.prototype.toString.call(value);\n}\n","import { getTag } from '../compat/_internal/getTag.ts';\n\n/**\n * Checks if the given value is an arguments object.\n *\n * This function tests whether the provided value is an arguments object or not.\n * It returns `true` if the value is an arguments object, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object.\n *\n * @param {unknown} value - The value to test if it is an arguments object.\n * @returns {value is IArguments} `true` if the value is an arguments, `false` otherwise.\n *\n * @example\n * const args = (function() { return arguments; })();\n * const strictArgs = (function() { 'use strict'; return arguments; })();\n * const value = [1, 2, 3];\n *\n * console.log(isArguments(args)); // true\n * console.log(isArguments(strictArgs)); // true\n * console.log(isArguments(value)); // false\n */\nexport function isArguments(value?: unknown): value is IArguments {\n return value !== null && typeof value === 'object' && getTag(value) === '[object Arguments]';\n}\n"],"names":["union"],"mappings":";;;;;;;AAgBgB,SAAA,OAAO,CAAC,CAAU,EAAE,CAAU,EAAA;IAC5C,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AACnB,QAAA,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,EAAE;QAC1C,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;KACpC;IAED,IAAI,CAAC,YAAY,MAAM,IAAI,CAAC,YAAY,MAAM,EAAE;AAC9C,QAAA,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;KACrD;AAED,IAAA,I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ACjB,OAAO,KAAK,KAAK,SAAS,GAAG,oBAAoB,GAAG,eAAe,CAAC;KACrE;IACD,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C;;ACUM,SAAU,WAAW,CAAC,KAAe,EAAA;AACzC,IAAA,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,oBAAoB,CAAC;AAC/F;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isArguments.mjs","sources":["../../src/predicate/isArguments.ts"],"sourcesContent":["import { getTag } from '../compat/_internal/getTag.ts';\n\n/**\n * Checks if the given value is an arguments object.\n *\n * This function tests whether the provided value is an arguments object or not.\n * It returns `true` if the value is an arguments object, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object.\n *\n * @param {unknown} value - The value to test if it is an arguments object.\n * @returns {value is IArguments} `true` if the value is an arguments, `false` otherwise.\n *\n * @example\n * const args = (function() { return arguments; })();\n * const strictArgs = (function() { 'use strict'; return arguments; })();\n * const value = [1, 2, 3];\n *\n * console.log(isArguments(args)); // true\n * console.log(isArguments(strictArgs)); // true\n * console.log(isArguments(value)); // false\n */\nexport function isArguments(value?: unknown): value is IArguments {\n return value !== null && typeof value === 'object' && getTag(value) === '[object Arguments]';\n}\n"],"names":[],"mappings":";;AAsBM,SAAU,WAAW,CAAC,KAAe,EAAA;AACzC,IAAA,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,oBAAoB,CAAC;AAC/F;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isArrayLike.mjs","sources":["../../src/predicate/isArrayLike.ts"],"sourcesContent":["import { isLength } from \"./isLength.ts\";\n\n/**\n * Checks if `value` is array-like.\n *\n * @param {unknown} value The value to check.\n * @returns {value is ArrayLike<unknown>} Returns `true` if `value` is array-like, else `false`.\n *\n * @example\n * isArrayLike([1, 2, 3]); // true\n * isArrayLike('abc'); // true\n * isArrayLike({ 0: 'a', length: 1 }); // true\n * isArrayLike({}); // false\n * isArrayLike(null); // false\n * isArrayLike(undefined); // false\n */\nexport function isArrayLike(value: unknown): value is ArrayLike<unknown> {\n return value != null && typeof value !== \"function\" &&\n isLength((value as ArrayLike<unknown>).length);\n}\n"],"names":[],"mappings":";;AAgBM,SAAU,WAAW,CAAC,KAAc,EAAA;AACxC,IAAA,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,UAAU;AACjD,QAAA,QAAQ,CAAE,KAA4B,CAAC,MAAM,CAAC,CAAC;AACnD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isEqual.mjs","sources":["../../src/predicate/isEqual.ts"],"sourcesContent":["import { union } from \"../array/union.ts\";\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @param {unknown} a - The first value to compare.\n * @param {unknown} b - The second value to compare.\n * @returns {boolean} `true` if the values are equal, otherwise `false`.\n *\n * @example\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n // check if all keys in both arrays match\n if (union(aKeys, bKeys).length !== aKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const propKey = aKeys[i];\n const aProp = (a as any)[propKey];\n const bProp = (b as any)[propKey];\n \n if (!isEqual(aProp, bProp)) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":[],"mappings":";;AAgBgB,SAAA,OAAO,CAAC,CAAU,EAAE,CAAU,EAAA;IAC5C,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AACnB,QAAA,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,EAAE;QAC1C,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;KACpC;IAED,IAAI,CAAC,YAAY,MAAM,IAAI,CAAC,YAAY,MAAM,EAAE;AAC9C,QAAA,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;KACrD;AAED,IAAA,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE;AAC9E,QAAA,OAAO,KAAK,CAAC;KACd;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;AACjC,QAAA,OAAO,KAAK,CAAC;KACd;AAGD,IAAA,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;AAC/C,QAAA,OAAO,KAAK,CAAC;KACd;AAED,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACrC,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACzB,QAAA,MAAM,KAAK,GAAI,CAAS,CAAC,OAAO,CAAC,CAAC;AAClC,QAAA,MAAM,KAAK,GAAI,CAAS,CAAC,OAAO,CAAC,CAAC;QAElC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AAC1B,YAAA,OAAO,KAAK,CAAC;SACd;KACF;AAED,IAAA,OAAO,IAAI,CAAC;AACd;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isFunction.mjs","sources":["../../src/predicate/isFunction.ts"],"sourcesContent":["/**\n * Checks if `value` is a function.\n *\n * @param {unknown} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n *\n * @example\n * isFunction(Array.prototype.slice); // true\n * isFunction(async function () {}); // true\n * isFunction(function* () {}); // true\n * isFunction(Proxy); // true\n * isFunction(Int8Array); // true\n */\nexport function isFunction(value: unknown): value is (...args: unknown[]) => unknown {\n return typeof value === 'function';\n}\n"],"names":[],"mappings":"AAaM,SAAU,UAAU,CAAC,KAAc,EAAA;AACvC,IAAA,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isLength.mjs","sources":["../../src/predicate/isLength.ts"],"sourcesContent":["export function isLength(value: unknown): value is number {\n return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;\n}\n"],"names":[],"mappings":"AAAM,SAAU,QAAQ,CAAC,KAAc,EAAA;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,MAAM,CAAC,gBAAgB,CAAC;AACxG;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isNil.mjs","sources":["../../src/predicate/isNil.ts"],"sourcesContent":["/**\n * Checks if a given value is null or undefined.\n *\n * This function tests whether the provided value is either `null` or `undefined`.\n * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.\n *\n * @param {unknown} x - The value to test for null or undefined.\n * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n * const result1 = isNil(value1); // true\n * const result2 = isNil(value2); // true\n * const result3 = isNil(value3); // false\n */\nexport function isNil(x: unknown): x is null | undefined {\n return x == null;\n}\n"],"names":[],"mappings":"AAmBM,SAAU,KAAK,CAAC,CAAU,EAAA;IAC9B,OAAO,CAAC,IAAI,IAAI,CAAC;AACnB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isNotNil.mjs","sources":["../../src/predicate/isNotNil.ts"],"sourcesContent":["/**\n * Checks if the given value is not null nor undefined.\n *\n * The main use of this function is to be used with TypeScript as a type predicate.\n *\n * @template T - The type of value.\n * @param {T | null | undefined} x - The value to test if it is not null nor undefined.\n * @returns {x is T} True if the value is not null nor undefined, false otherwise.\n *\n * @example\n * // Here the type of `arr` is (number | undefined)[]\n * const arr = [1, undefined, 3];\n * // Here the type of `result` is number[]\n * const result = arr.filter(isNotNil);\n * // result will be [1, 3]\n */\nexport function isNotNil<T>(x: T | null | undefined): x is T {\n return x !== null && x !== undefined;\n}\n"],"names":[],"mappings":"AAgBM,SAAU,QAAQ,CAAI,CAAuB,EAAA;AACjD,IAAA,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,CAAC;AACvC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isNull.mjs","sources":["../../src/predicate/isNull.ts"],"sourcesContent":["/**\n * Checks if the given value is null.\n *\n * This function tests whether the provided value is strictly equal to `null`.\n * It returns `true` if the value is `null`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null`.\n *\n * @param {unknown} x - The value to test if it is null.\n * @returns {x is null} True if the value is null, false otherwise.\n *\n * @example\n * const value1 = null;\n * const value2 = undefined;\n * const value3 = 42;\n *\n * console.log(isNull(value1)); // true\n * console.log(isNull(value2)); // false\n * console.log(isNull(value3)); // false\n */\nexport function isNull(x: unknown): x is null {\n return x === null;\n}\n"],"names":[],"mappings":"AAoBM,SAAU,MAAM,CAAC,CAAU,EAAA;IAC/B,OAAO,CAAC,KAAK,IAAI,CAAC;AACpB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isObjectLike.mjs","sources":["../../src/predicate/isObjectLike.ts"],"sourcesContent":["/**\n * Checks if the given value is an object-like.\n *\n * This function tests whether the provided value is an object-like or not.\n * It returns `true` if the value is an object-like, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like.\n *\n * @template T - The type of value.\n * @param {T} value - The value to test if it is an object-like.\n * @returns {value is Extract<T, object>} `true` if the value is an object-like, `false` otherwise.\n *\n * @example\n * const value1 = { a: 1 };\n * const value2 = [1, 2, 3];\n * const value3 = 'abc';\n * const value4 = () => {};\n * const value5 = null;\n *\n * console.log(isObjectLike(value1)); // true\n * console.log(isObjectLike(value2)); // true\n * console.log(isObjectLike(value3)); // false\n * console.log(isObjectLike(value4)); // false\n */\n\nexport function isObjectLike<T>(value: T): value is Extract<T, object> {\n return typeof value === 'object' && value !== null;\n}\n"],"names":[],"mappings":"AAyBM,SAAU,YAAY,CAAI,KAAQ,EAAA;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isPlainObject.mjs","sources":["../../src/predicate/isPlainObject.ts"],"sourcesContent":["/**\n * Checks if a given value is a plain object.\n * \n * @param {object} object - The value to check.\n * @returns {boolean} - True if the value is a plain object, otherwise false.\n * \n * @example\n * console.log(isPlainObject({})); // true\n * console.log(isPlainObject([])); // false\n * console.log(isPlainObject(null)); // false\n * console.log(isPlainObject(Object.create(null))); // true\n * console.log(Buffer.from('hello, world')); // false\n */\nexport function isPlainObject(object: object): boolean {\n if (typeof object !== 'object') {\n return false;\n }\n\n if (object == null) {\n return false;\n }\n\n if (Object.getPrototypeOf(object) === null) {\n return true;\n }\n\n if (object.toString() !== '[object Object]') {\n return false;\n }\n\n let proto = object;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(object) === proto;\n}"],"names":[],"mappings":"AAaM,SAAU,aAAa,CAAC,MAAc,EAAA;AAC1C,IAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,QAAA,OAAO,KAAK,CAAC;KACd;AAED,IAAA,IAAI,MAAM,IAAI,IAAI,EAAE;AAClB,QAAA,OAAO,KAAK,CAAC;KACd;IAED,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;AAC1C,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,iBAAiB,EAAE;AAC3C,QAAA,OAAO,KAAK,CAAC;KACd;IAED,IAAI,KAAK,GAAG,MAAM,CAAC;IAEnB,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;AAC5C,QAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;KACtC;IAED,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC;AACjD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isPrimitive.mjs","sources":["../../src/predicate/isPrimitive.ts"],"sourcesContent":["/**\n * Checks whether a value is a JavaScript primitive.\n * JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.\n *\n * @param {unknown} x The value to check.\n * @returns {x is\n * | null\n * | undefined\n * | string\n * | number\n * | boolean\n * | symbol\n * | bigint} Returns true if `x` is a primitive, false otherwise.\n */\nexport function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint {\n return value == null || (typeof value !== 'object' && typeof value !== 'function');\n}\n"],"names":[],"mappings":"AAcM,SAAU,WAAW,CAAC,KAAc,EAAA;AACxC,IAAA,OAAO,KAAK,IAAI,IAAI,KAAK,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC;AACrF;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isTypedArray.mjs","sources":["../../src/predicate/isTypedArray.ts"],"sourcesContent":["/**\n * Checks if a value is a TypedArray.\n * @param {unknown} x The value to check.\n * @returns {x is\n * | Uint8Array\n * | Uint8ClampedArray\n * | Uint16Array\n * | Uint32Array\n * | BigUint64Array\n * | Int8Array\n * | Int16Array\n * | Int32Array\n * | BigInt64Array\n * | Float32Array\n * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.\n */\nexport function isTypedArray(\n x: unknown\n): x is\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | BigUint64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Float32Array\n | Float64Array {\n return (\n x instanceof Uint8Array ||\n x instanceof Uint8ClampedArray ||\n x instanceof Uint16Array ||\n x instanceof Uint32Array ||\n x instanceof BigUint64Array ||\n x instanceof Int8Array ||\n x instanceof Int16Array ||\n x instanceof Int32Array ||\n x instanceof BigInt64Array ||\n x instanceof Float32Array ||\n x instanceof Float64Array\n );\n}\n"],"names":[],"mappings":"AAgBM,SAAU,YAAY,CAC1B,CAAU,EAAA;IAaV,QACE,CAAC,YAAY,UAAU;AACvB,QAAA,CAAC,YAAY,iBAAiB;AAC9B,QAAA,CAAC,YAAY,WAAW;AACxB,QAAA,CAAC,YAAY,WAAW;AACxB,QAAA,CAAC,YAAY,cAAc;AAC3B,QAAA,CAAC,YAAY,SAAS;AACtB,QAAA,CAAC,YAAY,UAAU;AACvB,QAAA,CAAC,YAAY,UAAU;AACvB,QAAA,CAAC,YAAY,aAAa;AAC1B,QAAA,CAAC,YAAY,YAAY;QACzB,CAAC,YAAY,YAAY,EACzB;AACJ;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isUndefined.mjs","sources":["../../src/predicate/isUndefined.ts"],"sourcesContent":["/**\n * Checks if the given value is undefined.\n *\n * This function tests whether the provided value is strictly equal to `undefined`.\n * It returns `true` if the value is `undefined`, and `false` otherwise.\n *\n * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`.\n *\n * @param {unknown} x - The value to test if it is undefined.\n * @returns {x is undefined} true if the value is undefined, false otherwise.\n *\n * @example\n * const value1 = undefined;\n * const value2 = null;\n * const value3 = 42;\n *\n * console.log(isUndefined(value1)); // true\n * console.log(isUndefined(value2)); // false\n * console.log(isUndefined(value3)); // false\n */\nexport function isUndefined(x: unknown): x is undefined {\n return x === undefined;\n}\n"],"names":[],"mappings":"AAoBM,SAAU,WAAW,CAAC,CAAU,EAAA;IACpC,OAAO,CAAC,KAAK,SAAS,CAAC;AACzB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"delay.mjs","sources":["../../src/promise/delay.ts"],"sourcesContent":["import { AbortError } from '../error/AbortError.ts';\n\ninterface DelayOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Delays the execution of code for a specified number of milliseconds.\n *\n * This function returns a Promise that resolves after the specified delay, allowing you to use it\n * with async/await to pause execution.\n *\n * @param {number} ms - The number of milliseconds to delay.\n * @param {DelayOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the delay.\n * @returns {Promise<void>} A Promise that resolves after the specified delay.\n *\n * @example\n * async function foo() {\n * console.log('Start');\n * await delay(1000); // Delays execution for 1 second\n * console.log('End');\n * }\n *\n * foo();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const { signal } = controller;\n *\n * setTimeout(() => controller.abort(), 50); // Will cancel the delay after 50ms\n * try {\n * await delay(100, { signal });\n * } catch (error) {\n * console.error(error); // Will log 'AbortError'\n * }\n * }\n */\nexport function delay(ms: number, { signal }: DelayOptions = {}): Promise<void> {\n return new Promise((resolve, reject) => {\n const abortError = () => {\n reject(new AbortError());\n };\n\n const abortHandler = () => {\n clearTimeout(timeoutId);\n abortError();\n };\n\n if (signal?.aborted) {\n return abortError();\n }\n\n const timeoutId = setTimeout(resolve, ms);\n\n signal?.addEventListener('abort', abortHandler, { once: true });\n });\n}\n"],"names":[],"mappings":";;AAsCM,SAAU,KAAK,CAAC,EAAU,EAAE,EAAE,MAAM,KAAmB,EAAE,EAAA;IAC7D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;QACrC,MAAM,UAAU,GAAG,MAAK;AACtB,YAAA,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;AAC3B,SAAC,CAAC;QAEF,MAAM,YAAY,GAAG,MAAK;YACxB,YAAY,CAAC,SAAS,CAAC,CAAC;AACxB,YAAA,UAAU,EAAE,CAAC;AACf,SAAC,CAAC;AAEF,QAAA,IAAI,MAAM,EAAE,OAAO,EAAE;YACnB,OAAO,UAAU,EAAE,CAAC;SACrB;QAED,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAE1C,QAAA,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAClE,KAAC,CAAC,CAAC;AACL;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeout.mjs","sources":["../../src/promise/timeout.ts"],"sourcesContent":["import { delay } from './delay.ts';\nimport { TimeoutError } from '../error/TimeoutError.ts';\n\n/**\n * Returns a promise that rejects with a `TimeoutError` after a specified delay.\n *\n * @param {number} ms - The delay duration in milliseconds.\n * @returns {Promise<void>} A promise that rejects with a `TimeoutError` after the specified delay.\n * @throws {TimeoutError} Throws a `TimeoutError` after the specified delay.\n */\nexport async function timeout(ms: number): Promise<never> {\n await delay(ms);\n throw new TimeoutError();\n}\n"],"names":[],"mappings":";;;AAUO,eAAe,OAAO,CAAC,EAAU,EAAA;AACtC,IAAA,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,IAAI,YAAY,EAAE,CAAC;AAC3B;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"withTimeout.mjs","sources":["../../src/promise/withTimeout.ts"],"sourcesContent":["import { timeout } from './timeout.ts';\n\n/**\n * Executes an async function and enforces a timeout. \n * \n * If the promise does not resolve within the specified time,\n * the timeout will trigger and the returned promise will be rejected.\n *\n *\n * @template T \n * @param {() => Promise<T>} run - A function that returns a promise to be executed.\n * @param {number} ms - The timeout duration in milliseconds.\n * @returns {Promise<T>} A promise that resolves with the result of the `run` function or rejects if the timeout is reached.\n *\n * @example\n * try {\n * await withTimeout(() => {}, 1000); // Timeout exception after 1 second\n * } catch (error) {\n * console.error(error); // Will log 'TimeoutError'\n * }\n */\nexport async function withTimeout<T>(run: () => Promise<T>, ms: number): Promise<T> {\n return Promise.race([run(), timeout(ms) as T]);\n}\n"],"names":[],"mappings":";;AAqBO,eAAe,WAAW,CAAI,GAAqB,EAAE,EAAU,EAAA;AACpE,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,EAAE,CAAM,CAAC,CAAC,CAAC;AACjD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getWords.mjs","sources":["../../../src/string/_internal/getWords.ts"],"sourcesContent":["/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n"],"names":[],"mappings":"AAgBA,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAE5D,SAAU,QAAQ,CAAC,GAAW,EAAA;AAClC,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;AACzD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"camelCase.mjs","sources":["../../src/string/camelCase.ts"],"sourcesContent":["import { capitalize } from \"./capitalize.ts\";\nimport { getWords } from \"./_internal/getWords.ts\";\n\n/**\n * Converts a string to camel case.\n *\n * camel case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to camel case.\n * @returns {string} - The converted string to camel case.\n *\n * @example\n * const convertedStr1 = camelCase('camelCase') // returns 'camelCase'\n * const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace'\n * const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'\n * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'\n */\n\nexport function camelCase(str: string): string {\n const words = getWords(str);\n\n if (words.length === 0) {\n return \"\";\n }\n\n const [first, ...rest] = words;\n\n return `${first.toLowerCase()}${rest.map((word) => capitalize(word)).join(\"\")\n }`;\n}\n"],"names":[],"mappings":";;;AAkBM,SAAU,SAAS,CAAC,GAAW,EAAA;AACnC,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;AAE5B,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtB,QAAA,OAAO,EAAE,CAAC;KACX;IAED,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IAE/B,OAAO,CAAA,EAAG,KAAK,CAAC,WAAW,EAAE,CAAG,EAAA,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAC1E,CAAA,CAAE,CAAC;AACP;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"capitalize.mjs","sources":["../../src/string/capitalize.ts"],"sourcesContent":["/**\n * Converts the first character of string to upper case and the remaining to lower case.\n *\n * @template T - Literal type of the string.\n * @param {T} str - The string to be converted to uppercase.\n * @returns {Capitalize<T>} - The capitalized string.\n *\n * @example\n * const result = capitalize('fred') // returns 'Fred'\n * const result2 = capitalize('FRED') // returns 'Fred'\n */\n\nexport const capitalize = <T extends string>(str: T): Capitalize<T> => {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;\n};\n"],"names":[],"mappings":"AAYa,MAAA,UAAU,GAAG,CAAmB,GAAM,KAAmB;IACpE,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAmB;AACrF;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/string/capitalize.ts","../../src/string/_internal/getWords.ts","../../src/string/camelCase.ts","../../src/string/snakeCase.ts","../../src/string/kebabCase.ts","../../src/string/lowerCase.ts","../../src/string/startCase.ts"],"sourcesContent":["/**\n * Converts the first character of string to upper case and the remaining to lower case.\n *\n * @template T - Literal type of the string.\n * @param {T} str - The string to be converted to uppercase.\n * @returns {Capitalize<T>} - The capitalized string.\n *\n * @example\n * const result = capitalize('fred') // returns 'Fred'\n * const result2 = capitalize('FRED') // returns 'Fred'\n */\n\nexport const capitalize = <T extends string>(str: T): Capitalize<T> => {\n return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()) as Capitalize<T>;\n};\n","/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matchs sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digis\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matchs: ['camel', 'Case', 'HTTP', 'Request']\n */\nconst CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;\n\nexport function getWords(str: string): string[] {\n return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);\n}\n","import { capitalize } from \"./capitalize.ts\";\nimport { getWords } from \"./_internal/getWords.ts\";\n\n/**\n * Converts a string to camel case.\n *\n * camel case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to camel case.\n * @returns {string} - The converted string to camel case.\n *\n * @example\n * const convertedStr1 = camelCase('camelCase') // returns 'camelCase'\n * const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace'\n * const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'\n * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'\n */\n\nexport function camelCase(str: string): string {\n const words = getWords(str);\n\n if (words.length === 0) {\n return \"\";\n }\n\n const [first, ...rest] = words;\n\n return `${first.toLowerCase()}${rest.map((word) => capitalize(word)).join(\"\")\n }`;\n}\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('_');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to kebab case.\n *\n * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.\n *\n * @param {string} str - The string that is to be changed to kebab case.\n * @returns {string} - The converted string to kebab case.\n *\n * @example\n * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'\n * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'\n * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'\n * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'\n */\n\nexport const kebabCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('-');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to lower case.\n *\n * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.\n *\n * @param {string} str - The string that is to be changed to lower case.\n * @returns {string} - The converted string to lower case.\n *\n * @example\n * const convertedStr1 = lowerCase('camelCase') // returns 'camel case'\n * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'\n * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'\n * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'\n */\nexport const lowerCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join(' ');\n};\n","import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.\n *\n * Start case is the naming convention in which each word is written with an initial capital letter.\n * @param {string} str - The string to convert.\n * @returns {string} The converted string.\n *\n * @example\n * const result1 = startCase('hello world'); // result will be 'Hello World'\n * const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'\n * const result3 = startCase('hello-world'); // result will be 'Hello World'\n * const result4 = startCase('hello_world'); // result will be 'Hello World'\n */\nexport function startCase(str: string): string {\n const words = getWords(str.trim());\n let result = '';\n for (const word of words) {\n if (result) {\n result += ' ';\n }\n if (word === word.toUpperCase()) {\n result += word;\n } else {\n result += word[0].toUpperCase() + word.slice(1).toLowerCase();\n }\n }\n return result;\n}\n"],"names":[],"mappings":";;;;AAYa,MAAA,UAAU,GAAG,CAAmB,GAAM,KAAmB;IACpE,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAmB;AACrF;;ACEA,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAE5D,SAAU,QAAQ,CAAC,GAAW,EAAA;AAClC,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;AACzD;;ACFM,SAAU,SAAS,CAAC,GAAW,EAAA;AACnC,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;AAE5B,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtB,QAAA,OAAO,EAAE,CAAC;KACX;IAED,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IAE/B,OAAO,CAAA,EAAG,KAAK,CAAC,WAAW,EAAE,CAAG,EAAA,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C,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/D;KACF;AACD,IAAA,OAAO,MAAM,CAAC;AAChB;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"kebabCase.mjs","sources":["../../src/string/kebabCase.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to kebab case.\n *\n * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.\n *\n * @param {string} str - The string that is to be changed to kebab case.\n * @returns {string} - The converted string to kebab case.\n *\n * @example\n * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case'\n * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace'\n * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'\n * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'\n */\n\nexport const kebabCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('-');\n};\n"],"names":[],"mappings":";;AAiBa,MAAA,SAAS,GAAG,CAAC,GAAW,KAAY;AAC/C,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5B,IAAA,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"lowerCase.mjs","sources":["../../src/string/lowerCase.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to lower case.\n *\n * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.\n *\n * @param {string} str - The string that is to be changed to lower case.\n * @returns {string} - The converted string to lower case.\n *\n * @example\n * const convertedStr1 = lowerCase('camelCase') // returns 'camel case'\n * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace'\n * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'\n * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'\n */\nexport const lowerCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join(' ');\n};\n"],"names":[],"mappings":";;AAgBa,MAAA,SAAS,GAAG,CAAC,GAAW,KAAY;AAC/C,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5B,IAAA,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"snakeCase.mjs","sources":["../../src/string/snakeCase.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts a string to snake case.\n *\n * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.\n *\n * @param {string} str - The string that is to be changed to snake case.\n * @returns {string} - The converted string to snake case.\n *\n * @example\n * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case'\n * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace'\n * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'\n * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'\n */\n\nexport const snakeCase = (str: string): string => {\n const words = getWords(str);\n return words.map(word => word.toLowerCase()).join('_');\n};\n"],"names":[],"mappings":";;AAiBa,MAAA,SAAS,GAAG,CAAC,GAAW,KAAY;AAC/C,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5B,IAAA,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"startCase.mjs","sources":["../../src/string/startCase.ts"],"sourcesContent":["import { getWords } from './_internal/getWords.ts';\n\n/**\n * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.\n *\n * Start case is the naming convention in which each word is written with an initial capital letter.\n * @param {string} str - The string to convert.\n * @returns {string} The converted string.\n *\n * @example\n * const result1 = startCase('hello world'); // result will be 'Hello World'\n * const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'\n * const result3 = startCase('hello-world'); // result will be 'Hello World'\n * const result4 = startCase('hello_world'); // result will be 'Hello World'\n */\nexport function startCase(str: string): string {\n const words = getWords(str.trim());\n let result = '';\n for (const word of words) {\n if (result) {\n result += ' ';\n }\n if (word === word.toUpperCase()) {\n result += word;\n } else {\n result += word[0].toUpperCase() + word.slice(1).toLowerCase();\n }\n }\n return result;\n}\n"],"names":[],"mappings":";;AAeM,SAAU,SAAS,CAAC,GAAW,EAAA;IACnC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACnC,IAAI,MAAM,GAAG,EAAE,CAAC;AAChB,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,MAAM,EAAE;YACV,MAAM,IAAI,GAAG,CAAC;SACf;AACD,QAAA,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE;YAC/B,MAAM,IAAI,IAAI,CAAC;SAChB;aAAM;AACL,YAAA,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SAC/D;KACF;AACD,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}