es-toolkit 1.38.0 → 1.39.0-dev.1308

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 (553) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +1 -0
  3. package/array.js +1 -0
  4. package/compat/each.d.ts +1 -0
  5. package/compat/each.js +1 -0
  6. package/compat/eachRight.d.ts +1 -0
  7. package/compat/eachRight.js +1 -0
  8. package/compat/extend.d.ts +1 -0
  9. package/compat/extend.js +1 -0
  10. package/compat/extendWith.d.ts +1 -0
  11. package/compat/extendWith.js +1 -0
  12. package/compat/first.d.ts +1 -0
  13. package/compat/first.js +1 -0
  14. package/compat.js +1 -0
  15. package/dist/_internal/compareValues.js +15 -0
  16. package/dist/array/at.js +19 -0
  17. package/dist/array/chunk.js +19 -0
  18. package/dist/array/compact.js +16 -0
  19. package/dist/array/countBy.js +15 -0
  20. package/dist/array/difference.js +10 -0
  21. package/dist/array/differenceBy.js +12 -0
  22. package/dist/array/differenceWith.js +13 -0
  23. package/dist/array/drop.js +10 -0
  24. package/dist/array/dropRight.js +13 -0
  25. package/dist/array/dropRightWhile.js +14 -0
  26. package/dist/array/dropWhile.js +13 -0
  27. package/dist/array/fill.js +15 -0
  28. package/dist/array/flatMap.js +11 -0
  29. package/dist/array/flatMapDeep.js +11 -0
  30. package/dist/array/flatten.js +23 -0
  31. package/dist/array/flattenDeep.js +11 -0
  32. package/dist/array/forEachRight.js +12 -0
  33. package/dist/array/groupBy.js +18 -0
  34. package/dist/array/head.js +9 -0
  35. package/dist/array/index.js +122 -271
  36. package/dist/array/initial.js +9 -0
  37. package/dist/array/intersection.js +12 -0
  38. package/dist/array/intersectionBy.js +10 -0
  39. package/dist/array/intersectionWith.js +13 -0
  40. package/dist/array/isSubset.js +11 -0
  41. package/dist/array/isSubsetWith.js +11 -0
  42. package/dist/array/keyBy.js +15 -0
  43. package/dist/array/last.js +9 -0
  44. package/dist/array/maxBy.js +22 -0
  45. package/dist/array/minBy.js +22 -0
  46. package/dist/array/orderBy.js +25 -0
  47. package/dist/array/partition.js +20 -0
  48. package/dist/array/pull.js +22 -0
  49. package/dist/array/pullAt.js +16 -0
  50. package/dist/array/remove.js +24 -0
  51. package/dist/array/sample.js +10 -0
  52. package/dist/array/sampleSize.js +24 -0
  53. package/dist/array/shuffle.js +14 -0
  54. package/dist/array/sortBy.js +11 -0
  55. package/dist/array/tail.js +9 -0
  56. package/dist/array/take.js +12 -0
  57. package/dist/array/takeRight.js +15 -0
  58. package/dist/array/takeRightWhile.js +14 -0
  59. package/dist/array/takeWhile.js +17 -0
  60. package/dist/array/toFilled.js +16 -0
  61. package/dist/array/union.js +11 -0
  62. package/dist/array/unionBy.js +11 -0
  63. package/dist/array/unionWith.js +11 -0
  64. package/dist/array/uniq.js +9 -0
  65. package/dist/array/uniqBy.js +17 -0
  66. package/dist/array/uniqWith.js +17 -0
  67. package/dist/array/unzip.js +22 -0
  68. package/dist/array/unzipWith.js +18 -0
  69. package/dist/array/windowed.js +20 -0
  70. package/dist/array/without.js +11 -0
  71. package/dist/array/xor.js +13 -0
  72. package/dist/array/xorBy.js +15 -0
  73. package/dist/array/xorWith.js +15 -0
  74. package/dist/array/zip.js +24 -0
  75. package/dist/array/zipObject.js +13 -0
  76. package/dist/array/zipWith.js +17 -0
  77. package/dist/browser.global.js +1 -1
  78. package/dist/browser.global.js.map +1 -1
  79. package/dist/compat/_internal/MAX_ARRAY_LENGTH.js +7 -0
  80. package/dist/compat/_internal/MAX_SAFE_INTEGER.js +7 -0
  81. package/dist/compat/_internal/assignValue.js +14 -0
  82. package/dist/compat/_internal/compareValues.js +37 -0
  83. package/dist/compat/_internal/copyArray.js +14 -0
  84. package/dist/compat/_internal/decimalAdjust.js +23 -0
  85. package/dist/compat/_internal/flattenArrayLike.js +21 -0
  86. package/dist/compat/_internal/getSymbols.js +9 -0
  87. package/dist/compat/_internal/getSymbolsIn.js +16 -0
  88. package/dist/compat/_internal/getTag.js +12 -0
  89. package/dist/compat/_internal/isDeepKey.js +17 -0
  90. package/dist/compat/_internal/isIndex.js +20 -0
  91. package/dist/compat/_internal/isIterateeCall.js +21 -0
  92. package/dist/compat/_internal/isKey.js +20 -0
  93. package/dist/compat/_internal/isPrototype.js +11 -0
  94. package/dist/compat/_internal/mapToEntries.js +15 -0
  95. package/dist/compat/_internal/normalizeForCase.js +14 -0
  96. package/dist/compat/_internal/setToEntries.js +15 -0
  97. package/dist/{_chunk/isPlainObject-Xaozpc.js → compat/_internal/tags.js} +1 -37
  98. package/dist/compat/_internal/toArray.js +9 -0
  99. package/dist/compat/_internal/toKey.js +15 -0
  100. package/dist/compat/array/castArray.js +12 -0
  101. package/dist/compat/array/chunk.js +17 -0
  102. package/dist/compat/array/compact.js +15 -0
  103. package/dist/compat/array/concat.js +11 -0
  104. package/dist/compat/array/countBy.d.mts +22 -0
  105. package/dist/compat/array/countBy.d.ts +22 -0
  106. package/dist/compat/array/countBy.js +23 -0
  107. package/dist/compat/array/countBy.mjs +19 -0
  108. package/dist/compat/array/difference.js +24 -0
  109. package/dist/compat/array/differenceBy.js +24 -0
  110. package/dist/compat/array/differenceWith.js +23 -0
  111. package/dist/compat/array/drop.js +18 -0
  112. package/dist/compat/array/dropRight.js +18 -0
  113. package/dist/compat/array/dropRightWhile.js +40 -0
  114. package/dist/compat/array/dropWhile.js +41 -0
  115. package/dist/compat/array/every.js +64 -0
  116. package/dist/compat/array/fill.js +27 -0
  117. package/dist/compat/array/filter.js +37 -0
  118. package/dist/compat/array/find.js +30 -0
  119. package/dist/compat/array/findIndex.js +43 -0
  120. package/dist/compat/array/findLast.js +36 -0
  121. package/dist/compat/array/findLastIndex.js +43 -0
  122. package/dist/compat/array/flatMap.js +17 -0
  123. package/dist/compat/array/flatMapDeep.d.mts +67 -0
  124. package/dist/compat/array/flatMapDeep.d.ts +67 -0
  125. package/dist/compat/array/flatMapDeep.js +11 -0
  126. package/dist/compat/array/flatMapDeep.mjs +7 -0
  127. package/dist/compat/array/flatMapDepth.d.mts +71 -0
  128. package/dist/compat/array/flatMapDepth.d.ts +71 -0
  129. package/dist/compat/array/flatMapDepth.js +18 -0
  130. package/dist/compat/array/flatMapDepth.mjs +14 -0
  131. package/dist/compat/array/flatten.js +36 -0
  132. package/dist/compat/array/flattenDeep.js +11 -0
  133. package/dist/compat/array/flattenDepth.js +11 -0
  134. package/dist/compat/array/forEach.js +25 -0
  135. package/dist/compat/array/forEachRight.js +25 -0
  136. package/dist/compat/array/groupBy.js +19 -0
  137. package/dist/compat/array/head.js +16 -0
  138. package/dist/compat/array/includes.js +44 -0
  139. package/dist/compat/array/indexOf.js +26 -0
  140. package/dist/compat/array/initial.js +15 -0
  141. package/dist/compat/array/intersection.js +27 -0
  142. package/dist/compat/array/intersectionBy.js +40 -0
  143. package/dist/compat/array/intersectionWith.js +46 -0
  144. package/dist/compat/array/invokeMap.js +40 -0
  145. package/dist/compat/array/join.js +14 -0
  146. package/dist/compat/array/keyBy.js +23 -0
  147. package/dist/compat/array/last.js +16 -0
  148. package/dist/compat/array/lastIndexOf.js +26 -0
  149. package/dist/compat/array/map.js +25 -0
  150. package/dist/compat/array/nth.js +19 -0
  151. package/dist/compat/array/orderBy.js +82 -0
  152. package/dist/compat/array/partition.js +28 -0
  153. package/dist/compat/array/pull.js +11 -0
  154. package/dist/compat/array/pullAll.js +11 -0
  155. package/dist/compat/array/pullAllBy.js +26 -0
  156. package/dist/compat/array/pullAllWith.js +37 -0
  157. package/dist/compat/array/pullAt.js +38 -0
  158. package/dist/compat/array/reduce.js +37 -0
  159. package/dist/compat/array/reduceRight.js +43 -0
  160. package/dist/compat/array/reject.js +13 -0
  161. package/dist/compat/array/remove.js +12 -0
  162. package/dist/compat/array/reverse.js +12 -0
  163. package/dist/compat/array/sample.js +19 -0
  164. package/dist/compat/array/sampleSize.js +22 -0
  165. package/dist/compat/array/shuffle.js +28 -0
  166. package/dist/compat/array/size.js +17 -0
  167. package/dist/compat/array/slice.js +43 -0
  168. package/dist/compat/array/some.js +86 -0
  169. package/dist/compat/array/sortBy.js +20 -0
  170. package/dist/compat/array/sortedIndex.js +34 -0
  171. package/dist/compat/array/sortedIndexBy.js +62 -0
  172. package/dist/compat/array/sortedIndexOf.js +19 -0
  173. package/dist/compat/array/sortedLastIndex.js +35 -0
  174. package/dist/compat/array/sortedLastIndexBy.js +11 -0
  175. package/dist/compat/array/sortedLastIndexOf.js +19 -0
  176. package/dist/compat/array/tail.js +16 -0
  177. package/dist/compat/array/take.js +18 -0
  178. package/dist/compat/array/takeRight.js +18 -0
  179. package/dist/compat/array/takeRightWhile.js +19 -0
  180. package/dist/compat/array/takeWhile.js +19 -0
  181. package/dist/compat/array/union.js +15 -0
  182. package/dist/compat/array/unionBy.js +21 -0
  183. package/dist/compat/array/unionWith.js +20 -0
  184. package/dist/compat/array/uniq.js +15 -0
  185. package/dist/compat/array/uniqBy.js +16 -0
  186. package/dist/compat/array/uniqWith.js +16 -0
  187. package/dist/compat/array/unzip.js +18 -0
  188. package/dist/compat/array/unzipWith.js +25 -0
  189. package/dist/compat/array/without.js +15 -0
  190. package/dist/compat/array/xor.js +34 -0
  191. package/dist/compat/array/xorBy.js +27 -0
  192. package/dist/compat/array/xorWith.js +25 -0
  193. package/dist/compat/array/zip.js +15 -0
  194. package/dist/compat/array/zipObject.js +15 -0
  195. package/dist/compat/array/zipObjectDeep.js +27 -0
  196. package/dist/compat/array/zipWith.js +24 -0
  197. package/dist/compat/compat.d.mts +23 -15
  198. package/dist/compat/compat.d.ts +23 -15
  199. package/dist/compat/compat.js +595 -0
  200. package/dist/compat/compat.mjs +23 -15
  201. package/dist/compat/function/after.js +19 -0
  202. package/dist/compat/function/ary.js +17 -0
  203. package/dist/compat/function/attempt.js +14 -0
  204. package/dist/compat/function/before.js +24 -0
  205. package/dist/compat/function/bind.js +31 -0
  206. package/dist/compat/function/bindKey.js +31 -0
  207. package/dist/compat/function/curry.js +61 -0
  208. package/dist/compat/function/curryRight.js +68 -0
  209. package/dist/compat/function/debounce.js +50 -0
  210. package/dist/compat/function/defer.js +12 -0
  211. package/dist/compat/function/delay.js +14 -0
  212. package/dist/compat/function/flip.js +11 -0
  213. package/dist/compat/function/flow.js +16 -0
  214. package/dist/compat/function/flowRight.js +16 -0
  215. package/dist/compat/function/memoize.js +25 -0
  216. package/dist/compat/function/negate.js +14 -0
  217. package/dist/compat/function/nthArg.js +13 -0
  218. package/dist/compat/function/overArgs.d.mts +50 -0
  219. package/dist/compat/function/overArgs.d.ts +50 -0
  220. package/dist/compat/function/overArgs.js +24 -0
  221. package/dist/compat/function/overArgs.mjs +20 -0
  222. package/dist/compat/function/partial.js +12 -0
  223. package/dist/compat/function/partialRight.js +12 -0
  224. package/dist/compat/function/rearg.js +18 -0
  225. package/dist/compat/function/rest.js +15 -0
  226. package/dist/compat/function/spread.js +20 -0
  227. package/dist/compat/function/throttle.js +20 -0
  228. package/dist/compat/function/wrap.js +15 -0
  229. package/dist/compat/index.d.mts +23 -15
  230. package/dist/compat/index.d.ts +23 -15
  231. package/dist/compat/index.js +591 -5067
  232. package/dist/compat/index.mjs +23 -15
  233. package/dist/compat/math/add.js +26 -0
  234. package/dist/compat/math/ceil.js +11 -0
  235. package/dist/compat/math/clamp.js +17 -0
  236. package/dist/compat/math/divide.js +26 -0
  237. package/dist/compat/math/floor.js +11 -0
  238. package/dist/compat/math/inRange.js +32 -0
  239. package/dist/compat/math/max.js +22 -0
  240. package/dist/compat/math/maxBy.js +15 -0
  241. package/dist/compat/math/mean.js +12 -0
  242. package/dist/compat/math/meanBy.js +15 -0
  243. package/dist/compat/math/min.js +22 -0
  244. package/dist/compat/math/minBy.js +15 -0
  245. package/dist/compat/math/multiply.js +26 -0
  246. package/dist/compat/math/parseInt.js +12 -0
  247. package/dist/compat/math/random.js +74 -0
  248. package/dist/compat/math/range.js +30 -0
  249. package/dist/compat/math/rangeRight.js +30 -0
  250. package/dist/compat/math/round.js +11 -0
  251. package/dist/compat/math/subtract.js +26 -0
  252. package/dist/compat/math/sum.js +11 -0
  253. package/dist/compat/math/sumBy.js +29 -0
  254. package/dist/compat/object/assign.js +24 -0
  255. package/dist/compat/object/assignIn.js +24 -0
  256. package/dist/compat/object/assignInWith.js +34 -0
  257. package/dist/compat/object/assignWith.js +34 -0
  258. package/dist/compat/object/at.js +31 -0
  259. package/dist/compat/object/clone.js +164 -0
  260. package/dist/compat/object/cloneDeep.js +11 -0
  261. package/dist/compat/object/cloneDeepWith.js +39 -0
  262. package/dist/compat/object/cloneWith.js +18 -0
  263. package/dist/compat/object/create.js +22 -0
  264. package/dist/compat/object/defaults.js +31 -0
  265. package/dist/compat/object/defaultsDeep.d.mts +74 -0
  266. package/dist/compat/object/defaultsDeep.d.ts +74 -0
  267. package/dist/compat/object/defaultsDeep.js +47 -0
  268. package/dist/compat/object/defaultsDeep.mjs +43 -0
  269. package/dist/compat/object/findKey.d.mts +31 -8
  270. package/dist/compat/object/findKey.d.ts +31 -8
  271. package/dist/compat/object/findKey.js +17 -0
  272. package/dist/compat/object/findKey.mjs +3 -20
  273. package/dist/compat/object/findLastKey.d.mts +102 -0
  274. package/dist/compat/object/findLastKey.d.ts +102 -0
  275. package/dist/compat/object/findLastKey.js +17 -0
  276. package/dist/compat/object/findLastKey.mjs +13 -0
  277. package/dist/compat/object/forIn.js +20 -0
  278. package/dist/compat/object/forInRight.js +25 -0
  279. package/dist/compat/object/forOwn.js +23 -0
  280. package/dist/compat/object/forOwnRight.js +23 -0
  281. package/dist/compat/object/fromPairs.js +18 -0
  282. package/dist/compat/object/functions.js +14 -0
  283. package/dist/compat/object/functionsIn.js +20 -0
  284. package/dist/compat/object/get.js +72 -0
  285. package/dist/compat/object/has.js +38 -0
  286. package/dist/compat/object/hasIn.js +38 -0
  287. package/dist/compat/object/invertBy.js +31 -0
  288. package/dist/compat/object/keys.js +36 -0
  289. package/dist/compat/object/keysIn.js +57 -0
  290. package/dist/compat/object/mapKeys.js +24 -0
  291. package/dist/compat/object/mapValues.js +24 -0
  292. package/dist/compat/object/merge.js +12 -0
  293. package/dist/compat/object/mergeWith.js +92 -0
  294. package/dist/compat/object/omit.js +37 -0
  295. package/dist/compat/object/omitBy.js +30 -0
  296. package/dist/compat/object/pick.js +53 -0
  297. package/dist/compat/object/pickBy.js +30 -0
  298. package/dist/compat/object/property.js +13 -0
  299. package/dist/compat/object/propertyOf.js +13 -0
  300. package/dist/compat/object/result.js +28 -0
  301. package/dist/compat/object/set.js +11 -0
  302. package/dist/compat/object/setWith.js +18 -0
  303. package/dist/compat/object/toDefaulted.js +13 -0
  304. package/dist/compat/object/toPairs.js +26 -0
  305. package/dist/compat/object/toPairsIn.js +26 -0
  306. package/dist/compat/object/transform.js +34 -0
  307. package/dist/compat/object/unset.js +72 -0
  308. package/dist/compat/object/update.js +11 -0
  309. package/dist/compat/object/updateWith.js +48 -0
  310. package/dist/compat/object/values.js +9 -0
  311. package/dist/compat/object/valuesIn.js +17 -0
  312. package/dist/compat/predicate/conforms.js +15 -0
  313. package/dist/compat/predicate/conformsTo.js +24 -0
  314. package/dist/compat/predicate/isArguments.js +11 -0
  315. package/dist/compat/predicate/isArray.js +9 -0
  316. package/dist/compat/predicate/isArrayBuffer.js +11 -0
  317. package/dist/compat/predicate/isArrayLike.js +11 -0
  318. package/dist/compat/predicate/isArrayLikeObject.js +12 -0
  319. package/dist/compat/predicate/isBoolean.js +9 -0
  320. package/dist/compat/predicate/isBuffer.js +11 -0
  321. package/dist/compat/predicate/isDate.js +11 -0
  322. package/dist/compat/predicate/isElement.js +12 -0
  323. package/dist/compat/predicate/isEmpty.js +37 -0
  324. package/dist/compat/predicate/isEqualWith.js +27 -0
  325. package/dist/compat/predicate/isError.js +11 -0
  326. package/dist/compat/predicate/isFinite.js +9 -0
  327. package/dist/compat/predicate/isInteger.js +9 -0
  328. package/dist/compat/predicate/isMap.js +11 -0
  329. package/dist/compat/predicate/isMatch.js +11 -0
  330. package/dist/compat/predicate/isMatch.mjs +3 -98
  331. package/dist/compat/predicate/isMatchWith.d.mts +72 -0
  332. package/dist/compat/predicate/isMatchWith.d.ts +72 -0
  333. package/dist/compat/predicate/isMatchWith.js +156 -0
  334. package/dist/compat/predicate/isMatchWith.mjs +151 -0
  335. package/dist/compat/predicate/isNaN.js +9 -0
  336. package/dist/compat/predicate/isNative.js +21 -0
  337. package/dist/compat/predicate/isNil.js +9 -0
  338. package/dist/compat/predicate/isNumber.js +9 -0
  339. package/dist/compat/predicate/isObject.js +9 -0
  340. package/dist/compat/predicate/isObjectLike.js +9 -0
  341. package/dist/compat/predicate/isPlainObject.js +33 -0
  342. package/dist/compat/predicate/isRegExp.js +11 -0
  343. package/dist/compat/predicate/isSafeInteger.js +9 -0
  344. package/dist/compat/predicate/isSet.js +11 -0
  345. package/dist/compat/predicate/isString.js +9 -0
  346. package/dist/compat/predicate/isSymbol.js +9 -0
  347. package/dist/compat/predicate/isTypedArray.js +11 -0
  348. package/dist/compat/predicate/isWeakMap.js +11 -0
  349. package/dist/compat/predicate/isWeakSet.js +11 -0
  350. package/dist/compat/predicate/matches.js +15 -0
  351. package/dist/compat/predicate/matchesProperty.js +37 -0
  352. package/dist/compat/string/camelCase.js +12 -0
  353. package/dist/compat/string/deburr.js +12 -0
  354. package/dist/compat/string/endsWith.js +9 -0
  355. package/dist/compat/string/escape.js +12 -0
  356. package/dist/compat/string/escapeRegExp.js +12 -0
  357. package/dist/compat/string/kebabCase.js +12 -0
  358. package/dist/compat/string/lowerCase.js +12 -0
  359. package/dist/compat/string/lowerFirst.js +12 -0
  360. package/dist/compat/string/pad.js +12 -0
  361. package/dist/compat/string/padEnd.js +11 -0
  362. package/dist/compat/string/padStart.js +11 -0
  363. package/dist/compat/string/repeat.js +19 -0
  364. package/dist/compat/string/replace.js +14 -0
  365. package/dist/compat/string/snakeCase.js +12 -0
  366. package/dist/compat/string/split.js +11 -0
  367. package/dist/compat/string/startCase.js +26 -0
  368. package/dist/compat/string/startsWith.js +9 -0
  369. package/dist/compat/string/template.js +91 -0
  370. package/dist/compat/string/toLower.js +11 -0
  371. package/dist/compat/string/toUpper.js +11 -0
  372. package/dist/compat/string/trim.js +29 -0
  373. package/dist/compat/string/trimEnd.js +29 -0
  374. package/dist/compat/string/trimStart.js +29 -0
  375. package/dist/compat/string/truncate.d.mts +34 -0
  376. package/dist/compat/string/truncate.d.ts +34 -0
  377. package/dist/compat/string/truncate.js +52 -0
  378. package/dist/compat/string/truncate.mjs +48 -0
  379. package/dist/compat/string/unescape.js +12 -0
  380. package/dist/compat/string/upperCase.js +12 -0
  381. package/dist/compat/string/upperFirst.js +12 -0
  382. package/dist/compat/string/words.js +35 -0
  383. package/dist/compat/toolkit.js +14 -0
  384. package/dist/compat/util/bindAll.js +47 -0
  385. package/dist/compat/util/cond.js +30 -0
  386. package/dist/compat/util/constant.js +9 -0
  387. package/dist/compat/util/defaultTo.js +12 -0
  388. package/dist/compat/util/eq.js +9 -0
  389. package/dist/compat/util/gt.js +14 -0
  390. package/dist/compat/util/gte.js +14 -0
  391. package/dist/compat/util/invoke.js +52 -0
  392. package/dist/compat/util/iteratee.js +32 -0
  393. package/dist/compat/util/lt.js +14 -0
  394. package/dist/compat/util/lte.js +14 -0
  395. package/dist/compat/util/method.js +13 -0
  396. package/dist/compat/util/methodOf.js +13 -0
  397. package/dist/compat/util/now.js +9 -0
  398. package/dist/compat/util/over.js +17 -0
  399. package/dist/compat/util/overEvery.js +27 -0
  400. package/dist/compat/util/overSome.js +27 -0
  401. package/dist/compat/util/stubArray.js +9 -0
  402. package/dist/compat/util/stubFalse.js +9 -0
  403. package/dist/compat/util/stubObject.js +9 -0
  404. package/dist/compat/util/stubString.js +9 -0
  405. package/dist/compat/util/stubTrue.js +9 -0
  406. package/dist/compat/util/times.js +19 -0
  407. package/dist/compat/util/toArray.js +21 -0
  408. package/dist/compat/util/toFinite.js +19 -0
  409. package/dist/compat/util/toInteger.js +13 -0
  410. package/dist/compat/util/toLength.js +16 -0
  411. package/dist/compat/util/toNumber.js +14 -0
  412. package/dist/compat/util/toPath.js +72 -0
  413. package/dist/compat/util/toPlainObject.js +28 -0
  414. package/dist/compat/util/toSafeInteger.js +16 -0
  415. package/dist/compat/util/toString.js +22 -0
  416. package/dist/compat/util/uniqueId.js +11 -0
  417. package/dist/{_chunk/AbortError-Cg4ZQ1.js → error/AbortError.js} +2 -0
  418. package/dist/error/TimeoutError.js +12 -0
  419. package/dist/error/index.js +4 -8
  420. package/dist/function/after.js +18 -0
  421. package/dist/function/ary.js +11 -0
  422. package/dist/function/asyncNoop.js +7 -0
  423. package/dist/function/before.js +18 -0
  424. package/dist/function/curry.js +25 -0
  425. package/dist/function/curryRight.js +25 -0
  426. package/dist/function/debounce.js +67 -0
  427. package/dist/function/flow.js +15 -0
  428. package/dist/function/flowRight.js +11 -0
  429. package/dist/function/identity.js +9 -0
  430. package/dist/function/index.js +44 -153
  431. package/dist/function/memoize.js +20 -0
  432. package/dist/function/negate.js +9 -0
  433. package/dist/function/noop.js +7 -0
  434. package/dist/function/once.js +17 -0
  435. package/dist/function/partial.js +26 -0
  436. package/dist/function/partialRight.js +28 -0
  437. package/dist/function/rest.js +16 -0
  438. package/dist/function/retry.js +40 -0
  439. package/dist/function/spread.js +11 -0
  440. package/dist/function/throttle.js +27 -0
  441. package/dist/function/unary.js +11 -0
  442. package/dist/index.js +339 -188
  443. package/dist/math/clamp.js +12 -0
  444. package/dist/math/inRange.js +16 -0
  445. package/dist/math/index.js +28 -66
  446. package/dist/math/mean.js +11 -0
  447. package/dist/math/meanBy.js +12 -0
  448. package/dist/math/median.js +19 -0
  449. package/dist/math/medianBy.js +12 -0
  450. package/dist/{_chunk/randomInt-CF7bZK.js → math/random.js} +2 -5
  451. package/dist/math/randomInt.js +11 -0
  452. package/dist/math/range.js +21 -0
  453. package/dist/math/rangeRight.js +21 -0
  454. package/dist/math/round.js +13 -0
  455. package/dist/math/sum.js +13 -0
  456. package/dist/math/sumBy.js +13 -0
  457. package/dist/object/clone.js +49 -0
  458. package/dist/object/cloneDeep.js +11 -0
  459. package/dist/object/cloneDeepWith.js +160 -0
  460. package/dist/object/findKey.js +10 -0
  461. package/dist/object/flattenObject.js +30 -0
  462. package/dist/object/index.js +37 -182
  463. package/dist/object/invert.js +16 -0
  464. package/dist/object/mapKeys.js +16 -0
  465. package/dist/object/mapValues.js +16 -0
  466. package/dist/object/merge.js +36 -0
  467. package/dist/object/mergeWith.js +30 -0
  468. package/dist/object/omit.js +14 -0
  469. package/dist/object/omitBy.js +18 -0
  470. package/dist/object/pick.js +16 -0
  471. package/dist/object/pickBy.js +18 -0
  472. package/dist/object/toCamelCaseKeys.js +27 -0
  473. package/dist/object/toMerged.js +12 -0
  474. package/dist/object/toSnakeCaseKeys.js +27 -0
  475. package/dist/predicate/index.js +61 -125
  476. package/dist/predicate/isArrayBuffer.js +9 -0
  477. package/dist/predicate/isBlob.js +12 -0
  478. package/dist/predicate/isBoolean.js +9 -0
  479. package/dist/predicate/isBrowser.js +9 -0
  480. package/dist/predicate/isBuffer.js +9 -0
  481. package/dist/predicate/isDate.js +9 -0
  482. package/dist/predicate/isEqual.js +12 -0
  483. package/dist/{_chunk/isWeakSet-403Sh5.js → predicate/isEqualWith.js} +40 -115
  484. package/dist/predicate/isError.js +9 -0
  485. package/dist/predicate/isFile.js +14 -0
  486. package/dist/predicate/isFunction.js +9 -0
  487. package/dist/predicate/isJSON.js +18 -0
  488. package/dist/predicate/isJSONValue.js +48 -0
  489. package/dist/predicate/isLength.js +9 -0
  490. package/dist/predicate/isMap.js +9 -0
  491. package/dist/predicate/isNil.js +9 -0
  492. package/dist/predicate/isNode.js +9 -0
  493. package/dist/predicate/isNotNil.js +9 -0
  494. package/dist/predicate/isNull.js +9 -0
  495. package/dist/predicate/isPlainObject.js +19 -0
  496. package/dist/predicate/isPrimitive.js +9 -0
  497. package/dist/predicate/isPromise.js +9 -0
  498. package/dist/predicate/isRegExp.js +9 -0
  499. package/dist/predicate/isSet.js +9 -0
  500. package/dist/predicate/isString.js +9 -0
  501. package/dist/predicate/isSymbol.js +9 -0
  502. package/dist/predicate/isTypedArray.js +9 -0
  503. package/dist/predicate/isUndefined.js +9 -0
  504. package/dist/predicate/isWeakMap.js +9 -0
  505. package/dist/predicate/isWeakSet.js +9 -0
  506. package/dist/{_chunk/delay-_VMfFa.js → promise/delay.js} +3 -1
  507. package/dist/promise/index.js +9 -55
  508. package/dist/promise/mutex.js +20 -0
  509. package/dist/promise/semaphore.js +34 -0
  510. package/dist/promise/timeout.js +13 -0
  511. package/dist/promise/withTimeout.js +11 -0
  512. package/dist/string/camelCase.js +17 -0
  513. package/dist/string/capitalize.js +9 -0
  514. package/dist/string/constantCase.js +12 -0
  515. package/dist/string/deburr.js +49 -0
  516. package/dist/string/escape.js +16 -0
  517. package/dist/string/escapeRegExp.js +9 -0
  518. package/dist/string/index.js +40 -46
  519. package/dist/string/kebabCase.js +12 -0
  520. package/dist/string/lowerCase.js +12 -0
  521. package/dist/string/lowerFirst.js +9 -0
  522. package/dist/string/pad.js +9 -0
  523. package/dist/string/pascalCase.js +13 -0
  524. package/dist/string/reverseString.js +9 -0
  525. package/dist/string/snakeCase.js +12 -0
  526. package/dist/string/startCase.js +20 -0
  527. package/dist/string/trim.js +15 -0
  528. package/dist/string/trimEnd.js +29 -0
  529. package/dist/string/trimStart.js +26 -0
  530. package/dist/string/unescape.js +16 -0
  531. package/dist/string/upperCase.js +19 -0
  532. package/dist/string/upperFirst.js +9 -0
  533. package/dist/string/words.js +11 -0
  534. package/dist/util/attempt.js +14 -0
  535. package/dist/util/attemptAsync.js +15 -0
  536. package/dist/util/index.js +7 -30
  537. package/dist/util/invariant.js +15 -0
  538. package/error.js +1 -0
  539. package/function.js +1 -0
  540. package/math.js +1 -0
  541. package/object.js +1 -0
  542. package/package.json +26 -3
  543. package/predicate.js +1 -0
  544. package/promise.js +1 -0
  545. package/string.js +1 -0
  546. package/util.js +1 -0
  547. package/dist/_chunk/isPlainObject-DINLyA.js +0 -281
  548. package/dist/_chunk/noop-2IwLUk.js +0 -5
  549. package/dist/_chunk/range-DSpBDL.js +0 -59
  550. package/dist/_chunk/snakeCase-6cG1f4.js +0 -29
  551. package/dist/_chunk/unary-BVQ0iC.js +0 -188
  552. package/dist/_chunk/upperFirst-Cx78bs.js +0 -173
  553. package/dist/_chunk/zip-Cyyp17.js +0 -421
