es-toolkit 1.50.0 → 1.51.0-dev.2069

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 (495) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/NOTICE +39 -0
  3. package/README.md +2 -2
  4. package/bigint.d.ts +1 -0
  5. package/bigint.js +1 -0
  6. package/dist/_internal/NonPlainObject.d.mts +8 -0
  7. package/dist/_internal/NonPlainObject.d.ts +8 -0
  8. package/dist/_internal/bigIntRangeLength.js +19 -0
  9. package/dist/_internal/bigIntRangeLength.mjs +19 -0
  10. package/dist/_internal/isMergeableValue.js +17 -0
  11. package/dist/_internal/isMergeableValue.mjs +17 -0
  12. package/dist/_internal/isUnsafeProperty.js +7 -4
  13. package/dist/_internal/isUnsafeProperty.mjs +7 -4
  14. package/dist/_internal/isUnsafeToWriteProperty.js +22 -0
  15. package/dist/_internal/isUnsafeToWriteProperty.mjs +22 -0
  16. package/dist/array/at.d.mts +1 -1
  17. package/dist/array/at.d.ts +1 -1
  18. package/dist/array/filterAsync.js +1 -1
  19. package/dist/array/filterAsync.mjs +1 -1
  20. package/dist/array/flatMapAsync.js +1 -1
  21. package/dist/array/flatMapAsync.mjs +1 -1
  22. package/dist/array/forEachAsync.js +1 -1
  23. package/dist/array/forEachAsync.mjs +1 -1
  24. package/dist/array/index.js +1 -1
  25. package/dist/array/index.mjs +1 -1
  26. package/dist/array/limitAsync.d.mts +4 -28
  27. package/dist/array/limitAsync.d.ts +4 -28
  28. package/dist/array/limitAsync.js +2 -39
  29. package/dist/array/limitAsync.mjs +3 -39
  30. package/dist/array/mapAsync.js +1 -1
  31. package/dist/array/mapAsync.mjs +1 -1
  32. package/dist/array/orderBy.d.mts +1 -1
  33. package/dist/array/orderBy.d.ts +1 -1
  34. package/dist/array/pullAt.d.mts +1 -1
  35. package/dist/array/pullAt.d.ts +1 -1
  36. package/dist/array/pullAt.js +1 -1
  37. package/dist/array/pullAt.mjs +1 -1
  38. package/dist/array/sortBy.d.mts +1 -1
  39. package/dist/array/sortBy.d.ts +1 -1
  40. package/dist/array/unzip.d.mts +3 -0
  41. package/dist/array/unzip.d.ts +3 -0
  42. package/dist/array/unzip.js +3 -0
  43. package/dist/array/unzip.mjs +3 -0
  44. package/dist/bigint/clamp.d.mts +37 -0
  45. package/dist/bigint/clamp.d.ts +37 -0
  46. package/dist/bigint/clamp.js +16 -0
  47. package/dist/bigint/clamp.mjs +16 -0
  48. package/dist/bigint/inRange.d.mts +37 -0
  49. package/dist/bigint/inRange.d.ts +37 -0
  50. package/dist/bigint/inRange.js +20 -0
  51. package/dist/bigint/inRange.mjs +20 -0
  52. package/dist/bigint/index.d.mts +14 -0
  53. package/dist/bigint/index.d.ts +14 -0
  54. package/dist/bigint/index.js +27 -0
  55. package/dist/bigint/index.mjs +14 -0
  56. package/dist/bigint/max.d.mts +21 -0
  57. package/dist/bigint/max.d.ts +21 -0
  58. package/dist/bigint/max.js +26 -0
  59. package/dist/bigint/max.mjs +26 -0
  60. package/dist/bigint/maxBy.d.mts +21 -0
  61. package/dist/bigint/maxBy.d.ts +21 -0
  62. package/dist/bigint/maxBy.js +34 -0
  63. package/dist/bigint/maxBy.mjs +34 -0
  64. package/dist/bigint/median.d.mts +22 -0
  65. package/dist/bigint/median.d.ts +22 -0
  66. package/dist/bigint/median.js +28 -0
  67. package/dist/bigint/median.mjs +28 -0
  68. package/dist/bigint/medianBy.d.mts +21 -0
  69. package/dist/bigint/medianBy.d.ts +21 -0
  70. package/dist/bigint/medianBy.js +24 -0
  71. package/dist/bigint/medianBy.mjs +24 -0
  72. package/dist/bigint/min.d.mts +18 -0
  73. package/dist/bigint/min.d.ts +18 -0
  74. package/dist/bigint/min.js +23 -0
  75. package/dist/bigint/min.mjs +23 -0
  76. package/dist/bigint/minBy.d.mts +21 -0
  77. package/dist/bigint/minBy.d.ts +21 -0
  78. package/dist/bigint/minBy.js +34 -0
  79. package/dist/bigint/minBy.mjs +34 -0
  80. package/dist/bigint/percentile.d.mts +23 -0
  81. package/dist/bigint/percentile.d.ts +23 -0
  82. package/dist/bigint/percentile.js +31 -0
  83. package/dist/bigint/percentile.mjs +31 -0
  84. package/dist/bigint/range.d.mts +45 -0
  85. package/dist/bigint/range.d.ts +45 -0
  86. package/dist/bigint/range.js +24 -0
  87. package/dist/bigint/range.mjs +24 -0
  88. package/dist/bigint/rangeRight.d.mts +43 -0
  89. package/dist/bigint/rangeRight.d.ts +43 -0
  90. package/dist/bigint/rangeRight.js +25 -0
  91. package/dist/bigint/rangeRight.mjs +25 -0
  92. package/dist/bigint/sum.d.mts +18 -0
  93. package/dist/bigint/sum.d.ts +18 -0
  94. package/dist/bigint/sum.js +22 -0
  95. package/dist/bigint/sum.mjs +22 -0
  96. package/dist/bigint/sumBy.d.mts +20 -0
  97. package/dist/bigint/sumBy.d.ts +20 -0
  98. package/dist/bigint/sumBy.js +24 -0
  99. package/dist/bigint/sumBy.mjs +24 -0
  100. package/dist/browser.global.js +6 -3
  101. package/dist/compat/_internal/normalizeZero.js +13 -0
  102. package/dist/compat/_internal/normalizeZero.mjs +13 -0
  103. package/dist/compat/_internal/toKey.js +1 -1
  104. package/dist/compat/_internal/toKey.mjs +1 -1
  105. package/dist/compat/_internal/unicodeSize.js +45 -0
  106. package/dist/compat/_internal/unicodeSize.mjs +45 -0
  107. package/dist/compat/array/chunk.js +1 -0
  108. package/dist/compat/array/chunk.mjs +1 -0
  109. package/dist/compat/array/difference.js +2 -1
  110. package/dist/compat/array/difference.mjs +2 -1
  111. package/dist/compat/array/differenceBy.js +3 -2
  112. package/dist/compat/array/differenceBy.mjs +3 -2
  113. package/dist/compat/array/drop.d.mts +1 -1
  114. package/dist/compat/array/drop.d.ts +1 -1
  115. package/dist/compat/array/dropRight.d.mts +2 -3
  116. package/dist/compat/array/dropRight.d.ts +2 -3
  117. package/dist/compat/array/dropRight.js +4 -4
  118. package/dist/compat/array/dropRight.mjs +4 -4
  119. package/dist/compat/array/every.js +9 -9
  120. package/dist/compat/array/every.mjs +9 -9
  121. package/dist/compat/array/fill.js +8 -2
  122. package/dist/compat/array/fill.mjs +8 -2
  123. package/dist/compat/array/find.js +14 -13
  124. package/dist/compat/array/find.mjs +14 -13
  125. package/dist/compat/array/findIndex.js +3 -19
  126. package/dist/compat/array/findIndex.mjs +3 -19
  127. package/dist/compat/array/findLast.js +3 -3
  128. package/dist/compat/array/findLast.mjs +3 -3
  129. package/dist/compat/array/flatMap.js +3 -8
  130. package/dist/compat/array/flatMap.mjs +3 -7
  131. package/dist/compat/array/flatMapDepth.js +1 -1
  132. package/dist/compat/array/flatMapDepth.mjs +1 -1
  133. package/dist/compat/array/forEach.js +1 -1
  134. package/dist/compat/array/forEach.mjs +1 -1
  135. package/dist/compat/array/includes.js +13 -13
  136. package/dist/compat/array/includes.mjs +13 -13
  137. package/dist/compat/array/indexOf.js +2 -1
  138. package/dist/compat/array/indexOf.mjs +2 -1
  139. package/dist/compat/array/intersection.js +3 -2
  140. package/dist/compat/array/intersection.mjs +3 -2
  141. package/dist/compat/array/intersectionBy.js +7 -11
  142. package/dist/compat/array/intersectionBy.mjs +7 -11
  143. package/dist/compat/array/intersectionWith.js +6 -18
  144. package/dist/compat/array/intersectionWith.mjs +6 -18
  145. package/dist/compat/array/last.js +1 -1
  146. package/dist/compat/array/last.mjs +1 -1
  147. package/dist/compat/array/lastIndexOf.js +3 -1
  148. package/dist/compat/array/lastIndexOf.mjs +3 -1
  149. package/dist/compat/array/map.js +3 -3
  150. package/dist/compat/array/map.mjs +3 -3
  151. package/dist/compat/array/orderBy.js +8 -6
  152. package/dist/compat/array/orderBy.mjs +8 -6
  153. package/dist/compat/array/partition.js +6 -6
  154. package/dist/compat/array/partition.mjs +6 -6
  155. package/dist/compat/array/pull.js +1 -1
  156. package/dist/compat/array/pull.mjs +1 -1
  157. package/dist/compat/array/pullAll.js +2 -0
  158. package/dist/compat/array/pullAll.mjs +2 -0
  159. package/dist/compat/array/remove.js +8 -4
  160. package/dist/compat/array/remove.mjs +8 -4
  161. package/dist/compat/array/reverse.js +1 -1
  162. package/dist/compat/array/reverse.mjs +1 -1
  163. package/dist/compat/array/sampleSize.js +2 -1
  164. package/dist/compat/array/sampleSize.mjs +2 -1
  165. package/dist/compat/array/size.js +2 -1
  166. package/dist/compat/array/size.mjs +2 -1
  167. package/dist/compat/array/some.js +2 -1
  168. package/dist/compat/array/some.mjs +2 -1
  169. package/dist/compat/array/takeRightWhile.js +2 -2
  170. package/dist/compat/array/takeRightWhile.mjs +2 -2
  171. package/dist/compat/array/takeWhile.js +2 -2
  172. package/dist/compat/array/takeWhile.mjs +2 -2
  173. package/dist/compat/array/unionBy.js +2 -1
  174. package/dist/compat/array/unionBy.mjs +2 -1
  175. package/dist/compat/array/uniqBy.js +4 -3
  176. package/dist/compat/array/uniqBy.mjs +4 -3
  177. package/dist/compat/array/unzip.d.mts +3 -0
  178. package/dist/compat/array/unzip.d.ts +3 -0
  179. package/dist/compat/array/unzip.js +3 -0
  180. package/dist/compat/array/unzip.mjs +3 -0
  181. package/dist/compat/array/unzipWith.js +1 -1
  182. package/dist/compat/array/unzipWith.mjs +1 -1
  183. package/dist/compat/array/zipObject.js +2 -0
  184. package/dist/compat/array/zipObject.mjs +2 -0
  185. package/dist/compat/compat.d.mts +3 -3
  186. package/dist/compat/compat.d.ts +3 -3
  187. package/dist/compat/compat.js +8 -4
  188. package/dist/compat/compat.mjs +8 -4
  189. package/dist/compat/function/curry.d.mts +1 -1
  190. package/dist/compat/function/curry.d.ts +1 -1
  191. package/dist/compat/function/debounce.js +1 -1
  192. package/dist/compat/function/debounce.mjs +1 -1
  193. package/dist/compat/function/flowRight.d.mts +1 -1
  194. package/dist/compat/function/flowRight.d.ts +1 -1
  195. package/dist/compat/function/partial.d.mts +1 -1
  196. package/dist/compat/function/partial.d.ts +1 -1
  197. package/dist/compat/function/rest.d.mts +1 -1
  198. package/dist/compat/function/rest.d.ts +1 -1
  199. package/dist/compat/function/rest.js +1 -1
  200. package/dist/compat/function/rest.mjs +1 -1
  201. package/dist/compat/index.d.mts +3 -3
  202. package/dist/compat/index.d.ts +3 -3
  203. package/dist/compat/index.js +6 -4
  204. package/dist/compat/index.mjs +5 -5
  205. package/dist/compat/math/maxBy.js +1 -1
  206. package/dist/compat/math/maxBy.mjs +1 -1
  207. package/dist/compat/math/meanBy.d.mts +4 -0
  208. package/dist/compat/math/meanBy.d.ts +4 -0
  209. package/dist/compat/math/meanBy.js +8 -3
  210. package/dist/compat/math/meanBy.mjs +8 -3
  211. package/dist/compat/math/minBy.js +1 -1
  212. package/dist/compat/math/minBy.mjs +1 -1
  213. package/dist/compat/object/cloneDeep.d.mts +5 -5
  214. package/dist/compat/object/cloneDeep.d.ts +5 -5
  215. package/dist/compat/object/cloneDeep.js +5 -5
  216. package/dist/compat/object/cloneDeep.mjs +5 -5
  217. package/dist/compat/object/cloneDeepWith.js +3 -1
  218. package/dist/compat/object/cloneDeepWith.mjs +3 -1
  219. package/dist/compat/object/cloneWith.d.mts +1 -1
  220. package/dist/compat/object/cloneWith.d.ts +1 -1
  221. package/dist/compat/object/cloneWith.js +1 -1
  222. package/dist/compat/object/cloneWith.mjs +1 -1
  223. package/dist/compat/object/entries.d.mts +1 -0
  224. package/dist/compat/object/entries.d.ts +1 -0
  225. package/dist/compat/object/entries.js +1 -0
  226. package/dist/compat/object/entries.mjs +1 -0
  227. package/dist/compat/object/entriesIn.d.mts +1 -0
  228. package/dist/compat/object/entriesIn.d.ts +1 -0
  229. package/dist/compat/object/entriesIn.js +1 -0
  230. package/dist/compat/object/entriesIn.mjs +1 -0
  231. package/dist/compat/object/omit.js +5 -5
  232. package/dist/compat/object/omit.mjs +5 -5
  233. package/dist/compat/object/transform.js +1 -1
  234. package/dist/compat/object/transform.mjs +1 -1
  235. package/dist/compat/object/updateWith.js +2 -2
  236. package/dist/compat/object/updateWith.mjs +2 -2
  237. package/dist/compat/predicate/isMatchWith.js +14 -5
  238. package/dist/compat/predicate/isMatchWith.mjs +14 -5
  239. package/dist/compat/string/template.js +2 -1
  240. package/dist/compat/string/template.mjs +2 -1
  241. package/dist/compat/string/words.js +17 -13
  242. package/dist/compat/string/words.mjs +17 -13
  243. package/dist/compat/util/iteratee.js +1 -3
  244. package/dist/compat/util/iteratee.mjs +1 -3
  245. package/dist/compat/util/toArray.d.mts +5 -5
  246. package/dist/compat/util/toArray.d.ts +5 -5
  247. package/dist/compat/util/toArray.js +9 -5
  248. package/dist/compat/util/toArray.mjs +9 -5
  249. package/dist/compat/util/toPath.js +11 -3
  250. package/dist/compat/util/toPath.mjs +11 -3
  251. package/dist/compat/util/toString.js +4 -1
  252. package/dist/compat/util/toString.mjs +4 -1
  253. package/dist/fp/array/at.d.mts +1 -1
  254. package/dist/fp/array/at.d.ts +1 -1
  255. package/dist/fp/array/orderBy.d.mts +1 -1
  256. package/dist/fp/array/orderBy.d.ts +1 -1
  257. package/dist/fp/array/sortBy.d.mts +1 -1
  258. package/dist/fp/array/sortBy.d.ts +1 -1
  259. package/dist/fp/array/unzip.d.mts +3 -0
  260. package/dist/fp/array/unzip.d.ts +3 -0
  261. package/dist/fp/array/unzip.js +3 -0
  262. package/dist/fp/array/unzip.mjs +3 -0
  263. package/dist/fp/iterator/chunk.d.mts +19 -0
  264. package/dist/fp/iterator/chunk.d.ts +19 -0
  265. package/dist/fp/iterator/chunk.js +24 -0
  266. package/dist/fp/iterator/chunk.mjs +24 -0
  267. package/dist/fp/iterator/count.d.mts +20 -0
  268. package/dist/fp/iterator/count.d.ts +20 -0
  269. package/dist/fp/iterator/count.js +25 -0
  270. package/dist/fp/iterator/count.mjs +25 -0
  271. package/dist/fp/iterator/drop.d.mts +20 -0
  272. package/dist/fp/iterator/drop.d.ts +20 -0
  273. package/dist/fp/iterator/drop.js +24 -0
  274. package/dist/fp/iterator/drop.mjs +24 -0
  275. package/dist/fp/iterator/dropWhile.d.mts +18 -0
  276. package/dist/fp/iterator/dropWhile.d.ts +18 -0
  277. package/dist/fp/iterator/dropWhile.js +23 -0
  278. package/dist/fp/iterator/dropWhile.mjs +23 -0
  279. package/dist/fp/iterator/every.d.mts +20 -0
  280. package/dist/fp/iterator/every.d.ts +20 -0
  281. package/dist/fp/iterator/every.js +24 -0
  282. package/dist/fp/iterator/every.mjs +24 -0
  283. package/dist/fp/iterator/filter.d.mts +37 -0
  284. package/dist/fp/iterator/filter.d.ts +37 -0
  285. package/dist/fp/iterator/filter.js +8 -0
  286. package/dist/fp/iterator/filter.mjs +8 -0
  287. package/dist/fp/iterator/find.d.mts +20 -0
  288. package/dist/fp/iterator/find.d.ts +20 -0
  289. package/dist/fp/iterator/find.js +24 -0
  290. package/dist/fp/iterator/find.mjs +24 -0
  291. package/dist/fp/iterator/flatMap.d.mts +20 -0
  292. package/dist/fp/iterator/flatMap.d.ts +20 -0
  293. package/dist/fp/iterator/flatMap.js +24 -0
  294. package/dist/fp/iterator/flatMap.mjs +24 -0
  295. package/dist/fp/iterator/forEach.d.mts +22 -0
  296. package/dist/fp/iterator/forEach.d.ts +22 -0
  297. package/dist/fp/iterator/forEach.js +26 -0
  298. package/dist/fp/iterator/forEach.mjs +26 -0
  299. package/dist/fp/iterator/head.d.mts +19 -0
  300. package/dist/fp/iterator/head.d.ts +19 -0
  301. package/dist/fp/iterator/head.js +24 -0
  302. package/dist/fp/iterator/head.mjs +24 -0
  303. package/dist/fp/iterator/index.d.mts +21 -0
  304. package/dist/fp/iterator/index.d.ts +21 -0
  305. package/dist/fp/iterator/index.js +41 -0
  306. package/dist/fp/iterator/index.mjs +21 -0
  307. package/dist/fp/iterator/map.d.mts +20 -0
  308. package/dist/fp/iterator/map.d.ts +20 -0
  309. package/dist/fp/iterator/map.js +24 -0
  310. package/dist/fp/iterator/map.mjs +24 -0
  311. package/dist/fp/iterator/partition.d.mts +22 -0
  312. package/dist/fp/iterator/partition.d.ts +22 -0
  313. package/dist/fp/iterator/partition.js +27 -0
  314. package/dist/fp/iterator/partition.mjs +27 -0
  315. package/dist/fp/iterator/reduce.d.mts +24 -0
  316. package/dist/fp/iterator/reduce.d.ts +24 -0
  317. package/dist/fp/iterator/reduce.js +28 -0
  318. package/dist/fp/iterator/reduce.mjs +28 -0
  319. package/dist/fp/iterator/scan.d.mts +21 -0
  320. package/dist/fp/iterator/scan.d.ts +21 -0
  321. package/dist/fp/iterator/scan.js +26 -0
  322. package/dist/fp/iterator/scan.mjs +26 -0
  323. package/dist/fp/iterator/some.d.mts +20 -0
  324. package/dist/fp/iterator/some.d.ts +20 -0
  325. package/dist/fp/iterator/some.js +24 -0
  326. package/dist/fp/iterator/some.mjs +24 -0
  327. package/dist/fp/iterator/take.d.mts +21 -0
  328. package/dist/fp/iterator/take.d.ts +21 -0
  329. package/dist/fp/iterator/take.js +25 -0
  330. package/dist/fp/iterator/take.mjs +25 -0
  331. package/dist/fp/iterator/takeWhile.d.mts +19 -0
  332. package/dist/fp/iterator/takeWhile.d.ts +19 -0
  333. package/dist/fp/iterator/takeWhile.js +24 -0
  334. package/dist/fp/iterator/takeWhile.mjs +24 -0
  335. package/dist/fp/iterator/toArray.d.mts +21 -0
  336. package/dist/fp/iterator/toArray.d.ts +21 -0
  337. package/dist/fp/iterator/toArray.js +25 -0
  338. package/dist/fp/iterator/toArray.mjs +25 -0
  339. package/dist/fp/iterator/uniqBy.d.mts +20 -0
  340. package/dist/fp/iterator/uniqBy.d.ts +20 -0
  341. package/dist/fp/iterator/uniqBy.js +25 -0
  342. package/dist/fp/iterator/uniqBy.mjs +25 -0
  343. package/dist/fp/iterator/zip.d.mts +20 -0
  344. package/dist/fp/iterator/zip.d.ts +20 -0
  345. package/dist/fp/iterator/zip.js +25 -0
  346. package/dist/fp/iterator/zip.mjs +25 -0
  347. package/dist/function/memoize.d.mts +3 -2
  348. package/dist/function/memoize.d.ts +3 -2
  349. package/dist/function/memoize.js +3 -2
  350. package/dist/function/memoize.mjs +3 -2
  351. package/dist/function/partial.d.mts +2 -2
  352. package/dist/function/partial.d.ts +2 -2
  353. package/dist/function/partialRight.d.mts +5 -5
  354. package/dist/function/partialRight.d.ts +5 -5
  355. package/dist/function/rest.d.mts +1 -1
  356. package/dist/function/rest.d.ts +1 -1
  357. package/dist/function/rest.js +1 -1
  358. package/dist/function/rest.mjs +1 -1
  359. package/dist/function/retry.d.mts +7 -4
  360. package/dist/function/retry.d.ts +7 -4
  361. package/dist/function/retry.js +4 -2
  362. package/dist/function/retry.mjs +1 -1
  363. package/dist/index.d.mts +9 -2
  364. package/dist/index.d.ts +9 -2
  365. package/dist/index.js +18 -4
  366. package/dist/index.mjs +12 -5
  367. package/dist/iterator/_internal/iterator.js +74 -0
  368. package/dist/iterator/_internal/iterator.mjs +74 -0
  369. package/dist/iterator/chunk.d.mts +21 -0
  370. package/dist/iterator/chunk.d.ts +21 -0
  371. package/dist/iterator/chunk.js +40 -0
  372. package/dist/iterator/chunk.mjs +40 -0
  373. package/dist/iterator/count.d.mts +18 -0
  374. package/dist/iterator/count.d.ts +18 -0
  375. package/dist/iterator/count.js +26 -0
  376. package/dist/iterator/count.mjs +26 -0
  377. package/dist/iterator/dropWhile.d.mts +20 -0
  378. package/dist/iterator/dropWhile.d.ts +20 -0
  379. package/dist/iterator/dropWhile.js +52 -0
  380. package/dist/iterator/dropWhile.mjs +52 -0
  381. package/dist/iterator/head.d.mts +21 -0
  382. package/dist/iterator/head.d.ts +21 -0
  383. package/dist/iterator/head.js +26 -0
  384. package/dist/iterator/head.mjs +26 -0
  385. package/dist/iterator/index.d.mts +12 -0
  386. package/dist/iterator/index.d.ts +12 -0
  387. package/dist/iterator/index.js +23 -0
  388. package/dist/iterator/index.mjs +12 -0
  389. package/dist/iterator/iterate.d.mts +20 -0
  390. package/dist/iterator/iterate.d.ts +20 -0
  391. package/dist/iterator/iterate.js +32 -0
  392. package/dist/iterator/iterate.mjs +32 -0
  393. package/dist/iterator/partition.d.mts +18 -0
  394. package/dist/iterator/partition.d.ts +18 -0
  395. package/dist/iterator/partition.js +36 -0
  396. package/dist/iterator/partition.mjs +36 -0
  397. package/dist/iterator/range.d.mts +42 -0
  398. package/dist/iterator/range.d.ts +42 -0
  399. package/dist/iterator/range.js +25 -0
  400. package/dist/iterator/range.mjs +25 -0
  401. package/dist/iterator/scan.d.mts +23 -0
  402. package/dist/iterator/scan.d.ts +23 -0
  403. package/dist/iterator/scan.js +47 -0
  404. package/dist/iterator/scan.mjs +47 -0
  405. package/dist/iterator/takeWhile.d.mts +20 -0
  406. package/dist/iterator/takeWhile.d.ts +20 -0
  407. package/dist/iterator/takeWhile.js +34 -0
  408. package/dist/iterator/takeWhile.mjs +34 -0
  409. package/dist/iterator/uniqBy.d.mts +22 -0
  410. package/dist/iterator/uniqBy.d.ts +22 -0
  411. package/dist/iterator/uniqBy.js +43 -0
  412. package/dist/iterator/uniqBy.mjs +43 -0
  413. package/dist/iterator/zip.d.mts +23 -0
  414. package/dist/iterator/zip.d.ts +23 -0
  415. package/dist/iterator/zip.js +45 -0
  416. package/dist/iterator/zip.mjs +45 -0
  417. package/dist/object/cloneDeepWith.d.mts +3 -1
  418. package/dist/object/cloneDeepWith.d.ts +3 -1
  419. package/dist/object/cloneDeepWith.js +3 -1
  420. package/dist/object/cloneDeepWith.mjs +3 -1
  421. package/dist/object/deepFreeze.d.mts +20 -0
  422. package/dist/object/deepFreeze.d.ts +20 -0
  423. package/dist/object/deepFreeze.js +29 -0
  424. package/dist/object/deepFreeze.mjs +29 -0
  425. package/dist/object/flattenObject.d.mts +16 -1
  426. package/dist/object/flattenObject.d.ts +16 -1
  427. package/dist/object/flattenObject.js +15 -6
  428. package/dist/object/flattenObject.mjs +15 -6
  429. package/dist/object/index.d.mts +7 -1
  430. package/dist/object/index.d.ts +7 -1
  431. package/dist/object/index.js +12 -0
  432. package/dist/object/index.mjs +7 -1
  433. package/dist/object/mapKeysAsync.d.mts +25 -0
  434. package/dist/object/mapKeysAsync.d.ts +25 -0
  435. package/dist/object/mapKeysAsync.js +32 -0
  436. package/dist/object/mapKeysAsync.mjs +32 -0
  437. package/dist/object/mapValuesAsync.d.mts +26 -0
  438. package/dist/object/mapValuesAsync.d.ts +26 -0
  439. package/dist/object/mapValuesAsync.js +32 -0
  440. package/dist/object/mapValuesAsync.mjs +32 -0
  441. package/dist/object/merge.js +2 -4
  442. package/dist/object/merge.mjs +1 -3
  443. package/dist/object/mergeWith.js +4 -4
  444. package/dist/object/mergeWith.mjs +4 -4
  445. package/dist/object/toCamelCaseKeys.d.mts +2 -6
  446. package/dist/object/toCamelCaseKeys.d.ts +2 -6
  447. package/dist/object/toConstantCaseKeys.d.mts +52 -0
  448. package/dist/object/toConstantCaseKeys.d.ts +52 -0
  449. package/dist/object/toConstantCaseKeys.js +66 -0
  450. package/dist/object/toConstantCaseKeys.mjs +66 -0
  451. package/dist/object/toKebabCaseKeys.d.mts +52 -0
  452. package/dist/object/toKebabCaseKeys.d.ts +52 -0
  453. package/dist/object/toKebabCaseKeys.js +66 -0
  454. package/dist/object/toKebabCaseKeys.mjs +66 -0
  455. package/dist/object/toMerged.js +4 -4
  456. package/dist/object/toMerged.mjs +4 -4
  457. package/dist/object/toPascalCaseKeys.d.mts +52 -0
  458. package/dist/object/toPascalCaseKeys.d.ts +52 -0
  459. package/dist/object/toPascalCaseKeys.js +66 -0
  460. package/dist/object/toPascalCaseKeys.mjs +66 -0
  461. package/dist/object/toSnakeCaseKeys.d.mts +2 -3
  462. package/dist/object/toSnakeCaseKeys.d.ts +2 -3
  463. package/dist/promise/index.d.mts +2 -1
  464. package/dist/promise/index.d.ts +2 -1
  465. package/dist/promise/index.js +2 -0
  466. package/dist/promise/index.mjs +2 -1
  467. package/dist/promise/limitAsync.d.mts +35 -0
  468. package/dist/promise/limitAsync.d.ts +35 -0
  469. package/dist/promise/limitAsync.js +46 -0
  470. package/dist/promise/limitAsync.mjs +46 -0
  471. package/dist/string/dedent.d.mts +37 -0
  472. package/dist/string/dedent.d.ts +37 -0
  473. package/dist/string/dedent.js +38 -0
  474. package/dist/string/dedent.mjs +38 -0
  475. package/dist/string/index.d.mts +2 -1
  476. package/dist/string/index.d.ts +2 -1
  477. package/dist/string/index.js +5 -3
  478. package/dist/string/index.mjs +5 -4
  479. package/dist/types/ToCamelCaseKeys.d.mts +24 -0
  480. package/dist/types/ToCamelCaseKeys.d.ts +24 -0
  481. package/dist/types/ToConstantCaseKeys.d.mts +21 -0
  482. package/dist/types/ToConstantCaseKeys.d.ts +21 -0
  483. package/dist/types/ToKebabCaseKeys.d.mts +23 -0
  484. package/dist/types/ToKebabCaseKeys.d.ts +23 -0
  485. package/dist/types/ToPascalCaseKeys.d.mts +24 -0
  486. package/dist/types/ToPascalCaseKeys.d.ts +24 -0
  487. package/dist/types/ToSnakeCaseKeys.d.mts +21 -0
  488. package/dist/types/ToSnakeCaseKeys.d.ts +21 -0
  489. package/dist/types/index.d.mts +6 -1
  490. package/dist/types/index.d.ts +6 -1
  491. package/fp/iterator.d.ts +1 -0
  492. package/fp/iterator.js +1 -0
  493. package/iterator.d.ts +1 -0
  494. package/iterator.js +1 -0
  495. package/package.json +70 -2