package/CHANGELOG.md CHANGED
@@ -1,8 +1,30 @@
1
1
  # es-toolkit Changelog
2
2
 
3
+ ## Version v1.39.0
4
+
5
+ 🎉 Released on June 5th, 2025. 🎉
6
+
7
+ We're thrilled to announce that `es-toolkit/compat` has achieved full compatibility with Lodash! 🎉
8
+
9
+ A huge thank you to all our contributors who made this possible.
10
+
11
+ - Introduced compatibility functions for [defaultsDeep](https://es-toolkit.slash.page/reference/compat/object/defaultsDeep.html), [isMatchWith](https://es-toolkit.slash.page/reference/compat/predicate/isMatchWith.html), [flatMapDepth](https://es-toolkit.slash.page/reference/compat/array/flatMapDepth.html), [flatMapDeep](https://es-toolkit.slash.page/reference/compat/array/flatMapDeep.html), [overArgs](https://es-toolkit.slash.page/reference/compat/function/overArgs.html), [findLastKey](https://es-toolkit.slash.page/reference/compat/object/findLastKey.html) and [truncate](https://es-toolkit.slash.page/reference/compat/string/truncate.html).
12
+ - Enhanced build system to support `es-toolkit/compat/*` module imports.
13
+ - Fixed special functions like `each` to ensure proper functionality.
14
+ - Fixed Deno compatibility issues for `defaultsDeep` function.
15
+ - Fixed import paths in Deno environment.
16
+ - Added benchmark comparing es-toolkit and lodash `identity` function performance.
17
+ - Improved documentation and test coverage for various functions.
18
+
19
+ We sincerely thank @raon0211, @dayongkr, @mreiden, @hwibaski, @shren207, @jiji-hoon96, and @myungjuice for their contributions. We appreciate your great efforts!
20
+
21
+ ### ⭐️ Special Thanks to Our Amazing Contributors Who Made 100% Compatibility Possible ⭐️
22
+
23
+ @raon0211, @dayongkr, @D-Sketon, @mass2527, @ssi02014, @shren207, @chhw130, @haejunejung, @jsparkdev, @manudeli, @jgjgill, @hyesungoh, @kaehehehe, @filipsobol, @fvsch, @wondonghwi, @seungrodotlee, @bertyhell, @minchodang, @Jeong-Rae, @kangju2000, @juno7803, @wojtekmaj, @mattiacoll, @changwoolab, @po4tion, @gyumong, @choi2021, @mancuoj, @de-novo, @eunhyulkim, @kim-sung-jee, @gs18004, @Hanna922, @Na-hyunwoo, @aken-you, @tanggd, @ho991217, @piquark6046, @jiji-hoon96, @seonghun0828, @pkovzz, @nnnnoel, @noelkim-prestolabs, @minsoo-web, @hautest, @scato3, @l2hyunwoo, @WooWan, @VVSOGI, @k-jeonghee, @knott11, @lukaszkowalik2, @moonheekim0118, @sadobass, @minjongbaek, @umsungjun, @sossost, @sunrabbit123, @Seung-wan, @cruelladevil, @iDevGon, @oror-sine, @1eeminhyeong, @benzyminzy, @BlackWhite2000, @tooooo1, @L2HYUNN, @DonghyunKim98, @dasom-jo, @guesung, @uniqueeest, @KiKoS0, @myungjuice, @seung-juv, @Collection50, @nowethan, @coding-honey, @ariandel-dev, @apeltop, @jch1223, @yhay81, @milooy, @raviqqe, @youznn, @BinskLee, @YEONDG, @shinwonse, @willmanduffy, @vjo, @touhidrahman, @T3sT3ro, @belgattitude, @WISUNGWON, @anaclumos, @hsskey, @BasixKOR, @Kyujenius, @Dohun-choi, @dngur9801, @sanginchun, @westofsky, @DONG-8, @yhmpc, @pbstar, @MoXiaoluo, @uussong, @tuhm1, @tisou1, @spookyuser, @sa02045, @Hotanya, @nia3y, @mreiden, @kms0219kms, @IkumaTadokoro, @hansolbangul, @hainan-612, @hwibaski, @jeongshin, @HoberMin, @ohprettyhak, @gweesin, @FengBuPi, @kyvg, @evan-moon, @chldmsqls34, @kimpuro, @dogagenc, @Duck-98, @redd97, @faner11, @bhollis, @jaehunn, @babay123, @beomxtone, @ankitjha420, @shan-mx, @2skydev, @StyleShit, @confidential-nt, @siddsarkar, @seongminn, @healtheloper, @pnodet, @Gaic4o, @leeminhee119, @leehj322, @kristian240, @kingston, @kim-dongho, @jungwoo3490, @joris-gallot, @jonganebski, @jiwooproity, @moshuying, @jakvbs, @therealjamesjung, @SaeWooKKang and @HyeokjaeLee
24
+
3
25
  ## Version v1.38.0
4
26
 
5
- Released on May 5th, 2025.
27
+ Released on May 18th, 2025.
6
28
 
7
29
  - Added compatibility functions for [bindAll](https://es-toolkit.slash.page/reference/compat/util/bindAll.html), [setWith](https://es-toolkit.slash.page/reference/compat/object/setWith.html), [memoize](https://es-toolkit.slash.page/reference/function/memoize.html), [isNative](https://es-toolkit.slash.page/reference/compat/predicate/isNative.html), [invokeMap](https://es-toolkit.slash.page/reference/compat/array/invokeMap.html), [clone](https://es-toolkit.slash.page/reference/object/clone.html), [cloneWith](https://es-toolkit.slash.page/reference/compat/object/cloneWith.html), and [sortedLastIndexOf](https://es-toolkit.slash.page/reference/compat/array/sortedLastIndexOf.html).
8
30
  - Enhanced [invariant](https://es-toolkit.slash.page/reference/util/invariant.html) function to accept Error instances and added [assert](https://es-toolkit.slash.page/reference/util/assert.html) alias.
package/README.md CHANGED
@@ -9,6 +9,7 @@ es-toolkit is a state-of-the-art, high-performance JavaScript utility library wi
9
9
  - es-toolkit offers a variety of everyday utility functions with modern implementations, such as [debounce](https://es-toolkit.slash.page/reference/function/debounce.html), [delay](https://es-toolkit.slash.page/reference/promise/delay.html), [chunk](https://es-toolkit.slash.page/reference/array/chunk.html), [sum](https://es-toolkit.slash.page/reference/math/sum.html), and [pick](https://es-toolkit.slash.page/reference/object/pick.html).
10
10
  - Designed with performance in mind, es-toolkit achieves [2-3× better performance](https://es-toolkit.slash.page/performance.html) in modern JavaScript environments.
11
11
  - es-toolkit supports tree shaking out of the box, and [reduces JavaScript code by up to 97%](https://es-toolkit.slash.page/bundle-size.html) compared to other libraries.
12
+ - es-toolkit offers a complete compatibility layer to seamlessly replace lodash, available as [es-toolkit/compat](https://es-toolkit.slash.page/compatibility.html).
12
13
  - es-toolkit includes built-in TypeScript support, with straightforward yet robust types. It also provides useful type guards such as [isNotNil](https://es-toolkit.slash.page/reference/predicate/isNotNil.html).
13
14
  - es-toolkit is utilized by several popular open-source libraries, such as [Storybook](https://github.com/storybookjs/storybook/blob/9d862798d666678cc4822e857c00bbd744169ced/code/core/package.json#L358) and [ink](https://github.com/vadimdemedes/ink/blob/2090ad9779be59dea71d173eb49785b7bd4495d0/package.json#L55).
14
15
  - es-toolkit is battle-tested with 100% test coverage, ensuring reliability and robustness.
package/array.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/array');
@@ -0,0 +1 @@
1
+ export { forEach as default } from '../dist/compat/array/forEach.js';
package/compat/each.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/compat/array/forEach.js').forEach;
@@ -0,0 +1 @@
1
+ export { forEachRight as default } from '../dist/compat/array/forEachRight.js';
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/compat/array/forEachRight.js').forEachRight;
@@ -0,0 +1 @@
1
+ export { assignIn as default } from '../dist/compat/object/assignIn.js';
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/compat/object/assignIn.js').assignIn;
@@ -0,0 +1 @@
1
+ export { assignInWith as default } from '../dist/compat/object/assignInWith.js';
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/compat/object/assignInWith.js').assignInWith;
@@ -0,0 +1 @@
1
+ export { head as default } from '../dist/compat/array/head.js';
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/compat/array/head.js').head;
package/compat.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/compat');
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function compareValues(a, b, order) {
6
+ if (a < b) {
7
+ return order === 'asc' ? -1 : 1;
8
+ }
9
+ if (a > b) {
10
+ return order === 'asc' ? 1 : -1;
11
+ }
12
+ return 0;
13
+ }
14
+
15
+ exports.compareValues = compareValues;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function at(arr, indices) {
6
+ const result = new Array(indices.length);
7
+ const length = arr.length;
8
+ for (let i = 0; i < indices.length; i++) {
9
+ let index = indices[i];
10
+ index = Number.isInteger(index) ? index : Math.trunc(index) || 0;
11
+ if (index < 0) {
12
+ index += length;
13
+ }
14
+ result[i] = arr[index];
15
+ }
16
+ return result;
17
+ }
18
+
19
+ exports.at = at;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function chunk(arr, size) {
6
+ if (!Number.isInteger(size) || size <= 0) {
7
+ throw new Error('Size must be an integer greater than zero.');
8
+ }
9
+ const chunkLength = Math.ceil(arr.length / size);
10
+ const result = Array(chunkLength);
11
+ for (let index = 0; index < chunkLength; index++) {
12
+ const start = index * size;
13
+ const end = start + size;
14
+ result[index] = arr.slice(start, end);
15
+ }
16
+ return result;
17
+ }
18
+
19
+ exports.chunk = chunk;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function compact(arr) {
6
+ const result = [];
7
+ for (let i = 0; i < arr.length; i++) {
8
+ const item = arr[i];
9
+ if (item) {
10
+ result.push(item);
11
+ }
12
+ }
13
+ return result;
14
+ }
15
+
16
+ exports.compact = compact;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function countBy(arr, mapper) {
6
+ const result = {};
7
+ for (let i = 0; i < arr.length; i++) {
8
+ const item = arr[i];
9
+ const key = mapper(item);
10
+ result[key] = (result[key] ?? 0) + 1;
11
+ }
12
+ return result;
13
+ }
14
+
15
+ exports.countBy = countBy;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function difference(firstArr, secondArr) {
6
+ const secondSet = new Set(secondArr);
7
+ return firstArr.filter(item => !secondSet.has(item));
8
+ }
9
+
10
+ exports.difference = difference;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function differenceBy(firstArr, secondArr, mapper) {
6
+ const mappedSecondSet = new Set(secondArr.map(item => mapper(item)));
7
+ return firstArr.filter(item => {
8
+ return !mappedSecondSet.has(mapper(item));
9
+ });
10
+ }
11
+
12
+ exports.differenceBy = differenceBy;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function differenceWith(firstArr, secondArr, areItemsEqual) {
6
+ return firstArr.filter(firstItem => {
7
+ return secondArr.every(secondItem => {
8
+ return !areItemsEqual(firstItem, secondItem);
9
+ });
10
+ });
11
+ }
12
+
13
+ exports.differenceWith = differenceWith;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function drop(arr, itemsCount) {
6
+ itemsCount = Math.max(itemsCount, 0);
7
+ return arr.slice(itemsCount);
8
+ }
9
+
10
+ exports.drop = drop;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function dropRight(arr, itemsCount) {
6
+ itemsCount = Math.min(-itemsCount, 0);
7
+ if (itemsCount === 0) {
8
+ return arr.slice();
9
+ }
10
+ return arr.slice(0, itemsCount);
11
+ }
12
+
13
+ exports.dropRight = dropRight;
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function dropRightWhile(arr, canContinueDropping) {
6
+ for (let i = arr.length - 1; i >= 0; i--) {
7
+ if (!canContinueDropping(arr[i], i, arr)) {
8
+ return arr.slice(0, i + 1);
9
+ }
10
+ }
11
+ return [];
12
+ }
13
+
14
+ exports.dropRightWhile = dropRightWhile;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function dropWhile(arr, canContinueDropping) {
6
+ const dropEndIndex = arr.findIndex((item, index, arr) => !canContinueDropping(item, index, arr));
7
+ if (dropEndIndex === -1) {
8
+ return [];
9
+ }
10
+ return arr.slice(dropEndIndex);
11
+ }
12
+
13
+ exports.dropWhile = dropWhile;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function fill(array, value, start = 0, end = array.length) {
6
+ const length = array.length;
7
+ const finalStart = Math.max(start >= 0 ? start : length + start, 0);
8
+ const finalEnd = Math.min(end >= 0 ? end : length + end, length);
9
+ for (let i = finalStart; i < finalEnd; i++) {
10
+ array[i] = value;
11
+ }
12
+ return array;
13
+ }
14
+
15
+ exports.fill = fill;
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const flatten = require('./flatten.js');
6
+
7
+ function flatMap(arr, iteratee, depth = 1) {
8
+ return flatten.flatten(arr.map(item => iteratee(item)), depth);
9
+ }
10
+
11
+ exports.flatMap = flatMap;
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const flattenDeep = require('./flattenDeep.js');
6
+
7
+ function flatMapDeep(arr, iteratee) {
8
+ return flattenDeep.flattenDeep(arr.map((item) => iteratee(item)));
9
+ }
10
+
11
+ exports.flatMapDeep = flatMapDeep;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function flatten(arr, depth = 1) {
6
+ const result = [];
7
+ const flooredDepth = Math.floor(depth);
8
+ const recursive = (arr, currentDepth) => {
9
+ for (let i = 0; i < arr.length; i++) {
10
+ const item = arr[i];
11
+ if (Array.isArray(item) && currentDepth < flooredDepth) {
12
+ recursive(item, currentDepth + 1);
13
+ }
14
+ else {
15
+ result.push(item);
16
+ }
17
+ }
18
+ };
19
+ recursive(arr, 0);
20
+ return result;
21
+ }
22
+
23
+ exports.flatten = flatten;
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const flatten = require('./flatten.js');
6
+
7
+ function flattenDeep(arr) {
8
+ return flatten.flatten(arr, Infinity);
9
+ }
10
+
11
+ exports.flattenDeep = flattenDeep;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function forEachRight(arr, callback) {
6
+ for (let i = arr.length - 1; i >= 0; i--) {
7
+ const element = arr[i];
8
+ callback(element, i, arr);
9
+ }
10
+ }
11
+
12
+ exports.forEachRight = forEachRight;
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function groupBy(arr, getKeyFromItem) {
6
+ const result = {};
7
+ for (let i = 0; i < arr.length; i++) {
8
+ const item = arr[i];
9
+ const key = getKeyFromItem(item);
10
+ if (!Object.hasOwn(result, key)) {
11
+ result[key] = [];
12
+ }
13
+ result[key].push(item);
14
+ }
15
+ return result;
16
+ }
17
+
18
+ exports.groupBy = groupBy;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function head(arr) {
6
+ return arr[0];
7
+ }
8
+
9
+ exports.head = head;