@@ -8,7 +8,7 @@ import { isString } from "../predicate/isString.mjs";
8
8
  *
9
9
  * The comparison uses SameValueZero to check for inclusion.
10
10
  *
11
- * @param source - The source to search in. It can be an array, an object, or a string.
11
+ * @param collection - The source to search in. It can be an array, an object, or a string.
12
12
  * @param [target] - The value to search for in the source.
13
13
  * @param [fromIndex=0] - The index to start searching from. If negative, it is treated as an offset from the end of the source.
14
14
  * @returns `true` if the value is found in the source, `false` otherwise.
@@ -19,24 +19,24 @@ import { isString } from "../predicate/isString.mjs";
19
19
  * includes('hello world', 'world'); // true
20
20
  * includes('hello world', 'test'); // false
21
21
  */
22
- function includes(source, target, fromIndex, guard) {
23
- if (source == null) return false;
22
+ function includes(collection, target, fromIndex, guard) {
23
+ if (collection == null) return false;
24
24
  if (guard || !fromIndex) fromIndex = 0;
25
25
  else fromIndex = toInteger(fromIndex);
26
- if (isString(source)) {
27
- if (fromIndex > source.length || target instanceof RegExp) return false;
28
- if (fromIndex < 0) fromIndex = Math.max(0, source.length + fromIndex);
29
- return source.includes(target, fromIndex);
26
+ if (isString(collection)) {
27
+ if (fromIndex > collection.length || target instanceof RegExp) return false;
28
+ if (fromIndex < 0) fromIndex = Math.max(0, collection.length + fromIndex);
29
+ return collection.includes(target, fromIndex);
30
30
  }
31
- if (Array.isArray(source)) return source.includes(target, fromIndex);
32
- if (isArrayLike(source)) {
33
- if (fromIndex < 0) fromIndex = Math.max(0, source.length + fromIndex);
34
- for (let i = fromIndex; i < source.length; i++) if (eq(source[i], target)) return true;
31
+ if (Array.isArray(collection)) return collection.includes(target, fromIndex);
32
+ if (isArrayLike(collection)) {
33
+ if (fromIndex < 0) fromIndex = Math.max(0, collection.length + fromIndex);
34
+ for (let i = fromIndex; i < collection.length; i++) if (eq(collection[i], target)) return true;
35
35
  return false;
36
36
  }
37
- const keys = Object.keys(source);
37
+ const keys = Object.keys(collection);
38
38
  if (fromIndex < 0) fromIndex = Math.max(0, keys.length + fromIndex);
39
- for (let i = fromIndex; i < keys.length; i++) if (eq(Reflect.get(source, keys[i]), target)) return true;
39
+ for (let i = fromIndex; i < keys.length; i++) if (eq(Reflect.get(collection, keys[i]), target)) return true;
40
40
  return false;
41
41
  }
42
42
  //#endregion
@@ -1,4 +1,5 @@
1
1
  const require_isArrayLike = require("../predicate/isArrayLike.js");
2
+ const require_toInteger = require("../util/toInteger.js");
2
3
  //#region src/compat/array/indexOf.ts
3
4
  /**
4
5
  * Finds the index of the first occurrence of a value in an array.
@@ -20,7 +21,7 @@ const require_isArrayLike = require("../predicate/isArrayLike.js");
20
21
  function indexOf(array, searchElement, fromIndex) {
21
22
  if (!require_isArrayLike.isArrayLike(array)) return -1;
22
23
  if (Number.isNaN(searchElement)) {
23
- fromIndex = fromIndex ?? 0;
24
+ fromIndex = require_toInteger.toInteger(fromIndex ?? 0);
24
25
  if (fromIndex < 0) fromIndex = Math.max(0, array.length + fromIndex);
25
26
  for (let i = fromIndex; i < array.length; i++) if (Number.isNaN(array[i])) return i;
26
27
  return -1;
@@ -1,4 +1,5 @@
1
1
  import { isArrayLike } from "../predicate/isArrayLike.mjs";
2
+ import { toInteger } from "../util/toInteger.mjs";
2
3
  //#region src/compat/array/indexOf.ts
3
4
  /**
4
5
  * Finds the index of the first occurrence of a value in an array.
@@ -20,7 +21,7 @@ import { isArrayLike } from "../predicate/isArrayLike.mjs";
20
21
  function indexOf(array, searchElement, fromIndex) {
21
22
  if (!isArrayLike(array)) return -1;
22
23
  if (Number.isNaN(searchElement)) {
23
- fromIndex = fromIndex ?? 0;
24
+ fromIndex = toInteger(fromIndex ?? 0);
24
25
  if (fromIndex < 0) fromIndex = Math.max(0, array.length + fromIndex);
25
26
  for (let i = fromIndex; i < array.length; i++) if (Number.isNaN(array[i])) return i;
26
27
  return -1;
@@ -1,5 +1,6 @@
1
1
  const require_intersection = require("../../array/intersection.js");
2
2
  const require_uniq = require("../../array/uniq.js");
3
+ const require_toArray = require("../_internal/toArray.js");
3
4
  const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
4
5
  //#region src/compat/array/intersection.ts
5
6
  /**
@@ -22,11 +23,11 @@ const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
22
23
  function intersection(...arrays) {
23
24
  if (arrays.length === 0) return [];
24
25
  if (!require_isArrayLikeObject.isArrayLikeObject(arrays[0])) return [];
25
- let result = require_uniq.uniq(Array.from(arrays[0]));
26
+ let result = require_uniq.uniq(require_toArray.toArray(arrays[0]));
26
27
  for (let i = 1; i < arrays.length; i++) {
27
28
  const array = arrays[i];
28
29
  if (!require_isArrayLikeObject.isArrayLikeObject(array)) return [];
29
- result = require_intersection.intersection(result, Array.from(array));
30
+ result = require_intersection.intersection(result, require_toArray.toArray(array));
30
31
  }
31
32
  return result;
32
33
  }
@@ -1,5 +1,6 @@
1
1
  import { intersection as intersection$1 } from "../../array/intersection.mjs";
2
2
  import { uniq } from "../../array/uniq.mjs";
3
+ import { toArray } from "../_internal/toArray.mjs";
3
4
  import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
4
5
  //#region src/compat/array/intersection.ts
5
6
  /**
@@ -22,11 +23,11 @@ import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
22
23
  function intersection(...arrays) {
23
24
  if (arrays.length === 0) return [];
24
25
  if (!isArrayLikeObject(arrays[0])) return [];
25
- let result = uniq(Array.from(arrays[0]));
26
+ let result = uniq(toArray(arrays[0]));
26
27
  for (let i = 1; i < arrays.length; i++) {
27
28
  const array = arrays[i];
28
29
  if (!isArrayLikeObject(array)) return [];
29
- result = intersection$1(result, Array.from(array));
30
+ result = intersection$1(result, toArray(array));
30
31
  }
31
32
  return result;
32
33
  }
@@ -4,7 +4,7 @@ const require_uniq = require("../../array/uniq.js");
4
4
  const require_uniqBy = require("../../array/uniqBy.js");
5
5
  const require_identity = require("../../function/identity.js");
6
6
  const require_toArray = require("../_internal/toArray.js");
7
- const require_property = require("../object/property.js");
7
+ const require_iteratee = require("../util/iteratee.js");
8
8
  const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
9
9
  //#region src/compat/array/intersectionBy.ts
10
10
  /**
@@ -38,22 +38,18 @@ const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js");
38
38
  function intersectionBy(array, ...values) {
39
39
  if (!require_isArrayLikeObject.isArrayLikeObject(array)) return [];
40
40
  const lastValue = require_last.last(values);
41
- const count = require_isArrayLikeObject.isArrayLikeObject(lastValue) ? values.length : values.length - 1;
42
- const iteratee = getIteratee(lastValue);
43
- if (count <= 0) return require_uniqBy.uniqBy(require_toArray.toArray(array), iteratee ?? require_identity.identity);
41
+ const hasIteratee = !require_isArrayLikeObject.isArrayLikeObject(lastValue);
42
+ const count = hasIteratee ? values.length - 1 : values.length;
43
+ const mapper = hasIteratee ? require_iteratee.iteratee(lastValue) : require_identity.identity;
44
+ const iteratee$1 = typeof lastValue === "function" ? (item) => mapper(item) : mapper;
45
+ if (count <= 0) return require_uniqBy.uniqBy(require_toArray.toArray(array), iteratee$1);
44
46
  let result = require_uniq.uniq(require_toArray.toArray(array));
45
47
  for (let i = 0; i < count; ++i) {
46
48
  const value = values[i];
47
49
  if (!require_isArrayLikeObject.isArrayLikeObject(value)) return [];
48
- if (iteratee) result = require_intersectionBy.intersectionBy(result, require_toArray.toArray(value), iteratee);
50
+ result = require_intersectionBy.intersectionBy(result, require_toArray.toArray(value), iteratee$1);
49
51
  }
50
52
  return result;
51
53
  }
52
- function getIteratee(value) {
53
- if (require_isArrayLikeObject.isArrayLikeObject(value)) return require_identity.identity;
54
- if (typeof value === "function") return (item) => value(item);
55
- if (typeof value === "string") return require_property.property(value);
56
- return null;
57
- }
58
54
  //#endregion
59
55
  exports.intersectionBy = intersectionBy;
@@ -4,7 +4,7 @@ import { uniq } from "../../array/uniq.mjs";
4
4
  import { uniqBy } from "../../array/uniqBy.mjs";
5
5
  import { identity } from "../../function/identity.mjs";
6
6
  import { toArray } from "../_internal/toArray.mjs";
7
- import { property } from "../object/property.mjs";
7
+ import { iteratee } from "../util/iteratee.mjs";
8
8
  import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
9
9
  //#region src/compat/array/intersectionBy.ts
10
10
  /**
@@ -38,22 +38,18 @@ import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs";
38
38
  function intersectionBy(array, ...values) {
39
39
  if (!isArrayLikeObject(array)) return [];
40
40
  const lastValue = last(values);
41
- const count = isArrayLikeObject(lastValue) ? values.length : values.length - 1;
42
- const iteratee = getIteratee(lastValue);
43
- if (count <= 0) return uniqBy(toArray(array), iteratee ?? identity);
41
+ const hasIteratee = !isArrayLikeObject(lastValue);
42
+ const count = hasIteratee ? values.length - 1 : values.length;
43
+ const mapper = hasIteratee ? iteratee(lastValue) : identity;
44
+ const iteratee$1 = typeof lastValue === "function" ? (item) => mapper(item) : mapper;
45
+ if (count <= 0) return uniqBy(toArray(array), iteratee$1);
44
46
  let result = uniq(toArray(array));
45
47
  for (let i = 0; i < count; ++i) {
46
48
  const value = values[i];
47
49
  if (!isArrayLikeObject(value)) return [];
48
- if (iteratee) result = intersectionBy$1(result, toArray(value), iteratee);
50
+ result = intersectionBy$1(result, toArray(value), iteratee$1);
49
51
  }
50
52
  return result;
51
53
  }
52
- function getIteratee(value) {
53
- if (isArrayLikeObject(value)) return identity;
54
- if (typeof value === "function") return (item) => value(item);
55
- if (typeof value === "string") return property(value);
56
- return null;
57
- }
58
54
  //#endregion
59
55
  export { intersectionBy };
@@ -1,7 +1,9 @@
1
1
  const require_intersectionWith = require("../../array/intersectionWith.js");
2
+ const require_uniq = require("../../array/uniq.js");
3
+ const require_uniqWith = require("../../array/uniqWith.js");
2
4
  const require_eq = require("../util/eq.js");
5
+ const require_toArray = require("../_internal/toArray.js");
3
6
  const require_last = require("./last.js");
4
- const require_uniq = require("./uniq.js");
5
7
  //#region src/compat/array/intersectionWith.ts
6
8
  /**
7
9
  * Returns the intersection of multiple arrays based on a custom equality function.
@@ -24,28 +26,14 @@ function intersectionWith(firstArr, ...otherArrs) {
24
26
  let uniq$1 = require_uniq.uniq;
25
27
  if (typeof _comparator === "function") {
26
28
  comparator = _comparator;
27
- uniq$1 = uniqPreserve0;
29
+ uniq$1 = (arr) => require_uniqWith.uniqWith(arr, comparator);
28
30
  otherArrs.pop();
29
31
  }
30
- let result = uniq$1(Array.from(firstArr));
32
+ let result = uniq$1(require_toArray.toArray(firstArr));
31
33
  for (let i = 0; i < otherArrs.length; ++i) {
32
34
  const otherArr = otherArrs[i];
33
35
  if (otherArr == null) return [];
34
- result = require_intersectionWith.intersectionWith(result, Array.from(otherArr), comparator);
35
- }
36
- return result;
37
- }
38
- /**
39
- * This function is to preserve the sign of `-0`, which is a behavior in lodash.
40
- */
41
- function uniqPreserve0(arr) {
42
- const result = [];
43
- const added = /* @__PURE__ */ new Set();
44
- for (let i = 0; i < arr.length; i++) {
45
- const item = arr[i];
46
- if (added.has(item)) continue;
47
- result.push(item);
48
- added.add(item);
36
+ result = require_intersectionWith.intersectionWith(result, require_toArray.toArray(otherArr), comparator);
49
37
  }
50
38
  return result;
51
39
  }
@@ -1,7 +1,9 @@
1
1
  import { intersectionWith as intersectionWith$1 } from "../../array/intersectionWith.mjs";
2
+ import { uniq } from "../../array/uniq.mjs";
3
+ import { uniqWith } from "../../array/uniqWith.mjs";
2
4
  import { eq } from "../util/eq.mjs";
5
+ import { toArray } from "../_internal/toArray.mjs";
3
6
  import { last } from "./last.mjs";
4
- import { uniq } from "./uniq.mjs";
5
7
  //#region src/compat/array/intersectionWith.ts
6
8
  /**
7
9
  * Returns the intersection of multiple arrays based on a custom equality function.
@@ -24,28 +26,14 @@ function intersectionWith(firstArr, ...otherArrs) {
24
26
  let uniq$1 = uniq;
25
27
  if (typeof _comparator === "function") {
26
28
  comparator = _comparator;
27
- uniq$1 = uniqPreserve0;
29
+ uniq$1 = (arr) => uniqWith(arr, comparator);
28
30
  otherArrs.pop();
29
31
  }
30
- let result = uniq$1(Array.from(firstArr));
32
+ let result = uniq$1(toArray(firstArr));
31
33
  for (let i = 0; i < otherArrs.length; ++i) {
32
34
  const otherArr = otherArrs[i];
33
35
  if (otherArr == null) return [];
34
- result = intersectionWith$1(result, Array.from(otherArr), comparator);
35
- }
36
- return result;
37
- }
38
- /**
39
- * This function is to preserve the sign of `-0`, which is a behavior in lodash.
40
- */
41
- function uniqPreserve0(arr) {
42
- const result = [];
43
- const added = /* @__PURE__ */ new Set();
44
- for (let i = 0; i < arr.length; i++) {
45
- const item = arr[i];
46
- if (added.has(item)) continue;
47
- result.push(item);
48
- added.add(item);
36
+ result = intersectionWith$1(result, toArray(otherArr), comparator);
49
37
  }
50
38
  return result;
51
39
  }
@@ -25,7 +25,7 @@ const require_isArrayLike = require("../predicate/isArrayLike.js");
25
25
  * // noElement will be undefined
26
26
  */
27
27
  function last(array) {
28
- if (!require_isArrayLike.isArrayLike(array)) return;
28
+ if (!require_isArrayLike.isArrayLike(array) || array.length === 0) return;
29
29
  return require_last.last(require_toArray.toArray(array));
30
30
  }
31
31
  //#endregion
@@ -25,7 +25,7 @@ import { isArrayLike } from "../predicate/isArrayLike.mjs";
25
25
  * // noElement will be undefined
26
26
  */
27
27
  function last(array) {
28
- if (!isArrayLike(array)) return;
28
+ if (!isArrayLike(array) || array.length === 0) return;
29
29
  return last$1(toArray(array));
30
30
  }
31
31
  //#endregion
@@ -8,8 +8,10 @@ function lastIndexOf(array, searchElement, fromIndex) {
8
8
  if (fromIndex !== void 0) index = index < 0 ? Math.max(length + index, 0) : Math.min(index, length - 1);
9
9
  if (Number.isNaN(searchElement)) {
10
10
  for (let i = index; i >= 0; i--) if (Number.isNaN(array[i])) return i;
11
+ return -1;
11
12
  }
12
- return Array.from(array).lastIndexOf(searchElement, index);
13
+ for (let i = index; i >= 0; i--) if (array[i] === searchElement) return i;
14
+ return -1;
13
15
  }
14
16
  //#endregion
15
17
  exports.lastIndexOf = lastIndexOf;
@@ -8,8 +8,10 @@ function lastIndexOf(array, searchElement, fromIndex) {
8
8
  if (fromIndex !== void 0) index = index < 0 ? Math.max(length + index, 0) : Math.min(index, length - 1);
9
9
  if (Number.isNaN(searchElement)) {
10
10
  for (let i = index; i >= 0; i--) if (Number.isNaN(array[i])) return i;
11
+ return -1;
11
12
  }
12
- return Array.from(array).lastIndexOf(searchElement, index);
13
+ for (let i = index; i >= 0; i--) if (array[i] === searchElement) return i;
14
+ return -1;
13
15
  }
14
16
  //#endregion
15
17
  export { lastIndexOf };
@@ -3,10 +3,10 @@ const require_range = require("../../math/range.js");
3
3
  const require_isArrayLike = require("../predicate/isArrayLike.js");
4
4
  const require_iteratee = require("../util/iteratee.js");
5
5
  //#region src/compat/array/map.ts
6
- function map(collection, _iteratee) {
6
+ function map(collection, _iteratee = require_identity.identity) {
7
7
  if (!collection) return [];
8
- const keys = require_isArrayLike.isArrayLike(collection) || Array.isArray(collection) ? require_range.range(0, collection.length) : Object.keys(collection);
9
- const iteratee$1 = require_iteratee.iteratee(_iteratee ?? require_identity.identity);
8
+ const keys = require_isArrayLike.isArrayLike(collection) ? require_range.range(0, collection.length) : Object.keys(collection);
9
+ const iteratee$1 = require_iteratee.iteratee(_iteratee);
10
10
  const result = new Array(keys.length);
11
11
  for (let i = 0; i < keys.length; i++) {
12
12
  const key = keys[i];
@@ -3,10 +3,10 @@ import { range } from "../../math/range.mjs";
3
3
  import { isArrayLike } from "../predicate/isArrayLike.mjs";
4
4
  import { iteratee } from "../util/iteratee.mjs";
5
5
  //#region src/compat/array/map.ts
6
- function map(collection, _iteratee) {
6
+ function map(collection, _iteratee = identity) {
7
7
  if (!collection) return [];
8
- const keys = isArrayLike(collection) || Array.isArray(collection) ? range(0, collection.length) : Object.keys(collection);
9
- const iteratee$1 = iteratee(_iteratee ?? identity);
8
+ const keys = isArrayLike(collection) ? range(0, collection.length) : Object.keys(collection);
9
+ const iteratee$1 = iteratee(_iteratee);
10
10
  const result = new Array(keys.length);
11
11
  for (let i = 0; i < keys.length; i++) {
12
12
  const key = keys[i];
@@ -1,3 +1,4 @@
1
+ const require_isArrayLike = require("../predicate/isArrayLike.js");
1
2
  const require_toPath = require("../util/toPath.js");
2
3
  const require_compareValues = require("../_internal/compareValues.js");
3
4
  const require_isKey = require("../_internal/isKey.js");
@@ -36,26 +37,27 @@ const require_isKey = require("../_internal/isKey.js");
36
37
  function orderBy(collection, criteria, orders, guard) {
37
38
  if (collection == null) return [];
38
39
  orders = guard ? void 0 : orders;
39
- if (!Array.isArray(collection)) collection = Object.values(collection);
40
+ if (!Array.isArray(collection)) collection = require_isArrayLike.isArrayLike(collection) ? Array.from(collection) : Object.values(collection);
40
41
  if (!Array.isArray(criteria)) criteria = criteria == null ? [null] : [criteria];
41
42
  if (criteria.length === 0) criteria = [null];
42
43
  if (!Array.isArray(orders)) orders = orders == null ? [] : [orders];
43
44
  orders = orders.map((order) => String(order));
44
45
  const getValueByNestedPath = (object, path) => {
45
46
  let target = object;
46
- for (let i = 0; i < path.length && target != null; ++i) target = target[path[i]];
47
- return target;
47
+ let index = 0;
48
+ for (; index < path.length && target != null; ++index) target = target[path[index]];
49
+ return index > 0 && index === path.length ? target : void 0;
48
50
  };
49
51
  const getValueByCriterion = (criterion, object) => {
50
- if (object == null || criterion == null) return object;
52
+ if (criterion == null) return object;
53
+ if (object == null) return;
51
54
  if (typeof criterion === "object" && "key" in criterion) {
52
55
  if (Object.hasOwn(object, criterion.key)) return object[criterion.key];
53
56
  return getValueByNestedPath(object, criterion.path);
54
57
  }
55
58
  if (typeof criterion === "function") return criterion(object);
56
59
  if (Array.isArray(criterion)) return getValueByNestedPath(object, criterion);
57
- if (typeof object === "object") return object[criterion];
58
- return object;
60
+ return object[criterion];
59
61
  };
60
62
  const preparedCriteria = criteria.map((criterion) => {
61
63
  if (Array.isArray(criterion) && criterion.length === 1) criterion = criterion[0];
@@ -1,3 +1,4 @@
1
+ import { isArrayLike } from "../predicate/isArrayLike.mjs";
1
2
  import { toPath } from "../util/toPath.mjs";
2
3
  import { compareValues } from "../_internal/compareValues.mjs";
3
4
  import { isKey } from "../_internal/isKey.mjs";
@@ -36,26 +37,27 @@ import { isKey } from "../_internal/isKey.mjs";
36
37
  function orderBy(collection, criteria, orders, guard) {
37
38
  if (collection == null) return [];
38
39
  orders = guard ? void 0 : orders;
39
- if (!Array.isArray(collection)) collection = Object.values(collection);
40
+ if (!Array.isArray(collection)) collection = isArrayLike(collection) ? Array.from(collection) : Object.values(collection);
40
41
  if (!Array.isArray(criteria)) criteria = criteria == null ? [null] : [criteria];
41
42
  if (criteria.length === 0) criteria = [null];
42
43
  if (!Array.isArray(orders)) orders = orders == null ? [] : [orders];
43
44
  orders = orders.map((order) => String(order));
44
45
  const getValueByNestedPath = (object, path) => {
45
46
  let target = object;
46
- for (let i = 0; i < path.length && target != null; ++i) target = target[path[i]];
47
- return target;
47
+ let index = 0;
48
+ for (; index < path.length && target != null; ++index) target = target[path[index]];
49
+ return index > 0 && index === path.length ? target : void 0;
48
50
  };
49
51
  const getValueByCriterion = (criterion, object) => {
50
- if (object == null || criterion == null) return object;
52
+ if (criterion == null) return object;
53
+ if (object == null) return;
51
54
  if (typeof criterion === "object" && "key" in criterion) {
52
55
  if (Object.hasOwn(object, criterion.key)) return object[criterion.key];
53
56
  return getValueByNestedPath(object, criterion.path);
54
57
  }
55
58
  if (typeof criterion === "function") return criterion(object);
56
59
  if (Array.isArray(criterion)) return getValueByNestedPath(object, criterion);
57
- if (typeof object === "object") return object[criterion];
58
- return object;
60
+ return object[criterion];
59
61
  };
60
62
  const preparedCriteria = criteria.map((criterion) => {
61
63
  if (Array.isArray(criterion) && criterion.length === 1) criterion = criterion[0];
@@ -8,7 +8,7 @@ const require_iteratee = require("../util/iteratee.js");
8
8
  * `predicate` returns falsy for. The predicate is invoked with one argument: (value).
9
9
  *
10
10
  * @template T
11
- * @param source - The array or object to iterate over.
11
+ * @param collection - The array or object to iterate over.
12
12
  * @param [predicate=identity] - The function invoked per iteration.
13
13
  * @returns Returns the array of grouped elements.
14
14
  *
@@ -25,14 +25,14 @@ const require_iteratee = require("../util/iteratee.js");
25
25
  * partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]);
26
26
  * // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]]
27
27
  */
28
- function partition(source, predicate = require_identity.identity) {
29
- if (!source) return [[], []];
30
- const collection = require_isArrayLike.isArrayLike(source) ? source : Object.values(source);
28
+ function partition(collection, predicate = require_identity.identity) {
29
+ if (!collection) return [[], []];
30
+ const values = require_isArrayLike.isArrayLike(collection) ? collection : Object.values(collection);
31
31
  predicate = require_iteratee.iteratee(predicate);
32
32
  const matched = [];
33
33
  const unmatched = [];
34
- for (let i = 0; i < collection.length; i++) {
35
- const value = collection[i];
34
+ for (let i = 0; i < values.length; i++) {
35
+ const value = values[i];
36
36
  if (predicate(value)) matched.push(value);
37
37
  else unmatched.push(value);
38
38
  }
@@ -8,7 +8,7 @@ import { iteratee } from "../util/iteratee.mjs";
8
8
  * `predicate` returns falsy for. The predicate is invoked with one argument: (value).
9
9
  *
10
10
  * @template T
11
- * @param source - The array or object to iterate over.
11
+ * @param collection - The array or object to iterate over.
12
12
  * @param [predicate=identity] - The function invoked per iteration.
13
13
  * @returns Returns the array of grouped elements.
14
14
  *
@@ -25,14 +25,14 @@ import { iteratee } from "../util/iteratee.mjs";
25
25
  * partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]);
26
26
  * // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]]
27
27
  */
28
- function partition(source, predicate = identity) {
29
- if (!source) return [[], []];
30
- const collection = isArrayLike(source) ? source : Object.values(source);
28
+ function partition(collection, predicate = identity) {
29
+ if (!collection) return [[], []];
30
+ const values = isArrayLike(collection) ? collection : Object.values(collection);
31
31
  predicate = iteratee(predicate);
32
32
  const matched = [];
33
33
  const unmatched = [];
34
- for (let i = 0; i < collection.length; i++) {
35
- const value = collection[i];
34
+ for (let i = 0; i < values.length; i++) {
35
+ const value = values[i];
36
36
  if (predicate(value)) matched.push(value);
37
37
  else unmatched.push(value);
38
38
  }
@@ -13,7 +13,7 @@ const require_pull = require("../../array/pull.js");
13
13
  *
14
14
  * @example
15
15
  * const numbers = [1, 2, 3, 4, 5, 2, 4];
16
- * pull(numbers, [2, 4]);
16
+ * pull(numbers, 2, 4);
17
17
  * console.log(numbers); // [1, 3, 5]
18
18
  */
19
19
  function pull(arr, ...valuesToRemove) {
@@ -13,7 +13,7 @@ import { pull as pull$1 } from "../../array/pull.mjs";
13
13
  *
14
14
  * @example
15
15
  * const numbers = [1, 2, 3, 4, 5, 2, 4];
16
- * pull(numbers, [2, 4]);
16
+ * pull(numbers, 2, 4);
17
17
  * console.log(numbers); // [1, 3, 5]
18
18
  */
19
19
  function pull(arr, ...valuesToRemove) {
@@ -1,4 +1,5 @@
1
1
  const require_pull = require("../../array/pull.js");
2
+ const require_isNil = require("../../predicate/isNil.js");
2
3
  //#region src/compat/array/pullAll.ts
3
4
  /**
4
5
  * Removes all specified values from an array.
@@ -17,6 +18,7 @@ const require_pull = require("../../array/pull.js");
17
18
  * console.log(numbers); // [1, 3, 5]
18
19
  */
19
20
  function pullAll(arr, valuesToRemove = []) {
21
+ if (require_isNil.isNil(valuesToRemove)) return arr;
20
22
  return require_pull.pull(arr, Array.from(valuesToRemove));
21
23
  }
22
24
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { pull } from "../../array/pull.mjs";
2
+ import { isNil } from "../../predicate/isNil.mjs";
2
3
  //#region src/compat/array/pullAll.ts
3
4
  /**
4
5
  * Removes all specified values from an array.
@@ -17,6 +18,7 @@ import { pull } from "../../array/pull.mjs";
17
18
  * console.log(numbers); // [1, 3, 5]
18
19
  */
19
20
  function pullAll(arr, valuesToRemove = []) {
21
+ if (isNil(valuesToRemove)) return arr;
20
22
  return pull(arr, Array.from(valuesToRemove));
21
23
  }
22
24
  //#endregion
@@ -12,22 +12,26 @@ const require_iteratee = require("../util/iteratee.js");
12
12
  * @example
13
13
  * // Using a predicate function
14
14
  * const numbers = [1, 2, 3, 4, 5];
15
- * remove(numbers, value => value % 2 === 0); // => [1, 3, 5]
15
+ * remove(numbers, value => value % 2 === 0); // => [2, 4]
16
+ * console.log(numbers); // => [1, 3, 5]
16
17
  *
17
18
  * @example
18
19
  * // Using a partial object
19
20
  * const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
20
- * remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }]
21
+ * remove(objects, { a: 1 }); // => [{ a: 1 }]
22
+ * console.log(objects); // => [{ a: 2 }, { a: 3 }]
21
23
  *
22
24
  * @example
23
25
  * // Using a property-value pair
24
26
  * const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
25
- * remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }]
27
+ * remove(objects, ['a', 1]); // => [{ a: 1 }]
28
+ * console.log(objects); // => [{ a: 2 }, { a: 3 }]
26
29
  *
27
30
  * @example
28
31
  * // Using a property key
29
32
  * const objects = [{ a: 0 }, { a: 1 }];
30
- * remove(objects, 'a'); // => [{ a: 0 }]
33
+ * remove(objects, 'a'); // => [{ a: 1 }]
34
+ * console.log(objects); // => [{ a: 0 }]
31
35
  */
32
36
  function remove(arr, shouldRemoveElement = require_identity.identity) {
33
37
  return require_remove.remove(arr, require_iteratee.iteratee(shouldRemoveElement));
@@ -12,22 +12,26 @@ import { iteratee } from "../util/iteratee.mjs";
12
12
  * @example
13
13
  * // Using a predicate function
14
14
  * const numbers = [1, 2, 3, 4, 5];
15
- * remove(numbers, value => value % 2 === 0); // => [1, 3, 5]
15
+ * remove(numbers, value => value % 2 === 0); // => [2, 4]
16
+ * console.log(numbers); // => [1, 3, 5]
16
17
  *
17
18
  * @example
18
19
  * // Using a partial object
19
20
  * const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
20
- * remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }]
21
+ * remove(objects, { a: 1 }); // => [{ a: 1 }]
22
+ * console.log(objects); // => [{ a: 2 }, { a: 3 }]
21
23
  *
22
24
  * @example
23
25
  * // Using a property-value pair
24
26
  * const objects = [{ a: 1 }, { a: 2 }, { a: 3 }];
25
- * remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }]
27
+ * remove(objects, ['a', 1]); // => [{ a: 1 }]
28
+ * console.log(objects); // => [{ a: 2 }, { a: 3 }]
26
29
  *
27
30
  * @example
28
31
  * // Using a property key
29
32
  * const objects = [{ a: 0 }, { a: 1 }];
30
- * remove(objects, 'a'); // => [{ a: 0 }]
33
+ * remove(objects, 'a'); // => [{ a: 1 }]
34
+ * console.log(objects); // => [{ a: 0 }]
31
35
  */
32
36
  function remove(arr, shouldRemoveElement = identity) {
33
37
  return remove$1(arr, iteratee(shouldRemoveElement));
@@ -22,7 +22,7 @@
22
22
  */
23
23
  function reverse(array) {
24
24
  if (array == null) return array;
25
- return array.reverse();
25
+ return Array.prototype.reverse.call(array);
26
26
  }
27
27
  //#endregion
28
28
  exports.reverse = reverse;
@@ -22,7 +22,7 @@
22
22
  */
23
23
  function reverse(array) {
24
24
  if (array == null) return array;
25
- return array.reverse();
25
+ return Array.prototype.reverse.call(array);
26
26
  }
27
27
  //#endregion
28
28
  export { reverse };