@vinicunca/perkakas 0.0.3 → 0.0.5

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 (733) hide show
  1. package/dist/index.cjs +2300 -0
  2. package/dist/index.d.cts +3221 -0
  3. package/dist/index.d.ts +3221 -0
  4. package/dist/index.js +2158 -0
  5. package/dist/index.min.js +2 -0
  6. package/dist/index.min.js.map +7 -0
  7. package/package.json +38 -30
  8. package/dist/commonjs/aria/index.d.ts +0 -2
  9. package/dist/commonjs/aria/index.d.ts.map +0 -1
  10. package/dist/commonjs/aria/index.js +0 -17
  11. package/dist/commonjs/aria/key-codes.d.ts +0 -23
  12. package/dist/commonjs/aria/key-codes.d.ts.map +0 -1
  13. package/dist/commonjs/aria/key-codes.js +0 -25
  14. package/dist/commonjs/array/all-pass.d.ts +0 -3
  15. package/dist/commonjs/array/all-pass.d.ts.map +0 -1
  16. package/dist/commonjs/array/all-pass.js +0 -11
  17. package/dist/commonjs/array/any-pass.d.ts +0 -3
  18. package/dist/commonjs/array/any-pass.d.ts.map +0 -1
  19. package/dist/commonjs/array/any-pass.js +0 -11
  20. package/dist/commonjs/array/chunk.d.ts +0 -6
  21. package/dist/commonjs/array/chunk.d.ts.map +0 -1
  22. package/dist/commonjs/array/chunk.js +0 -17
  23. package/dist/commonjs/array/compact.d.ts +0 -2
  24. package/dist/commonjs/array/compact.d.ts.map +0 -1
  25. package/dist/commonjs/array/compact.js +0 -8
  26. package/dist/commonjs/array/concat.d.ts +0 -3
  27. package/dist/commonjs/array/concat.d.ts.map +0 -1
  28. package/dist/commonjs/array/concat.js +0 -11
  29. package/dist/commonjs/array/count-by.d.ts +0 -8
  30. package/dist/commonjs/array/count-by.d.ts.map +0 -1
  31. package/dist/commonjs/array/count-by.js +0 -22
  32. package/dist/commonjs/array/difference-with.d.ts +0 -9
  33. package/dist/commonjs/array/difference-with.d.ts.map +0 -1
  34. package/dist/commonjs/array/difference-with.js +0 -31
  35. package/dist/commonjs/array/difference.d.ts +0 -7
  36. package/dist/commonjs/array/difference.d.ts.map +0 -1
  37. package/dist/commonjs/array/difference.js +0 -32
  38. package/dist/commonjs/array/drop-last.d.ts +0 -3
  39. package/dist/commonjs/array/drop-last.d.ts.map +0 -1
  40. package/dist/commonjs/array/drop-last.js +0 -15
  41. package/dist/commonjs/array/drop.d.ts +0 -7
  42. package/dist/commonjs/array/drop.d.ts.map +0 -1
  43. package/dist/commonjs/array/drop.js +0 -32
  44. package/dist/commonjs/array/filter.d.ts +0 -17
  45. package/dist/commonjs/array/filter.d.ts.map +0 -1
  46. package/dist/commonjs/array/filter.js +0 -41
  47. package/dist/commonjs/array/find-index.d.ts +0 -32
  48. package/dist/commonjs/array/find-index.d.ts.map +0 -1
  49. package/dist/commonjs/array/find-index.js +0 -46
  50. package/dist/commonjs/array/find-last-index.d.ts +0 -8
  51. package/dist/commonjs/array/find-last-index.d.ts.map +0 -1
  52. package/dist/commonjs/array/find-last-index.js +0 -24
  53. package/dist/commonjs/array/find-last.d.ts +0 -8
  54. package/dist/commonjs/array/find-last.d.ts.map +0 -1
  55. package/dist/commonjs/array/find-last.js +0 -23
  56. package/dist/commonjs/array/find.d.ts +0 -24
  57. package/dist/commonjs/array/find.d.ts.map +0 -1
  58. package/dist/commonjs/array/find.js +0 -38
  59. package/dist/commonjs/array/first.d.ts +0 -16
  60. package/dist/commonjs/array/first.d.ts.map +0 -1
  61. package/dist/commonjs/array/first.js +0 -26
  62. package/dist/commonjs/array/flat-map-to-obj.d.ts +0 -7
  63. package/dist/commonjs/array/flat-map-to-obj.d.ts.map +0 -1
  64. package/dist/commonjs/array/flat-map-to-obj.js +0 -25
  65. package/dist/commonjs/array/flat-map.d.ts +0 -16
  66. package/dist/commonjs/array/flat-map.d.ts.map +0 -1
  67. package/dist/commonjs/array/flat-map.js +0 -33
  68. package/dist/commonjs/array/flatten-deep.d.ts +0 -12
  69. package/dist/commonjs/array/flatten-deep.d.ts.map +0 -1
  70. package/dist/commonjs/array/flatten-deep.js +0 -48
  71. package/dist/commonjs/array/flatten.d.ts +0 -9
  72. package/dist/commonjs/array/flatten.d.ts.map +0 -1
  73. package/dist/commonjs/array/flatten.js +0 -32
  74. package/dist/commonjs/array/for-each.d.ts +0 -13
  75. package/dist/commonjs/array/for-each.d.ts.map +0 -1
  76. package/dist/commonjs/array/for-each.js +0 -40
  77. package/dist/commonjs/array/group-by.d.ts +0 -19
  78. package/dist/commonjs/array/group-by.d.ts.map +0 -1
  79. package/dist/commonjs/array/group-by.js +0 -31
  80. package/dist/commonjs/array/index-by.d.ts +0 -8
  81. package/dist/commonjs/array/index-by.d.ts.map +0 -1
  82. package/dist/commonjs/array/index-by.js +0 -24
  83. package/dist/commonjs/array/index.d.ts +0 -56
  84. package/dist/commonjs/array/index.d.ts.map +0 -1
  85. package/dist/commonjs/array/index.js +0 -71
  86. package/dist/commonjs/array/intersection-with.d.ts +0 -9
  87. package/dist/commonjs/array/intersection-with.d.ts.map +0 -1
  88. package/dist/commonjs/array/intersection-with.js +0 -31
  89. package/dist/commonjs/array/intersection.d.ts +0 -7
  90. package/dist/commonjs/array/intersection.d.ts.map +0 -1
  91. package/dist/commonjs/array/intersection.js +0 -32
  92. package/dist/commonjs/array/join.d.ts +0 -8
  93. package/dist/commonjs/array/join.d.ts.map +0 -1
  94. package/dist/commonjs/array/join.js +0 -11
  95. package/dist/commonjs/array/last.d.ts +0 -5
  96. package/dist/commonjs/array/last.d.ts.map +0 -1
  97. package/dist/commonjs/array/last.js +0 -11
  98. package/dist/commonjs/array/length.d.ts +0 -5
  99. package/dist/commonjs/array/length.d.ts.map +0 -1
  100. package/dist/commonjs/array/length.js +0 -11
  101. package/dist/commonjs/array/map-to-obj.d.ts +0 -7
  102. package/dist/commonjs/array/map-to-obj.d.ts.map +0 -1
  103. package/dist/commonjs/array/map-to-obj.js +0 -23
  104. package/dist/commonjs/array/map.d.ts +0 -26
  105. package/dist/commonjs/array/map.d.ts.map +0 -1
  106. package/dist/commonjs/array/map.js +0 -35
  107. package/dist/commonjs/array/max-by.d.ts +0 -8
  108. package/dist/commonjs/array/max-by.d.ts.map +0 -1
  109. package/dist/commonjs/array/max-by.js +0 -28
  110. package/dist/commonjs/array/mean-by.d.ts +0 -8
  111. package/dist/commonjs/array/mean-by.d.ts.map +0 -1
  112. package/dist/commonjs/array/mean-by.js +0 -26
  113. package/dist/commonjs/array/merge-all.d.ts +0 -7
  114. package/dist/commonjs/array/merge-all.d.ts.map +0 -1
  115. package/dist/commonjs/array/merge-all.js +0 -7
  116. package/dist/commonjs/array/min-by.d.ts +0 -8
  117. package/dist/commonjs/array/min-by.d.ts.map +0 -1
  118. package/dist/commonjs/array/min-by.js +0 -28
  119. package/dist/commonjs/array/partition.d.ts +0 -10
  120. package/dist/commonjs/array/partition.d.ts.map +0 -1
  121. package/dist/commonjs/array/partition.js +0 -24
  122. package/dist/commonjs/array/range.d.ts +0 -3
  123. package/dist/commonjs/array/range.d.ts.map +0 -1
  124. package/dist/commonjs/array/range.js +0 -15
  125. package/dist/commonjs/array/reduce.d.ts +0 -7
  126. package/dist/commonjs/array/reduce.d.ts.map +0 -1
  127. package/dist/commonjs/array/reduce.js +0 -19
  128. package/dist/commonjs/array/reject.d.ts +0 -13
  129. package/dist/commonjs/array/reject.d.ts.map +0 -1
  130. package/dist/commonjs/array/reject.js +0 -41
  131. package/dist/commonjs/array/reverse.d.ts +0 -6
  132. package/dist/commonjs/array/reverse.d.ts.map +0 -1
  133. package/dist/commonjs/array/reverse.js +0 -11
  134. package/dist/commonjs/array/sample.d.ts +0 -11
  135. package/dist/commonjs/array/sample.d.ts.map +0 -1
  136. package/dist/commonjs/array/sample.js +0 -34
  137. package/dist/commonjs/array/shuffle.d.ts +0 -3
  138. package/dist/commonjs/array/shuffle.d.ts.map +0 -1
  139. package/dist/commonjs/array/shuffle.js +0 -18
  140. package/dist/commonjs/array/sort-by.d.ts +0 -27
  141. package/dist/commonjs/array/sort-by.d.ts.map +0 -1
  142. package/dist/commonjs/array/sort-by.js +0 -55
  143. package/dist/commonjs/array/sort.d.ts +0 -15
  144. package/dist/commonjs/array/sort.d.ts.map +0 -1
  145. package/dist/commonjs/array/sort.js +0 -16
  146. package/dist/commonjs/array/split-at.d.ts +0 -3
  147. package/dist/commonjs/array/split-at.d.ts.map +0 -1
  148. package/dist/commonjs/array/split-at.js +0 -13
  149. package/dist/commonjs/array/split-when.d.ts +0 -3
  150. package/dist/commonjs/array/split-when.d.ts.map +0 -1
  151. package/dist/commonjs/array/split-when.js +0 -17
  152. package/dist/commonjs/array/sum-by.d.ts +0 -8
  153. package/dist/commonjs/array/sum-by.d.ts.map +0 -1
  154. package/dist/commonjs/array/sum-by.js +0 -24
  155. package/dist/commonjs/array/swap-indices.d.ts +0 -25
  156. package/dist/commonjs/array/swap-indices.d.ts.map +0 -1
  157. package/dist/commonjs/array/swap-indices.js +0 -34
  158. package/dist/commonjs/array/take-while.d.ts +0 -3
  159. package/dist/commonjs/array/take-while.d.ts.map +0 -1
  160. package/dist/commonjs/array/take-while.js +0 -18
  161. package/dist/commonjs/array/take.d.ts +0 -7
  162. package/dist/commonjs/array/take.d.ts.map +0 -1
  163. package/dist/commonjs/array/take.js +0 -38
  164. package/dist/commonjs/array/uniq-by.d.ts +0 -3
  165. package/dist/commonjs/array/uniq-by.d.ts.map +0 -1
  166. package/dist/commonjs/array/uniq-by.js +0 -30
  167. package/dist/commonjs/array/uniq-with.d.ts +0 -12
  168. package/dist/commonjs/array/uniq-with.d.ts.map +0 -1
  169. package/dist/commonjs/array/uniq-with.js +0 -33
  170. package/dist/commonjs/array/uniq.d.ts +0 -7
  171. package/dist/commonjs/array/uniq.d.ts.map +0 -1
  172. package/dist/commonjs/array/uniq.js +0 -32
  173. package/dist/commonjs/array/zip-obj.d.ts +0 -3
  174. package/dist/commonjs/array/zip-obj.d.ts.map +0 -1
  175. package/dist/commonjs/array/zip-obj.js +0 -16
  176. package/dist/commonjs/array/zip-with.d.ts +0 -4
  177. package/dist/commonjs/array/zip-with.d.ts.map +0 -1
  178. package/dist/commonjs/array/zip-with.js +0 -28
  179. package/dist/commonjs/array/zip.d.ts +0 -3
  180. package/dist/commonjs/array/zip.d.ts.map +0 -1
  181. package/dist/commonjs/array/zip.js +0 -16
  182. package/dist/commonjs/base.d.ts +0 -2
  183. package/dist/commonjs/base.d.ts.map +0 -1
  184. package/dist/commonjs/base.js +0 -7
  185. package/dist/commonjs/function/create-pipe.d.ts +0 -8
  186. package/dist/commonjs/function/create-pipe.d.ts.map +0 -1
  187. package/dist/commonjs/function/create-pipe.js +0 -8
  188. package/dist/commonjs/function/identity.d.ts +0 -2
  189. package/dist/commonjs/function/identity.d.ts.map +0 -1
  190. package/dist/commonjs/function/identity.js +0 -7
  191. package/dist/commonjs/function/index.d.ts +0 -7
  192. package/dist/commonjs/function/index.d.ts.map +0 -1
  193. package/dist/commonjs/function/index.js +0 -22
  194. package/dist/commonjs/function/noop.d.ts +0 -2
  195. package/dist/commonjs/function/noop.d.ts.map +0 -1
  196. package/dist/commonjs/function/noop.js +0 -7
  197. package/dist/commonjs/function/once.d.ts +0 -2
  198. package/dist/commonjs/function/once.d.ts.map +0 -1
  199. package/dist/commonjs/function/once.js +0 -15
  200. package/dist/commonjs/function/pipe.d.ts +0 -16
  201. package/dist/commonjs/function/pipe.d.ts.map +0 -1
  202. package/dist/commonjs/function/pipe.js +0 -105
  203. package/dist/commonjs/function/purry.d.ts +0 -2
  204. package/dist/commonjs/function/purry.d.ts.map +0 -1
  205. package/dist/commonjs/function/purry.js +0 -20
  206. package/dist/commonjs/guard/index.d.ts +0 -16
  207. package/dist/commonjs/guard/index.d.ts.map +0 -1
  208. package/dist/commonjs/guard/index.js +0 -31
  209. package/dist/commonjs/guard/is-array.d.ts +0 -4
  210. package/dist/commonjs/guard/is-array.d.ts.map +0 -1
  211. package/dist/commonjs/guard/is-array.js +0 -7
  212. package/dist/commonjs/guard/is-boolean.d.ts +0 -4
  213. package/dist/commonjs/guard/is-boolean.d.ts.map +0 -1
  214. package/dist/commonjs/guard/is-boolean.js +0 -7
  215. package/dist/commonjs/guard/is-date.d.ts +0 -2
  216. package/dist/commonjs/guard/is-date.d.ts.map +0 -1
  217. package/dist/commonjs/guard/is-date.js +0 -7
  218. package/dist/commonjs/guard/is-defined.d.ts +0 -5
  219. package/dist/commonjs/guard/is-defined.d.ts.map +0 -1
  220. package/dist/commonjs/guard/is-defined.js +0 -13
  221. package/dist/commonjs/guard/is-empty.d.ts +0 -4
  222. package/dist/commonjs/guard/is-empty.d.ts.map +0 -1
  223. package/dist/commonjs/guard/is-empty.js +0 -19
  224. package/dist/commonjs/guard/is-error.d.ts +0 -4
  225. package/dist/commonjs/guard/is-error.d.ts.map +0 -1
  226. package/dist/commonjs/guard/is-error.js +0 -7
  227. package/dist/commonjs/guard/is-function.d.ts +0 -4
  228. package/dist/commonjs/guard/is-function.d.ts.map +0 -1
  229. package/dist/commonjs/guard/is-function.js +0 -7
  230. package/dist/commonjs/guard/is-nil.d.ts +0 -2
  231. package/dist/commonjs/guard/is-nil.d.ts.map +0 -1
  232. package/dist/commonjs/guard/is-nil.js +0 -7
  233. package/dist/commonjs/guard/is-non-null.d.ts +0 -2
  234. package/dist/commonjs/guard/is-non-null.d.ts.map +0 -1
  235. package/dist/commonjs/guard/is-non-null.js +0 -7
  236. package/dist/commonjs/guard/is-not.d.ts +0 -3
  237. package/dist/commonjs/guard/is-not.d.ts.map +0 -1
  238. package/dist/commonjs/guard/is-not.js +0 -9
  239. package/dist/commonjs/guard/is-number.d.ts +0 -4
  240. package/dist/commonjs/guard/is-number.d.ts.map +0 -1
  241. package/dist/commonjs/guard/is-number.js +0 -7
  242. package/dist/commonjs/guard/is-object.d.ts +0 -4
  243. package/dist/commonjs/guard/is-object.d.ts.map +0 -1
  244. package/dist/commonjs/guard/is-object.js +0 -8
  245. package/dist/commonjs/guard/is-promise.d.ts +0 -2
  246. package/dist/commonjs/guard/is-promise.d.ts.map +0 -1
  247. package/dist/commonjs/guard/is-promise.js +0 -7
  248. package/dist/commonjs/guard/is-string.d.ts +0 -4
  249. package/dist/commonjs/guard/is-string.d.ts.map +0 -1
  250. package/dist/commonjs/guard/is-string.js +0 -7
  251. package/dist/commonjs/guard/is-truthy.d.ts +0 -2
  252. package/dist/commonjs/guard/is-truthy.d.ts.map +0 -1
  253. package/dist/commonjs/guard/is-truthy.js +0 -7
  254. package/dist/commonjs/helpers/index.d.ts +0 -8
  255. package/dist/commonjs/helpers/index.d.ts.map +0 -1
  256. package/dist/commonjs/helpers/index.js +0 -52
  257. package/dist/commonjs/index.d.ts +0 -10
  258. package/dist/commonjs/index.d.ts.map +0 -1
  259. package/dist/commonjs/index.js +0 -25
  260. package/dist/commonjs/number/clamp.d.ts +0 -9
  261. package/dist/commonjs/number/clamp.d.ts.map +0 -1
  262. package/dist/commonjs/number/clamp.js +0 -17
  263. package/dist/commonjs/number/index.d.ts +0 -2
  264. package/dist/commonjs/number/index.d.ts.map +0 -1
  265. package/dist/commonjs/number/index.js +0 -17
  266. package/dist/commonjs/object/add-prop.d.ts +0 -7
  267. package/dist/commonjs/object/add-prop.d.ts.map +0 -1
  268. package/dist/commonjs/object/add-prop.js +0 -11
  269. package/dist/commonjs/object/clone.d.ts +0 -2
  270. package/dist/commonjs/object/clone.d.ts.map +0 -1
  271. package/dist/commonjs/object/clone.js +0 -49
  272. package/dist/commonjs/object/equals.d.ts +0 -3
  273. package/dist/commonjs/object/equals.d.ts.map +0 -1
  274. package/dist/commonjs/object/equals.js +0 -71
  275. package/dist/commonjs/object/for-each-obj.d.ts +0 -10
  276. package/dist/commonjs/object/for-each-obj.d.ts.map +0 -1
  277. package/dist/commonjs/object/for-each-obj.js +0 -30
  278. package/dist/commonjs/object/from-pairs.d.ts +0 -21
  279. package/dist/commonjs/object/from-pairs.d.ts.map +0 -1
  280. package/dist/commonjs/object/from-pairs.js +0 -14
  281. package/dist/commonjs/object/index.d.ts +0 -23
  282. package/dist/commonjs/object/index.d.ts.map +0 -1
  283. package/dist/commonjs/object/index.js +0 -38
  284. package/dist/commonjs/object/invert.d.ts +0 -5
  285. package/dist/commonjs/object/invert.d.ts.map +0 -1
  286. package/dist/commonjs/object/invert.js +0 -15
  287. package/dist/commonjs/object/keys.d.ts +0 -15
  288. package/dist/commonjs/object/keys.d.ts.map +0 -1
  289. package/dist/commonjs/object/keys.js +0 -10
  290. package/dist/commonjs/object/map-keys.d.ts +0 -3
  291. package/dist/commonjs/object/map-keys.d.ts.map +0 -1
  292. package/dist/commonjs/object/map-keys.js +0 -16
  293. package/dist/commonjs/object/map-values.d.ts +0 -3
  294. package/dist/commonjs/object/map-values.d.ts.map +0 -1
  295. package/dist/commonjs/object/map-values.js +0 -16
  296. package/dist/commonjs/object/merge.d.ts +0 -3
  297. package/dist/commonjs/object/merge.d.ts.map +0 -1
  298. package/dist/commonjs/object/merge.js +0 -11
  299. package/dist/commonjs/object/omit-by.d.ts +0 -3
  300. package/dist/commonjs/object/omit-by.d.ts.map +0 -1
  301. package/dist/commonjs/object/omit-by.js +0 -16
  302. package/dist/commonjs/object/omit.d.ts +0 -3
  303. package/dist/commonjs/object/omit.d.ts.map +0 -1
  304. package/dist/commonjs/object/omit.js +0 -35
  305. package/dist/commonjs/object/path-or.d.ts +0 -21
  306. package/dist/commonjs/object/path-or.d.ts.map +0 -1
  307. package/dist/commonjs/object/path-or.js +0 -18
  308. package/dist/commonjs/object/pick-by.d.ts +0 -3
  309. package/dist/commonjs/object/pick-by.d.ts.map +0 -1
  310. package/dist/commonjs/object/pick-by.js +0 -19
  311. package/dist/commonjs/object/pick.d.ts +0 -3
  312. package/dist/commonjs/object/pick.d.ts.map +0 -1
  313. package/dist/commonjs/object/pick.js +0 -19
  314. package/dist/commonjs/object/prop.d.ts +0 -2
  315. package/dist/commonjs/object/prop.d.ts.map +0 -1
  316. package/dist/commonjs/object/prop.js +0 -5
  317. package/dist/commonjs/object/set-path.d.ts +0 -6
  318. package/dist/commonjs/object/set-path.d.ts.map +0 -1
  319. package/dist/commonjs/object/set-path.js +0 -23
  320. package/dist/commonjs/object/set.d.ts +0 -3
  321. package/dist/commonjs/object/set.d.ts.map +0 -1
  322. package/dist/commonjs/object/set.js +0 -11
  323. package/dist/commonjs/object/swap-props.d.ts +0 -7
  324. package/dist/commonjs/object/swap-props.d.ts.map +0 -1
  325. package/dist/commonjs/object/swap-props.js +0 -12
  326. package/dist/commonjs/object/to-pairs.d.ts +0 -13
  327. package/dist/commonjs/object/to-pairs.d.ts.map +0 -1
  328. package/dist/commonjs/object/to-pairs.js +0 -13
  329. package/dist/commonjs/object/values.d.ts +0 -2
  330. package/dist/commonjs/object/values.d.ts.map +0 -1
  331. package/dist/commonjs/object/values.js +0 -7
  332. package/dist/commonjs/string/cases-types.d.ts +0 -29
  333. package/dist/commonjs/string/cases-types.d.ts.map +0 -1
  334. package/dist/commonjs/string/cases-types.js +0 -2
  335. package/dist/commonjs/string/cases.d.ts +0 -16
  336. package/dist/commonjs/string/cases.d.ts.map +0 -1
  337. package/dist/commonjs/string/cases.js +0 -86
  338. package/dist/commonjs/string/index.d.ts +0 -4
  339. package/dist/commonjs/string/index.d.ts.map +0 -1
  340. package/dist/commonjs/string/index.js +0 -19
  341. package/dist/commonjs/string/random-string.d.ts +0 -2
  342. package/dist/commonjs/string/random-string.d.ts.map +0 -1
  343. package/dist/commonjs/string/random-string.js +0 -10
  344. package/dist/commonjs/string/string-to-path.d.ts +0 -3
  345. package/dist/commonjs/string/string-to-path.d.ts.map +0 -1
  346. package/dist/commonjs/string/string-to-path.js +0 -19
  347. package/dist/commonjs/type/index.d.ts +0 -2
  348. package/dist/commonjs/type/index.d.ts.map +0 -1
  349. package/dist/commonjs/type/index.js +0 -17
  350. package/dist/commonjs/type/type.d.ts +0 -2
  351. package/dist/commonjs/type/type.d.ts.map +0 -1
  352. package/dist/commonjs/type/type.js +0 -11
  353. package/dist/commonjs/utils/narrow.d.ts +0 -8
  354. package/dist/commonjs/utils/narrow.d.ts.map +0 -1
  355. package/dist/commonjs/utils/narrow.js +0 -2
  356. package/dist/commonjs/utils/paths.d.ts +0 -9
  357. package/dist/commonjs/utils/paths.d.ts.map +0 -1
  358. package/dist/commonjs/utils/paths.js +0 -2
  359. package/dist/commonjs/utils/reduce-lazy.d.ts +0 -22
  360. package/dist/commonjs/utils/reduce-lazy.d.ts.map +0 -1
  361. package/dist/commonjs/utils/reduce-lazy.js +0 -18
  362. package/dist/commonjs/utils/to-lazy-indexed.d.ts +0 -4
  363. package/dist/commonjs/utils/to-lazy-indexed.d.ts.map +0 -1
  364. package/dist/commonjs/utils/to-lazy-indexed.js +0 -8
  365. package/dist/commonjs/utils/to-single.d.ts +0 -4
  366. package/dist/commonjs/utils/to-single.d.ts.map +0 -1
  367. package/dist/commonjs/utils/to-single.js +0 -8
  368. package/dist/commonjs/utils/types.d.ts +0 -6
  369. package/dist/commonjs/utils/types.d.ts.map +0 -1
  370. package/dist/commonjs/utils/types.js +0 -2
  371. package/dist/es/aria/index.d.ts +0 -2
  372. package/dist/es/aria/index.d.ts.map +0 -1
  373. package/dist/es/aria/index.js +0 -1
  374. package/dist/es/aria/key-codes.d.ts +0 -23
  375. package/dist/es/aria/key-codes.d.ts.map +0 -1
  376. package/dist/es/aria/key-codes.js +0 -22
  377. package/dist/es/array/all-pass.d.ts +0 -3
  378. package/dist/es/array/all-pass.d.ts.map +0 -1
  379. package/dist/es/array/all-pass.js +0 -7
  380. package/dist/es/array/any-pass.d.ts +0 -3
  381. package/dist/es/array/any-pass.d.ts.map +0 -1
  382. package/dist/es/array/any-pass.js +0 -7
  383. package/dist/es/array/chunk.d.ts +0 -6
  384. package/dist/es/array/chunk.d.ts.map +0 -1
  385. package/dist/es/array/chunk.js +0 -13
  386. package/dist/es/array/compact.d.ts +0 -2
  387. package/dist/es/array/compact.d.ts.map +0 -1
  388. package/dist/es/array/compact.js +0 -4
  389. package/dist/es/array/concat.d.ts +0 -3
  390. package/dist/es/array/concat.d.ts.map +0 -1
  391. package/dist/es/array/concat.js +0 -7
  392. package/dist/es/array/count-by.d.ts +0 -8
  393. package/dist/es/array/count-by.d.ts.map +0 -1
  394. package/dist/es/array/count-by.js +0 -18
  395. package/dist/es/array/difference-with.d.ts +0 -9
  396. package/dist/es/array/difference-with.d.ts.map +0 -1
  397. package/dist/es/array/difference-with.js +0 -27
  398. package/dist/es/array/difference.d.ts +0 -7
  399. package/dist/es/array/difference.d.ts.map +0 -1
  400. package/dist/es/array/difference.js +0 -28
  401. package/dist/es/array/drop-last.d.ts +0 -3
  402. package/dist/es/array/drop-last.d.ts.map +0 -1
  403. package/dist/es/array/drop-last.js +0 -11
  404. package/dist/es/array/drop.d.ts +0 -7
  405. package/dist/es/array/drop.d.ts.map +0 -1
  406. package/dist/es/array/drop.js +0 -28
  407. package/dist/es/array/filter.d.ts +0 -17
  408. package/dist/es/array/filter.d.ts.map +0 -1
  409. package/dist/es/array/filter.js +0 -37
  410. package/dist/es/array/find-index.d.ts +0 -32
  411. package/dist/es/array/find-index.d.ts.map +0 -1
  412. package/dist/es/array/find-index.js +0 -42
  413. package/dist/es/array/find-last-index.d.ts +0 -8
  414. package/dist/es/array/find-last-index.d.ts.map +0 -1
  415. package/dist/es/array/find-last-index.js +0 -20
  416. package/dist/es/array/find-last.d.ts +0 -8
  417. package/dist/es/array/find-last.d.ts.map +0 -1
  418. package/dist/es/array/find-last.js +0 -19
  419. package/dist/es/array/find.d.ts +0 -24
  420. package/dist/es/array/find.d.ts.map +0 -1
  421. package/dist/es/array/find.js +0 -34
  422. package/dist/es/array/first.d.ts +0 -16
  423. package/dist/es/array/first.d.ts.map +0 -1
  424. package/dist/es/array/first.js +0 -22
  425. package/dist/es/array/flat-map-to-obj.d.ts +0 -7
  426. package/dist/es/array/flat-map-to-obj.d.ts.map +0 -1
  427. package/dist/es/array/flat-map-to-obj.js +0 -21
  428. package/dist/es/array/flat-map.d.ts +0 -16
  429. package/dist/es/array/flat-map.d.ts.map +0 -1
  430. package/dist/es/array/flat-map.js +0 -29
  431. package/dist/es/array/flatten-deep.d.ts +0 -12
  432. package/dist/es/array/flatten-deep.d.ts.map +0 -1
  433. package/dist/es/array/flatten-deep.js +0 -44
  434. package/dist/es/array/flatten.d.ts +0 -9
  435. package/dist/es/array/flatten.d.ts.map +0 -1
  436. package/dist/es/array/flatten.js +0 -28
  437. package/dist/es/array/for-each.d.ts +0 -13
  438. package/dist/es/array/for-each.d.ts.map +0 -1
  439. package/dist/es/array/for-each.js +0 -36
  440. package/dist/es/array/group-by.d.ts +0 -19
  441. package/dist/es/array/group-by.d.ts.map +0 -1
  442. package/dist/es/array/group-by.js +0 -27
  443. package/dist/es/array/index-by.d.ts +0 -8
  444. package/dist/es/array/index-by.d.ts.map +0 -1
  445. package/dist/es/array/index-by.js +0 -20
  446. package/dist/es/array/index.d.ts +0 -56
  447. package/dist/es/array/index.d.ts.map +0 -1
  448. package/dist/es/array/index.js +0 -55
  449. package/dist/es/array/intersection-with.d.ts +0 -9
  450. package/dist/es/array/intersection-with.d.ts.map +0 -1
  451. package/dist/es/array/intersection-with.js +0 -27
  452. package/dist/es/array/intersection.d.ts +0 -7
  453. package/dist/es/array/intersection.d.ts.map +0 -1
  454. package/dist/es/array/intersection.js +0 -28
  455. package/dist/es/array/join.d.ts +0 -8
  456. package/dist/es/array/join.d.ts.map +0 -1
  457. package/dist/es/array/join.js +0 -7
  458. package/dist/es/array/last.d.ts +0 -5
  459. package/dist/es/array/last.d.ts.map +0 -1
  460. package/dist/es/array/last.js +0 -7
  461. package/dist/es/array/length.d.ts +0 -5
  462. package/dist/es/array/length.d.ts.map +0 -1
  463. package/dist/es/array/length.js +0 -7
  464. package/dist/es/array/map-to-obj.d.ts +0 -7
  465. package/dist/es/array/map-to-obj.d.ts.map +0 -1
  466. package/dist/es/array/map-to-obj.js +0 -19
  467. package/dist/es/array/map.d.ts +0 -26
  468. package/dist/es/array/map.d.ts.map +0 -1
  469. package/dist/es/array/map.js +0 -31
  470. package/dist/es/array/max-by.d.ts +0 -8
  471. package/dist/es/array/max-by.d.ts.map +0 -1
  472. package/dist/es/array/max-by.js +0 -24
  473. package/dist/es/array/mean-by.d.ts +0 -8
  474. package/dist/es/array/mean-by.d.ts.map +0 -1
  475. package/dist/es/array/mean-by.js +0 -22
  476. package/dist/es/array/merge-all.d.ts +0 -7
  477. package/dist/es/array/merge-all.d.ts.map +0 -1
  478. package/dist/es/array/merge-all.js +0 -3
  479. package/dist/es/array/min-by.d.ts +0 -8
  480. package/dist/es/array/min-by.d.ts.map +0 -1
  481. package/dist/es/array/min-by.js +0 -24
  482. package/dist/es/array/partition.d.ts +0 -10
  483. package/dist/es/array/partition.d.ts.map +0 -1
  484. package/dist/es/array/partition.js +0 -20
  485. package/dist/es/array/range.d.ts +0 -3
  486. package/dist/es/array/range.d.ts.map +0 -1
  487. package/dist/es/array/range.js +0 -11
  488. package/dist/es/array/reduce.d.ts +0 -7
  489. package/dist/es/array/reduce.d.ts.map +0 -1
  490. package/dist/es/array/reduce.js +0 -15
  491. package/dist/es/array/reject.d.ts +0 -13
  492. package/dist/es/array/reject.d.ts.map +0 -1
  493. package/dist/es/array/reject.js +0 -37
  494. package/dist/es/array/reverse.d.ts +0 -6
  495. package/dist/es/array/reverse.d.ts.map +0 -1
  496. package/dist/es/array/reverse.js +0 -7
  497. package/dist/es/array/sample.d.ts +0 -11
  498. package/dist/es/array/sample.d.ts.map +0 -1
  499. package/dist/es/array/sample.js +0 -30
  500. package/dist/es/array/shuffle.d.ts +0 -3
  501. package/dist/es/array/shuffle.d.ts.map +0 -1
  502. package/dist/es/array/shuffle.js +0 -14
  503. package/dist/es/array/sort-by.d.ts +0 -27
  504. package/dist/es/array/sort-by.d.ts.map +0 -1
  505. package/dist/es/array/sort-by.js +0 -51
  506. package/dist/es/array/sort.d.ts +0 -15
  507. package/dist/es/array/sort.d.ts.map +0 -1
  508. package/dist/es/array/sort.js +0 -12
  509. package/dist/es/array/split-at.d.ts +0 -3
  510. package/dist/es/array/split-at.d.ts.map +0 -1
  511. package/dist/es/array/split-at.js +0 -9
  512. package/dist/es/array/split-when.d.ts +0 -3
  513. package/dist/es/array/split-when.d.ts.map +0 -1
  514. package/dist/es/array/split-when.js +0 -13
  515. package/dist/es/array/sum-by.d.ts +0 -8
  516. package/dist/es/array/sum-by.d.ts.map +0 -1
  517. package/dist/es/array/sum-by.js +0 -20
  518. package/dist/es/array/swap-indices.d.ts +0 -25
  519. package/dist/es/array/swap-indices.d.ts.map +0 -1
  520. package/dist/es/array/swap-indices.js +0 -30
  521. package/dist/es/array/take-while.d.ts +0 -3
  522. package/dist/es/array/take-while.d.ts.map +0 -1
  523. package/dist/es/array/take-while.js +0 -14
  524. package/dist/es/array/take.d.ts +0 -7
  525. package/dist/es/array/take.d.ts.map +0 -1
  526. package/dist/es/array/take.js +0 -34
  527. package/dist/es/array/uniq-by.d.ts +0 -3
  528. package/dist/es/array/uniq-by.d.ts.map +0 -1
  529. package/dist/es/array/uniq-by.js +0 -26
  530. package/dist/es/array/uniq-with.d.ts +0 -12
  531. package/dist/es/array/uniq-with.d.ts.map +0 -1
  532. package/dist/es/array/uniq-with.js +0 -29
  533. package/dist/es/array/uniq.d.ts +0 -7
  534. package/dist/es/array/uniq.d.ts.map +0 -1
  535. package/dist/es/array/uniq.js +0 -28
  536. package/dist/es/array/zip-obj.d.ts +0 -3
  537. package/dist/es/array/zip-obj.d.ts.map +0 -1
  538. package/dist/es/array/zip-obj.js +0 -12
  539. package/dist/es/array/zip-with.d.ts +0 -4
  540. package/dist/es/array/zip-with.d.ts.map +0 -1
  541. package/dist/es/array/zip-with.js +0 -24
  542. package/dist/es/array/zip.d.ts +0 -3
  543. package/dist/es/array/zip.d.ts.map +0 -1
  544. package/dist/es/array/zip.js +0 -12
  545. package/dist/es/base.d.ts +0 -2
  546. package/dist/es/base.d.ts.map +0 -1
  547. package/dist/es/base.js +0 -3
  548. package/dist/es/function/create-pipe.d.ts +0 -8
  549. package/dist/es/function/create-pipe.d.ts.map +0 -1
  550. package/dist/es/function/create-pipe.js +0 -4
  551. package/dist/es/function/identity.d.ts +0 -2
  552. package/dist/es/function/identity.d.ts.map +0 -1
  553. package/dist/es/function/identity.js +0 -3
  554. package/dist/es/function/index.d.ts +0 -7
  555. package/dist/es/function/index.d.ts.map +0 -1
  556. package/dist/es/function/index.js +0 -6
  557. package/dist/es/function/noop.d.ts +0 -2
  558. package/dist/es/function/noop.d.ts.map +0 -1
  559. package/dist/es/function/noop.js +0 -3
  560. package/dist/es/function/once.d.ts +0 -2
  561. package/dist/es/function/once.d.ts.map +0 -1
  562. package/dist/es/function/once.js +0 -11
  563. package/dist/es/function/pipe.d.ts +0 -16
  564. package/dist/es/function/pipe.d.ts.map +0 -1
  565. package/dist/es/function/pipe.js +0 -101
  566. package/dist/es/function/purry.d.ts +0 -2
  567. package/dist/es/function/purry.d.ts.map +0 -1
  568. package/dist/es/function/purry.js +0 -16
  569. package/dist/es/guard/index.d.ts +0 -16
  570. package/dist/es/guard/index.d.ts.map +0 -1
  571. package/dist/es/guard/index.js +0 -15
  572. package/dist/es/guard/is-array.d.ts +0 -4
  573. package/dist/es/guard/is-array.d.ts.map +0 -1
  574. package/dist/es/guard/is-array.js +0 -3
  575. package/dist/es/guard/is-boolean.d.ts +0 -4
  576. package/dist/es/guard/is-boolean.d.ts.map +0 -1
  577. package/dist/es/guard/is-boolean.js +0 -3
  578. package/dist/es/guard/is-date.d.ts +0 -2
  579. package/dist/es/guard/is-date.d.ts.map +0 -1
  580. package/dist/es/guard/is-date.js +0 -3
  581. package/dist/es/guard/is-defined.d.ts +0 -5
  582. package/dist/es/guard/is-defined.d.ts.map +0 -1
  583. package/dist/es/guard/is-defined.js +0 -9
  584. package/dist/es/guard/is-empty.d.ts +0 -4
  585. package/dist/es/guard/is-empty.d.ts.map +0 -1
  586. package/dist/es/guard/is-empty.js +0 -15
  587. package/dist/es/guard/is-error.d.ts +0 -4
  588. package/dist/es/guard/is-error.d.ts.map +0 -1
  589. package/dist/es/guard/is-error.js +0 -3
  590. package/dist/es/guard/is-function.d.ts +0 -4
  591. package/dist/es/guard/is-function.d.ts.map +0 -1
  592. package/dist/es/guard/is-function.js +0 -3
  593. package/dist/es/guard/is-nil.d.ts +0 -2
  594. package/dist/es/guard/is-nil.d.ts.map +0 -1
  595. package/dist/es/guard/is-nil.js +0 -3
  596. package/dist/es/guard/is-non-null.d.ts +0 -2
  597. package/dist/es/guard/is-non-null.d.ts.map +0 -1
  598. package/dist/es/guard/is-non-null.js +0 -3
  599. package/dist/es/guard/is-not.d.ts +0 -3
  600. package/dist/es/guard/is-not.d.ts.map +0 -1
  601. package/dist/es/guard/is-not.js +0 -5
  602. package/dist/es/guard/is-number.d.ts +0 -4
  603. package/dist/es/guard/is-number.d.ts.map +0 -1
  604. package/dist/es/guard/is-number.js +0 -3
  605. package/dist/es/guard/is-object.d.ts +0 -4
  606. package/dist/es/guard/is-object.d.ts.map +0 -1
  607. package/dist/es/guard/is-object.js +0 -4
  608. package/dist/es/guard/is-promise.d.ts +0 -2
  609. package/dist/es/guard/is-promise.d.ts.map +0 -1
  610. package/dist/es/guard/is-promise.js +0 -3
  611. package/dist/es/guard/is-string.d.ts +0 -4
  612. package/dist/es/guard/is-string.d.ts.map +0 -1
  613. package/dist/es/guard/is-string.js +0 -3
  614. package/dist/es/guard/is-truthy.d.ts +0 -2
  615. package/dist/es/guard/is-truthy.d.ts.map +0 -1
  616. package/dist/es/guard/is-truthy.js +0 -3
  617. package/dist/es/helpers/index.d.ts +0 -8
  618. package/dist/es/helpers/index.d.ts.map +0 -1
  619. package/dist/es/helpers/index.js +0 -45
  620. package/dist/es/index.d.ts +0 -10
  621. package/dist/es/index.d.ts.map +0 -1
  622. package/dist/es/index.js +0 -9
  623. package/dist/es/number/clamp.d.ts +0 -9
  624. package/dist/es/number/clamp.d.ts.map +0 -1
  625. package/dist/es/number/clamp.js +0 -13
  626. package/dist/es/number/index.d.ts +0 -2
  627. package/dist/es/number/index.d.ts.map +0 -1
  628. package/dist/es/number/index.js +0 -1
  629. package/dist/es/object/add-prop.d.ts +0 -7
  630. package/dist/es/object/add-prop.d.ts.map +0 -1
  631. package/dist/es/object/add-prop.js +0 -7
  632. package/dist/es/object/clone.d.ts +0 -2
  633. package/dist/es/object/clone.d.ts.map +0 -1
  634. package/dist/es/object/clone.js +0 -45
  635. package/dist/es/object/equals.d.ts +0 -3
  636. package/dist/es/object/equals.d.ts.map +0 -1
  637. package/dist/es/object/equals.js +0 -67
  638. package/dist/es/object/for-each-obj.d.ts +0 -10
  639. package/dist/es/object/for-each-obj.d.ts.map +0 -1
  640. package/dist/es/object/for-each-obj.js +0 -26
  641. package/dist/es/object/from-pairs.d.ts +0 -21
  642. package/dist/es/object/from-pairs.d.ts.map +0 -1
  643. package/dist/es/object/from-pairs.js +0 -10
  644. package/dist/es/object/index.d.ts +0 -23
  645. package/dist/es/object/index.d.ts.map +0 -1
  646. package/dist/es/object/index.js +0 -22
  647. package/dist/es/object/invert.d.ts +0 -5
  648. package/dist/es/object/invert.d.ts.map +0 -1
  649. package/dist/es/object/invert.js +0 -11
  650. package/dist/es/object/keys.d.ts +0 -15
  651. package/dist/es/object/keys.d.ts.map +0 -1
  652. package/dist/es/object/keys.js +0 -6
  653. package/dist/es/object/map-keys.d.ts +0 -3
  654. package/dist/es/object/map-keys.d.ts.map +0 -1
  655. package/dist/es/object/map-keys.js +0 -12
  656. package/dist/es/object/map-values.d.ts +0 -3
  657. package/dist/es/object/map-values.d.ts.map +0 -1
  658. package/dist/es/object/map-values.js +0 -12
  659. package/dist/es/object/merge.d.ts +0 -3
  660. package/dist/es/object/merge.d.ts.map +0 -1
  661. package/dist/es/object/merge.js +0 -7
  662. package/dist/es/object/omit-by.d.ts +0 -3
  663. package/dist/es/object/omit-by.d.ts.map +0 -1
  664. package/dist/es/object/omit-by.js +0 -12
  665. package/dist/es/object/omit.d.ts +0 -3
  666. package/dist/es/object/omit.d.ts.map +0 -1
  667. package/dist/es/object/omit.js +0 -31
  668. package/dist/es/object/path-or.d.ts +0 -21
  669. package/dist/es/object/path-or.d.ts.map +0 -1
  670. package/dist/es/object/path-or.js +0 -14
  671. package/dist/es/object/pick-by.d.ts +0 -3
  672. package/dist/es/object/pick-by.d.ts.map +0 -1
  673. package/dist/es/object/pick-by.js +0 -15
  674. package/dist/es/object/pick.d.ts +0 -3
  675. package/dist/es/object/pick.d.ts.map +0 -1
  676. package/dist/es/object/pick.js +0 -15
  677. package/dist/es/object/prop.d.ts +0 -2
  678. package/dist/es/object/prop.d.ts.map +0 -1
  679. package/dist/es/object/prop.js +0 -1
  680. package/dist/es/object/set-path.d.ts +0 -6
  681. package/dist/es/object/set-path.d.ts.map +0 -1
  682. package/dist/es/object/set-path.js +0 -18
  683. package/dist/es/object/set.d.ts +0 -3
  684. package/dist/es/object/set.d.ts.map +0 -1
  685. package/dist/es/object/set.js +0 -7
  686. package/dist/es/object/swap-props.d.ts +0 -7
  687. package/dist/es/object/swap-props.d.ts.map +0 -1
  688. package/dist/es/object/swap-props.js +0 -8
  689. package/dist/es/object/to-pairs.d.ts +0 -13
  690. package/dist/es/object/to-pairs.d.ts.map +0 -1
  691. package/dist/es/object/to-pairs.js +0 -9
  692. package/dist/es/object/values.d.ts +0 -2
  693. package/dist/es/object/values.d.ts.map +0 -1
  694. package/dist/es/object/values.js +0 -3
  695. package/dist/es/string/cases-types.d.ts +0 -29
  696. package/dist/es/string/cases-types.d.ts.map +0 -1
  697. package/dist/es/string/cases-types.js +0 -1
  698. package/dist/es/string/cases.d.ts +0 -16
  699. package/dist/es/string/cases.d.ts.map +0 -1
  700. package/dist/es/string/cases.js +0 -75
  701. package/dist/es/string/index.d.ts +0 -4
  702. package/dist/es/string/index.d.ts.map +0 -1
  703. package/dist/es/string/index.js +0 -3
  704. package/dist/es/string/random-string.d.ts +0 -2
  705. package/dist/es/string/random-string.d.ts.map +0 -1
  706. package/dist/es/string/random-string.js +0 -6
  707. package/dist/es/string/string-to-path.d.ts +0 -3
  708. package/dist/es/string/string-to-path.d.ts.map +0 -1
  709. package/dist/es/string/string-to-path.js +0 -15
  710. package/dist/es/type/index.d.ts +0 -2
  711. package/dist/es/type/index.d.ts.map +0 -1
  712. package/dist/es/type/index.js +0 -1
  713. package/dist/es/type/type.d.ts +0 -2
  714. package/dist/es/type/type.d.ts.map +0 -1
  715. package/dist/es/type/type.js +0 -7
  716. package/dist/es/utils/narrow.d.ts +0 -8
  717. package/dist/es/utils/narrow.d.ts.map +0 -1
  718. package/dist/es/utils/narrow.js +0 -1
  719. package/dist/es/utils/paths.d.ts +0 -9
  720. package/dist/es/utils/paths.d.ts.map +0 -1
  721. package/dist/es/utils/paths.js +0 -1
  722. package/dist/es/utils/reduce-lazy.d.ts +0 -22
  723. package/dist/es/utils/reduce-lazy.d.ts.map +0 -1
  724. package/dist/es/utils/reduce-lazy.js +0 -14
  725. package/dist/es/utils/to-lazy-indexed.d.ts +0 -4
  726. package/dist/es/utils/to-lazy-indexed.d.ts.map +0 -1
  727. package/dist/es/utils/to-lazy-indexed.js +0 -4
  728. package/dist/es/utils/to-single.d.ts +0 -4
  729. package/dist/es/utils/to-single.d.ts.map +0 -1
  730. package/dist/es/utils/to-single.js +0 -4
  731. package/dist/es/utils/types.d.ts +0 -6
  732. package/dist/es/utils/types.d.ts.map +0 -1
  733. package/dist/es/utils/types.js +0 -1
@@ -0,0 +1,3221 @@
1
+ /**
2
+ * Using event.code is not predictable since each machine may have different output
3
+ */
4
+ declare const KEY_CODES: {
5
+ readonly TAB: "Tab";
6
+ readonly ARROW_DOWN: "ArrowDown";
7
+ readonly ARROW_UP: "ArrowUp";
8
+ readonly ARROW_LEFT: "ArrowLeft";
9
+ readonly ARROW_RIGHT: "ArrowRight";
10
+ readonly ENTER: "Enter";
11
+ readonly ESC: "Escape";
12
+ readonly SPACE: "Space";
13
+ readonly SHIFT: "Shift";
14
+ readonly KEY_F: "KEY_F";
15
+ readonly CTRL: "Control";
16
+ readonly ALT: "Alt";
17
+ readonly META: "Meta";
18
+ readonly AT: "@";
19
+ readonly DELETE: "Delete";
20
+ readonly BACKSPACE: "Backspace";
21
+ readonly HOME: "Home";
22
+ readonly END: "End";
23
+ readonly PAGE_UP: "PageUp";
24
+ readonly PAGE_DOWN: "PageDown";
25
+ };
26
+
27
+ /**
28
+ * Determines whether all predicates returns true for the input data.
29
+ * @param data The input data for predicates.
30
+ * @param fns The list of predicates.
31
+ * @signature
32
+ * P.allPass(data, fns)
33
+ * @example
34
+ * const isDivisibleBy3 = (x: number) => x % 3 === 0
35
+ * const isDivisibleBy4 = (x: number) => x % 4 === 0
36
+ * const fns = [isDivisibleBy3, isDivisibleBy4]
37
+ * P.allPass(12, fns) // => true
38
+ * P.allPass(8, fns) // => false
39
+ * @dataFirst
40
+ * @category Array
41
+ */
42
+ declare function allPass<T>(data: T, fns: ReadonlyArray<(data: T) => boolean>): boolean;
43
+ /**
44
+ * Determines whether all predicates returns true for the input data.
45
+ * @param fns The list of predicates.
46
+ * @signature
47
+ * P.allPass(fns)(data)
48
+ * @example
49
+ * const isDivisibleBy3 = (x: number) => x % 3 === 0
50
+ * const isDivisibleBy4 = (x: number) => x % 4 === 0
51
+ * const fns = [isDivisibleBy3, isDivisibleBy4]
52
+ * P.allPass(fns)(12) // => true
53
+ * P.allPass(fns)(8) // => false
54
+ * @dataLast
55
+ * @category Array
56
+ */
57
+ declare function allPass<T>(fns: ReadonlyArray<(data: T) => boolean>): (data: T) => boolean;
58
+
59
+ /**
60
+ * Determines whether any predicate returns true for the input data.
61
+ * @param data The input data for predicates.
62
+ * @param fns The list of predicates.
63
+ * @signature
64
+ * P.anyPass(data, fns)
65
+ * @example
66
+ * const isDivisibleBy3 = (x: number) => x % 3 === 0
67
+ * const isDivisibleBy4 = (x: number) => x % 4 === 0
68
+ * const fns = [isDivisibleBy3, isDivisibleBy4]
69
+ * P.anyPass(8, fns) // => true
70
+ * P.anyPass(11, fns) // => false
71
+ * @dataFirst
72
+ * @category Array
73
+ */
74
+ declare function anyPass<T>(data: T, fns: ReadonlyArray<(data: T) => boolean>): boolean;
75
+ /**
76
+ * Determines whether any predicate returns true for the input data.
77
+ * @param fns The list of predicates.
78
+ * @signature
79
+ * P.anyPass(fns)(data)
80
+ * @example
81
+ * const isDivisibleBy3 = (x: number) => x % 3 === 0
82
+ * const isDivisibleBy4 = (x: number) => x % 4 === 0
83
+ * const fns = [isDivisibleBy3, isDivisibleBy4]
84
+ * P.anyPass(fns)(8) // => true
85
+ * P.anyPass(fns)(11) // => false
86
+ * @dataLast
87
+ * @category Array
88
+ */
89
+ declare function anyPass<T>(fns: ReadonlyArray<(data: T) => boolean>): (data: T) => boolean;
90
+
91
+ type Pred<T, K> = (input: T) => K;
92
+ type PredIndexed<T, K> = (input: T, index: number, array: Array<T>) => K;
93
+ type PredIndexedOptional<T, K> = (input: T, index?: number, array?: Array<T>) => K;
94
+ type NonEmptyArray<T> = [T, ...Array<T>];
95
+ /**
96
+ * This should only be used for defining generics which extend any kind of JS
97
+ * array under the hood, this includes arrays *AND* tuples (of the form [x, y],
98
+ * and of the form [x, ...y[]], etc...), and their readonly equivalent. This
99
+ * allows us to be more inclusive to what functions can process.
100
+ *
101
+ * @example map<T extends ArrayLike>(items: T) { ... }
102
+ *
103
+ * We would've named this `ArrayLike`, but that's already used by typescript...
104
+ *
105
+ * @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
106
+ */
107
+ type IterableContainer<T = unknown> = ReadonlyArray<T> | [];
108
+
109
+ type Chunked<T extends IterableContainer> = T[number] extends never ? [] : T extends readonly [unknown, ...Array<unknown>] | readonly [...Array<unknown>, unknown] ? NonEmptyArray<NonEmptyArray<T[number]>> : Array<NonEmptyArray<T[number]>>;
110
+ /**
111
+ * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.
112
+ * @param array the array
113
+ * @param size the length of the chunk
114
+ * @signature
115
+ * P.chunk(array, size)
116
+ * @example
117
+ * P.chunk(['a', 'b', 'c', 'd'], 2) // => [['a', 'b'], ['c', 'd']]
118
+ * P.chunk(['a', 'b', 'c', 'd'], 3) // => [['a', 'b', 'c'], ['d']]
119
+ * @dataFirst
120
+ * @category Array
121
+ */
122
+ declare function chunk<T extends IterableContainer>(array: T, size: number): Chunked<T>;
123
+ /**
124
+ * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.
125
+ * @param size the length of the chunk
126
+ * @signature
127
+ * P.chunk(size)(array)
128
+ * @example
129
+ * P.chunk(2)(['a', 'b', 'c', 'd']) // => [['a', 'b'], ['c', 'd']]
130
+ * P.chunk(3)(['a', 'b', 'c', 'd']) // => [['a', 'b', 'c'], ['d']]
131
+ * @dataLast
132
+ * @category Array
133
+ */
134
+ declare function chunk<T extends IterableContainer>(size: number): (array: T) => Chunked<T>;
135
+
136
+ /**
137
+ * Filter out all falsey values. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are falsey.
138
+ * @param items the array to compact
139
+ * @signature
140
+ * P.compact(array)
141
+ * @example
142
+ * P.compact([0, 1, false, 2, '', 3]) // => [1, 2, 3]
143
+ * @category Array
144
+ * @pipeable
145
+ */
146
+ declare function compact<T>(items: ReadonlyArray<T | null | undefined | false | '' | 0>): Array<T>;
147
+
148
+ /**
149
+ * Combines two arrays.
150
+ * @param arr1 the first array
151
+ * @param arr2 the second array
152
+ * @signature
153
+ * P.concat(arr1, arr2);
154
+ * @example
155
+ * P.concat([1, 2, 3], ['a']) // [1, 2, 3, 'a']
156
+ * @dataFirst
157
+ * @category Array
158
+ */
159
+ declare function concat<T, K>(arr1: ReadonlyArray<T>, arr2: ReadonlyArray<K>): Array<T | K>;
160
+ /**
161
+ * Combines two arrays.
162
+ * @param arr2 the second array
163
+ * @signature
164
+ * P.concat(arr2)(arr1);
165
+ * @example
166
+ * P.concat(['a'])([1, 2, 3]) // [1, 2, 3, 'a']
167
+ * @dataLast
168
+ * @category Array
169
+ */
170
+ declare function concat<T, K>(arr2: ReadonlyArray<K>): (arr1: ReadonlyArray<T>) => Array<T | K>;
171
+
172
+ /**
173
+ * Counts how many values of the collection pass the specified predicate.
174
+ * @param items The input data.
175
+ * @param fn The predicate.
176
+ * @signature
177
+ * P.countBy(array, fn)
178
+ * @example
179
+ * P.countBy([1, 2, 3, 4, 5], x => x % 2 === 0) // => 2
180
+ * @dataFirst
181
+ * @indexed
182
+ * @category Array
183
+ */
184
+ declare function countBy<T>(items: ReadonlyArray<T>, fn: Pred<T, boolean>): number;
185
+ declare function countBy<T>(fn: Pred<T, boolean>): (array: ReadonlyArray<T>) => number;
186
+ declare namespace countBy {
187
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): number;
188
+ function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => number;
189
+ }
190
+
191
+ type LazyResult<T> = LazyEmpty | LazyNext<T> | LazyMany<T>;
192
+ interface LazyEmpty {
193
+ done: boolean;
194
+ hasNext: false;
195
+ hasMany?: false | undefined;
196
+ next?: undefined;
197
+ }
198
+ interface LazyNext<T> {
199
+ done: boolean;
200
+ hasNext: true;
201
+ hasMany?: false | undefined;
202
+ next: T;
203
+ }
204
+ interface LazyMany<T> {
205
+ done: boolean;
206
+ hasNext: true;
207
+ hasMany: true;
208
+ next: Array<T>;
209
+ }
210
+
211
+ type IsEquals$1<TFirst, TSecond> = (a: TFirst, b: TSecond) => boolean;
212
+ /**
213
+ * Excludes the values from `other` array.
214
+ * Elements are compared by custom comparator isEquals.
215
+ * @param array the source array
216
+ * @param other the values to exclude
217
+ * @param isEquals the comparator
218
+ * @signature
219
+ * P.differenceWith(array, other, isEquals)
220
+ * @example
221
+ * P.differenceWith(
222
+ * [{a: 1}, {a: 2}, {a: 3}, {a: 4}],
223
+ * [{a: 2}, {a: 5}, {a: 3}],
224
+ * P.equals,
225
+ * ) // => [{a: 1}, {a: 4}]
226
+ * @dataFirst
227
+ * @category Array
228
+ * @pipeable
229
+ */
230
+ declare function differenceWith<TFirst, TSecond>(array: ReadonlyArray<TFirst>, other: ReadonlyArray<TSecond>, isEquals: IsEquals$1<TFirst, TSecond>): Array<TFirst>;
231
+ /**
232
+ * Excludes the values from `other` array.
233
+ * Elements are compared by custom comparator isEquals.
234
+ * @param other the values to exclude
235
+ * @param isEquals the comparator
236
+ * @signature
237
+ * P.differenceWith(other, isEquals)(array)
238
+ * @example
239
+ * P.differenceWith(
240
+ * [{a: 2}, {a: 5}, {a: 3}],
241
+ * P.equals,
242
+ * )([{a: 1}, {a: 2}, {a: 3}, {a: 4}]) // => [{a: 1}, {a: 4}]
243
+ * P.pipe(
244
+ * [{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}, {a: 6}], // only 4 iterations
245
+ * P.differenceWith([{a: 2}, {a: 3}], P.equals),
246
+ * P.take(2),
247
+ * ) // => [{a: 1}, {a: 4}]
248
+ * @dataLast
249
+ * @category Array
250
+ * @pipeable
251
+ */
252
+ declare function differenceWith<TFirst, TSecond>(other: ReadonlyArray<TSecond>, isEquals: IsEquals$1<TFirst, TSecond>): (array: ReadonlyArray<TFirst>) => Array<TFirst>;
253
+ declare namespace differenceWith {
254
+ function lazy<TFirst, TSecond>(other: Array<TSecond>, isEquals: IsEquals$1<TFirst, TSecond>): (value: TFirst) => LazyResult<TFirst>;
255
+ }
256
+
257
+ /**
258
+ * Excludes the values from `other` array.
259
+ * @param array the source array
260
+ * @param other the values to exclude
261
+ * @signature
262
+ * P.difference(array, other)
263
+ * @example
264
+ * P.difference([1, 2, 3, 4], [2, 5, 3]) // => [1, 4]
265
+ * @dataFirst
266
+ * @category Array
267
+ * @pipeable
268
+ */
269
+ declare function difference<T>(array: ReadonlyArray<T>, other: ReadonlyArray<T>): Array<T>;
270
+ /**
271
+ * Excludes the values from `other` array.
272
+ * @param other the values to exclude
273
+ * @signature
274
+ * P.difference(other)(array)
275
+ * @example
276
+ * P.difference([2, 5, 3])([1, 2, 3, 4]) // => [1, 4]
277
+ * P.pipe(
278
+ * [1, 2, 3, 4, 5, 6], // only 4 iterations
279
+ * P.difference([2, 3]),
280
+ * P.take(2)
281
+ * ) // => [1, 4]
282
+ * @dataLast
283
+ * @category Array
284
+ * @pipeable
285
+ */
286
+ declare function difference<T, K>(other: ReadonlyArray<T>): (array: ReadonlyArray<K>) => Array<T>;
287
+ declare namespace difference {
288
+ function lazy<T>(other: Array<T>): (value: T) => LazyResult<T>;
289
+ }
290
+
291
+ /**
292
+ * Removes last `n` elements from the `array`.
293
+ * @param array the target array
294
+ * @param n the number of elements to skip
295
+ * @signature
296
+ * P.dropLast(array, n)
297
+ * @example
298
+ * P.dropLast([1, 2, 3, 4, 5], 2) // => [1, 2, 3]
299
+ * @dataFirst
300
+ * @category Array
301
+ */
302
+ declare function dropLast<T>(array: ReadonlyArray<T>, n: number): Array<T>;
303
+ /**
304
+ * Removes last `n` elements from the `array`.
305
+ * @param array the target array
306
+ * @param n the number of elements to skip
307
+ * @signature
308
+ * P.dropLast(n)(array)
309
+ * @example
310
+ * P.dropLast(2)([1, 2, 3, 4, 5]) // => [1, 2, 3]
311
+ * @dataLast
312
+ * @category Array
313
+ */
314
+ declare function dropLast<T>(n: number): (array: ReadonlyArray<T>) => Array<T>;
315
+
316
+ /**
317
+ * Removes first `n` elements from the `array`.
318
+ * @param array the target array
319
+ * @param n the number of elements to skip
320
+ * @signature
321
+ * P.drop(array, n)
322
+ * @example
323
+ * P.drop([1, 2, 3, 4, 5], 2) // => [3, 4, 5]
324
+ * @dataFirst
325
+ * @pipeable
326
+ * @category Array
327
+ */
328
+ declare function drop<T>(array: ReadonlyArray<T>, n: number): Array<T>;
329
+ /**
330
+ * Removes first `n` elements from the `array`.
331
+ * @param array the target array
332
+ * @param n the number of elements to skip
333
+ * @signature
334
+ * P.drop(n)(array)
335
+ * @example
336
+ * P.drop(2)([1, 2, 3, 4, 5]) // => [3, 4, 5]
337
+ * @dataLast
338
+ * @pipeable
339
+ * @category Array
340
+ */
341
+ declare function drop<T>(n: number): (array: ReadonlyArray<T>) => Array<T>;
342
+ declare namespace drop {
343
+ function lazy<T>(n: number): (value: T) => LazyResult<T>;
344
+ }
345
+
346
+ /**
347
+ * Filter the elements of an array that meet the condition specified in a callback function.
348
+ * @param array The array to filter.
349
+ * @param fn the callback function.
350
+ * @signature
351
+ * P.filter(array, fn)
352
+ * P.filter.indexed(array, fn)
353
+ * @example
354
+ * P.filter([1, 2, 3], x => x % 2 === 1) // => [1, 3]
355
+ * P.filter.indexed([1, 2, 3], (x, i, array) => x % 2 === 1) // => [1, 3]
356
+ * @dataFirst
357
+ * @indexed
358
+ * @pipeable
359
+ * @category Array
360
+ */
361
+ declare function filter<T, S extends T>(array: ReadonlyArray<T>, fn: (value: T) => value is S): Array<S>;
362
+ declare function filter<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>): Array<T>;
363
+ /**
364
+ * Filter the elements of an array that meet the condition specified in a callback function.
365
+ * @param fn the callback function.
366
+ * @signature
367
+ * P.filter(fn)(array)
368
+ * P.filter.indexed(fn)(array)
369
+ * @example
370
+ * P.pipe([1, 2, 3], P.filter(x => x % 2 === 1)) // => [1, 3]
371
+ * P.pipe([1, 2, 3], P.filter.indexed((x, i) => x % 2 === 1)) // => [1, 3]
372
+ * @dataLast
373
+ * @indexed
374
+ * @pipeable
375
+ * @category Array
376
+ */
377
+ declare function filter<T, S extends T>(fn: (input: T) => input is S): (array: ReadonlyArray<T>) => Array<S>;
378
+ declare function filter<T>(fn: Pred<T, boolean>): (array: ReadonlyArray<T>) => Array<T>;
379
+ declare namespace filter {
380
+ function indexed<T, S extends T>(array: ReadonlyArray<T>, fn: (input: T, index: number, array: Array<T>) => input is S): Array<S>;
381
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): Array<T>;
382
+ /**
383
+ * @dataLast
384
+ */
385
+ function indexed<T, S extends T>(fn: (input: T, index: number, array: Array<T>) => input is S): (array: ReadonlyArray<T>) => Array<S>;
386
+ function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => Array<T>;
387
+ const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>;
388
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>) & {
389
+ indexed: true;
390
+ };
391
+ }
392
+
393
+ /**
394
+ * Returns the index of the first element in the array where predicate is true, and -1 otherwise.
395
+ * @param items the array
396
+ * @param fn the predicate
397
+ * @signature
398
+ * P.findIndex(items, fn)
399
+ * P.findIndex.indexed(items, fn)
400
+ * @example
401
+ * P.findIndex([1, 3, 4, 6], n => n % 2 === 0) // => 2
402
+ * P.findIndex.indexed([1, 3, 4, 6], (n, i) => n % 2 === 0) // => 2
403
+ * @dataFirst
404
+ * @indexed
405
+ * @pipeable
406
+ * @category Array
407
+ */
408
+ declare function findIndex<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>): number;
409
+ /**
410
+ * Returns the index of the first element in the array where predicate is true, and -1 otherwise.
411
+ * @param items the array
412
+ * @param fn the predicate
413
+ * @signature
414
+ * P.findIndex(fn)(items)
415
+ * P.findIndex.indexed(fn)(items)
416
+ * @example
417
+ * P.pipe(
418
+ * [1, 3, 4, 6],
419
+ * P.findIndex(n => n % 2 === 0)
420
+ * ) // => 2
421
+ * P.pipe(
422
+ * [1, 3, 4, 6],
423
+ * P.findIndex.indexed((n, i) => n % 2 === 0)
424
+ * ) // => 2
425
+ * @dataLast
426
+ * @indexed
427
+ * @pipeable
428
+ * @category Array
429
+ */
430
+ declare function findIndex<T>(fn: Pred<T, boolean>): (array: ReadonlyArray<T>) => number;
431
+ declare namespace findIndex {
432
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): number;
433
+ function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => number;
434
+ const lazy: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => {
435
+ done: boolean;
436
+ hasNext: boolean;
437
+ next: number;
438
+ } | {
439
+ done: boolean;
440
+ hasNext: boolean;
441
+ next?: undefined;
442
+ }) & {
443
+ single: true;
444
+ };
445
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => {
446
+ done: boolean;
447
+ hasNext: boolean;
448
+ next: number;
449
+ } | {
450
+ done: boolean;
451
+ hasNext: boolean;
452
+ next?: undefined;
453
+ }) & {
454
+ indexed: true;
455
+ } & {
456
+ single: true;
457
+ };
458
+ }
459
+
460
+ /**
461
+ * Returns the index of the last element in the array where predicate is true, and -1 otherwise.
462
+ * @param array the array
463
+ * @param fn the predicate
464
+ * @signature
465
+ * P.findLastIndex(items, fn)
466
+ * P.findLastIndex.indexed(items, fn)
467
+ * @example
468
+ * P.findLastIndex([1, 3, 4, 6], n => n % 2 === 1) // => 1
469
+ * P.findLastIndex.indexed([1, 3, 4, 6], (n, i) => n % 2 === 1) // => 1
470
+ * @dataFirst
471
+ * @indexed
472
+ * @pipeable
473
+ * @category Array
474
+ */
475
+ declare function findLastIndex<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>): number;
476
+ /**
477
+ * Returns the index of the last element in the array where predicate is true, and -1 otherwise.
478
+ * @param array the array
479
+ * @param fn the predicate
480
+ * @signature
481
+ * P.findLastIndex(fn)(items)
482
+ * P.findLastIndex.indexed(fn)(items)
483
+ * @example
484
+ * P.pipe(
485
+ * [1, 3, 4, 6],
486
+ * P.findLastIndex(n => n % 2 === 1)
487
+ * ) // => 1
488
+ * P.pipe(
489
+ * [1, 3, 4, 6],
490
+ * P.findLastIndex.indexed((n, i) => n % 2 === 1)
491
+ * ) // => 1
492
+ * @dataLast
493
+ * @indexed
494
+ * @pipeable
495
+ * @category Array
496
+ */
497
+ declare function findLastIndex<T>(fn: Pred<T, boolean>): (array: ReadonlyArray<T>) => number;
498
+ declare namespace findLastIndex {
499
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): number;
500
+ function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => number;
501
+ }
502
+
503
+ /**
504
+ * Returns the value of the last element in the array where predicate is true, and undefined
505
+ * otherwise.
506
+ * @param array the array
507
+ * @param fn the predicate
508
+ * @signature
509
+ * P.findLast(items, fn)
510
+ * P.findLast.indexed(items, fn)
511
+ * @example
512
+ * P.findLast([1, 3, 4, 6], n => n % 2 === 1) // => 3
513
+ * P.findLast.indexed([1, 3, 4, 6], (n, i) => n % 2 === 1) // => 3
514
+ * @dataFirst
515
+ * @indexed
516
+ * @pipeable
517
+ * @category Array
518
+ */
519
+ declare function findLast<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>): T | undefined;
520
+ /**
521
+ * Returns the value of the last element in the array where predicate is true, and undefined
522
+ * otherwise.
523
+ * @param fn the predicate
524
+ * @signature
525
+ * P.findLast(fn)(items)
526
+ * P.findLast.indexed(fn)(items)
527
+ * @example
528
+ * P.pipe(
529
+ * [1, 3, 4, 6],
530
+ * P.findLast(n => n % 2 === 1)
531
+ * ) // => 3
532
+ * P.pipe(
533
+ * [1, 3, 4, 6],
534
+ * P.findLast.indexed((n, i) => n % 2 === 1)
535
+ * ) // => 3
536
+ * @dataLast
537
+ * @indexed
538
+ * @pipeable
539
+ * @category Array
540
+ */
541
+ declare function findLast<T = never>(fn: Pred<T, boolean>): (array: ReadonlyArray<T>) => T | undefined;
542
+ declare namespace findLast {
543
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): T | undefined;
544
+ function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => T | undefined;
545
+ }
546
+
547
+ /**
548
+ * Returns the value of the first element in the array where predicate is true, and undefined otherwise.
549
+ * @param items the array
550
+ * @param fn the predicate
551
+ * @signature
552
+ * P.find(items, fn)
553
+ * P.find.indexed(items, fn)
554
+ * @example
555
+ * P.find([1, 3, 4, 6], n => n % 2 === 0) // => 4
556
+ * P.find.indexed([1, 3, 4, 6], (n, i) => n % 2 === 0) // => 4
557
+ * @dataFirst
558
+ * @indexed
559
+ * @pipeable
560
+ * @category Array
561
+ */
562
+ declare function find<T>(array: ReadonlyArray<T>, fn: Pred<T, boolean>): T | undefined;
563
+ /**
564
+ * Returns the value of the first element in the array where predicate is true, and undefined otherwise.
565
+ * @param fn the predicate
566
+ * @signature
567
+ * P.find(fn)(items)
568
+ * P.find.indexed(fn)(items)
569
+ * @example
570
+ * P.pipe(
571
+ * [1, 3, 4, 6],
572
+ * P.find(n => n % 2 === 0)
573
+ * ) // => 4
574
+ * P.pipe(
575
+ * [1, 3, 4, 6],
576
+ * P.find.indexed((n, i) => n % 2 === 0)
577
+ * ) // => 4
578
+ * @dataLast
579
+ * @indexed
580
+ * @pipeable
581
+ * @category Array
582
+ */
583
+ declare function find<T = never>(fn: Pred<T, boolean>): (array: ReadonlyArray<T>) => T | undefined;
584
+ declare namespace find {
585
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): T | undefined;
586
+ function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => T | undefined;
587
+ const lazy: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => {
588
+ done: boolean;
589
+ hasNext: boolean;
590
+ next: T;
591
+ }) & {
592
+ single: true;
593
+ };
594
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => {
595
+ done: boolean;
596
+ hasNext: boolean;
597
+ next: T;
598
+ }) & {
599
+ indexed: true;
600
+ } & {
601
+ single: true;
602
+ };
603
+ }
604
+
605
+ type FirstOut<T extends IterableContainer> = T extends [] ? undefined : T extends readonly [unknown, ...Array<unknown>] ? T[0] : T extends readonly [...infer Pre, infer Last] ? Pre[0] | Last : T[0] | undefined;
606
+ /**
607
+ * Gets the first element of `array`.
608
+ * Note: In `pipe`, use `first()` form instead of `first`. Otherwise, the inferred type is lost.
609
+ * @param array the array
610
+ * @signature
611
+ * P.first(array)
612
+ * @example
613
+ * P.first([1, 2, 3]) // => 1
614
+ * P.first([]) // => undefined
615
+ * P.pipe(
616
+ * [1, 2, 4, 8, 16],
617
+ * P.filter(x => x > 3),
618
+ * P.first(),
619
+ * x => x + 1
620
+ * ); // => 5
621
+ *
622
+ * @category array
623
+ * @pipeable
624
+ */
625
+ declare function first<T extends IterableContainer>(array: Readonly<T>): FirstOut<T>;
626
+ declare function first<T extends IterableContainer>(): (array: Readonly<T>) => FirstOut<T>;
627
+ declare namespace first {
628
+ function lazy<T>(): (value: T) => {
629
+ done: boolean;
630
+ hasNext: boolean;
631
+ next: T;
632
+ };
633
+ namespace lazy {
634
+ const single = true;
635
+ }
636
+ }
637
+
638
+ /**
639
+ * Map each element of an array into an object using a defined callback function and flatten the result.
640
+ * @param array The array to map.
641
+ * @param fn The mapping function, which should return an Array of key-value pairs, similar to Object.fromEntries
642
+ * @returns The new mapped object.
643
+ * @signature
644
+ * P.flatMapToObj(array, fn)
645
+ * P.flatMapToObj.indexed(array, fn)
646
+ * @example
647
+ * P.flatMapToObj([1, 2, 3], (x) =>
648
+ * x % 2 === 1 ? [[String(x), x]] : []
649
+ * ) // => {1: 1, 3: 3}
650
+ * P.flatMapToObj.indexed(['a', 'b'], (x, i) => [
651
+ * [x, i],
652
+ * [x + x, i + i],
653
+ * ]) // => {a: 0, aa: 0, b: 1, bb: 2}
654
+ * @dataFirst
655
+ * @indexed
656
+ * @category Array
657
+ */
658
+ declare function flatMapToObj<T, K extends keyof any, V>(array: ReadonlyArray<T>, fn: (element: T) => Array<[K, V]>): Record<K, V>;
659
+ /**
660
+ * Map each element of an array into an object using a defined callback function and flatten the result.
661
+ * @param fn The mapping function, which should return an Array of key-value pairs, similar to Object.fromEntries
662
+ * @returns The new mapped object.
663
+ * @signature
664
+ * P.flatMapToObj(fn)(array)
665
+ * P.flatMapToObj(fn)(array)
666
+ * @example
667
+ * P.pipe(
668
+ * [1, 2, 3],
669
+ * P.flatMapToObj(x => (x % 2 === 1 ? [[String(x), x]] : []))
670
+ * ) // => {1: 1, 3: 3}
671
+ * P.pipe(
672
+ * ['a', 'b'],
673
+ * P.flatMapToObj.indexed((x, i) => [
674
+ * [x, i],
675
+ * [x + x, i + i],
676
+ * ])
677
+ * ) // => {a: 0, aa: 0, b: 1, bb: 2}
678
+ * @dataLast
679
+ * @indexed
680
+ * @category Array
681
+ */
682
+ declare function flatMapToObj<T, K extends keyof any, V>(fn: (element: T) => Array<[K, V]>): (array: ReadonlyArray<T>) => Record<K, V>;
683
+ declare namespace flatMapToObj {
684
+ function indexed<T, K extends keyof any, V>(array: ReadonlyArray<T>, fn: (element: T, index: number, array: ReadonlyArray<T>) => Array<[K, V]>): Record<K, V>;
685
+ function indexed<T, K extends keyof any, V>(fn: (element: T, index: number, array: ReadonlyArray<T>) => Array<[K, V]>): (array: ReadonlyArray<T>) => Record<K, V>;
686
+ }
687
+
688
+ /**
689
+ * Map each element of an array using a defined callback function and flatten the mapped result.
690
+ * @param array The array to map.
691
+ * @param fn The function mapper.
692
+ * @signature
693
+ * P.flatMap(array, fn)
694
+ * @example
695
+ * P.flatMap([1, 2, 3], x => [x, x * 10]) // => [1, 10, 2, 20, 3, 30]
696
+ * @dataFirst
697
+ * @pipeable
698
+ * @category Array
699
+ */
700
+ declare function flatMap<T, K>(array: ReadonlyArray<T>, fn: (input: T) => K | Array<K>): Array<K>;
701
+ /**
702
+ * Map each element of an array using a defined callback function and flatten the mapped result.
703
+ * @param array The array to map.
704
+ * @param fn The function mapper.
705
+ * @signature
706
+ * P.flatMap(fn)(array)
707
+ * @example
708
+ * P.pipe([1, 2, 3], P.flatMap(x => [x, x * 10])) // => [1, 10, 2, 20, 3, 30]
709
+ * @dataLast
710
+ * @pipeable
711
+ * @category Array
712
+ */
713
+ declare function flatMap<T, K>(fn: (input: T) => K | Array<K>): (array: ReadonlyArray<T>) => Array<K>;
714
+ declare namespace flatMap {
715
+ function lazy<T, K>(fn: (input: T) => K | Array<K>): (value: T) => {
716
+ done: boolean;
717
+ hasNext: boolean;
718
+ hasMany: boolean;
719
+ next: K[];
720
+ } | {
721
+ done: boolean;
722
+ hasNext: boolean;
723
+ next: K;
724
+ hasMany?: undefined;
725
+ };
726
+ }
727
+
728
+ type FlattenDeep<T> = T extends ReadonlyArray<infer K> ? FlattenDeep2<K> : T;
729
+ type FlattenDeep2<T> = T extends ReadonlyArray<infer K> ? FlattenDeep3<K> : T;
730
+ type FlattenDeep3<T> = T extends ReadonlyArray<infer K> ? FlattenDeep4<K> : T;
731
+ type FlattenDeep4<T> = T extends ReadonlyArray<infer K> ? K : T;
732
+ /**
733
+ * Recursively flattens `array`.
734
+ * Note: In `pipe`, use `flattenDeep()` form instead of `flattenDeep`. Otherwise, the inferred type is lost.
735
+ * @param items the target array
736
+ * @signature P.flattenDeep(array)
737
+ * @example
738
+ * P.flattenDeep([[1, 2], [[3], [4, 5]]]) // => [1, 2, 3, 4, 5]
739
+ * P.pipe(
740
+ * [[1, 2], [[3], [4, 5]]],
741
+ * P.flattenDeep(),
742
+ * ); // => [1, 2, 3, 4, 5]
743
+ * @category Array
744
+ * @pipeable
745
+ */
746
+ declare function flattenDeep<T>(items: ReadonlyArray<T>): Array<FlattenDeep<T>>;
747
+ declare function flattenDeep<T>(): (items: ReadonlyArray<T>) => Array<FlattenDeep<T>>;
748
+ declare namespace flattenDeep {
749
+ function lazy(): (value: any) => LazyResult<any>;
750
+ }
751
+
752
+ type Flatten<T> = T extends ReadonlyArray<infer K> ? K : T;
753
+ /**
754
+ * Flattens `array` a single level deep.
755
+ * Note: In `pipe`, use `flatten()` form instead of `flatten`. Otherwise, the inferred type is lost.
756
+
757
+ * @param items the target array
758
+ * @signature P.flatten(array)
759
+ * @example
760
+ * P.flatten([[1, 2], [3], [4, 5]]) // => [1, 2, 3, 4, 5]
761
+ * P.pipe(
762
+ * [[1, 2], [3], [4, 5]],
763
+ * P.flatten(),
764
+ * ); // => [1, 2, 3, 4, 5]
765
+ * @category Array
766
+ * @pipeable
767
+ */
768
+ declare function flatten<T>(items: ReadonlyArray<T>): Array<Flatten<T>>;
769
+ declare function flatten<T>(): (items: ReadonlyArray<T>) => Array<Flatten<T>>;
770
+ declare namespace flatten {
771
+ function lazy<T>(): (next: T) => LazyResult<any>;
772
+ }
773
+
774
+ /**
775
+ * Iterate an array using a defined callback function. The original array is returned instead of `void`.
776
+ * @param array The array.
777
+ * @param fn The callback function.
778
+ * @returns The original array
779
+ * @signature
780
+ * P.forEach(array, fn)
781
+ * P.forEach.indexed(array, fn)
782
+ * @example
783
+ * P.forEach([1, 2, 3], x => {
784
+ * console.log(x)
785
+ * }) // => [1, 2, 3]
786
+ * P.forEach.indexed([1, 2, 3], (x, i) => {
787
+ * console.log(x, i)
788
+ * }) // => [1, 2, 3]
789
+ * @dataFirst
790
+ * @indexed
791
+ * @pipeable
792
+ * @category Array
793
+ */
794
+ declare function forEach<T>(array: ReadonlyArray<T>, fn: Pred<T, void>): Array<T>;
795
+ /**
796
+ * Iterate an array using a defined callback function. The original array is returned instead of `void`.
797
+ * @param fn the function mapper
798
+ * @signature
799
+ * P.forEach(fn)(array)
800
+ * P.forEach.indexed(fn)(array)
801
+ * @example
802
+ * P.pipe(
803
+ * [1, 2, 3],
804
+ * P.forEach(x => {
805
+ * console.log(x)
806
+ * })
807
+ * ) // => [1, 2, 3]
808
+ * P.pipe(
809
+ * [1, 2, 3],
810
+ * P.forEach.indexed((x, i) => {
811
+ * console.log(x, i)
812
+ * })
813
+ * ) // => [1, 2, 3]
814
+ * @dataLast
815
+ * @indexed
816
+ * @pipeable
817
+ * @category Array
818
+ */
819
+ declare function forEach<T>(fn: Pred<T, void>): (array: ReadonlyArray<T>) => Array<T>;
820
+ declare namespace forEach {
821
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, void>): Array<T>;
822
+ function indexed<T>(fn: PredIndexed<T, void>): (array: ReadonlyArray<T>) => Array<T>;
823
+ const lazy: <T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>;
824
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>) & {
825
+ indexed: true;
826
+ };
827
+ }
828
+
829
+ interface Strict$5 {
830
+ <Value, Key extends PropertyKey = PropertyKey>(items: ReadonlyArray<Value>, fn: (item: Value) => Key | undefined): StrictOut$2<Value, Key>;
831
+ <Value, Key extends PropertyKey = PropertyKey>(fn: (item: Value) => Key | undefined): (items: ReadonlyArray<Value>) => StrictOut$2<Value, Key>;
832
+ readonly indexed: {
833
+ <Value, Key extends PropertyKey = PropertyKey>(items: ReadonlyArray<Value>, fn: PredIndexed<Value, Key | undefined>): StrictOut$2<Value, Key>;
834
+ <Value, Key extends PropertyKey = PropertyKey>(fn: PredIndexed<Value, Key | undefined>): (items: ReadonlyArray<Value>) => StrictOut$2<Value, Key>;
835
+ };
836
+ }
837
+ type StrictOut$2<Value, Key extends PropertyKey = PropertyKey> = string extends Key ? Record<Key, NonEmptyArray<Value>> : number extends Key ? Record<Key, NonEmptyArray<Value>> : symbol extends Key ? Record<Key, NonEmptyArray<Value>> : Partial<Record<Key, NonEmptyArray<Value>>>;
838
+ /**
839
+ * Splits a collection into sets, grouped by the result of running each value through `fn`.
840
+ * @param items the items to group
841
+ * @param fn the grouping function. When `undefined` is returned the item would
842
+ * be skipped and not grouped under any key.
843
+ * @signature
844
+ * P.groupBy(array, fn)
845
+ * P.groupBy.strict(array, fn)
846
+ * @example
847
+ * P.groupBy(['one', 'two', 'three'], x => x.length) // => {3: ['one', 'two'], 5: ['three']}
848
+ * P.groupBy.strict([{a: 'cat'}, {a: 'dog'}] as const, prop('a')) // => {cat: [{a: 'cat'}], dog: [{a: 'dog'}]} typed Partial<Record<'cat' | 'dog', NonEmptyArray<{a: 'cat' | 'dog'}>>>
849
+ * P.groupBy([0, 1], x => x % 2 === 0 ? 'even' : undefined) // => {even: [0]}
850
+ * @dataFirst
851
+ * @indexed
852
+ * @strict
853
+ * @category Array
854
+ */
855
+ declare function groupBy<T>(items: ReadonlyArray<T>, fn: (item: T) => PropertyKey | undefined): Record<PropertyKey, NonEmptyArray<T>>;
856
+ declare function groupBy<T>(fn: (item: T) => PropertyKey | undefined): (array: ReadonlyArray<T>) => Record<PropertyKey, NonEmptyArray<T>>;
857
+ declare namespace groupBy {
858
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, PropertyKey | undefined>): Record<string, NonEmptyArray<T>>;
859
+ function indexed<T>(fn: PredIndexed<T, PropertyKey | undefined>): (array: ReadonlyArray<T>) => Record<string, NonEmptyArray<T>>;
860
+ const strict: Strict$5;
861
+ }
862
+
863
+ /**
864
+ * Converts a list of objects into an object indexing the objects by the given key.
865
+ * @param array the array
866
+ * @param fn the indexing function
867
+ * @signature
868
+ * P.indexBy(array, fn)
869
+ * @example
870
+ * P.indexBy(['one', 'two', 'three'], x => x.length) // => {3: 'two', 5: 'three'}
871
+ * @dataFirst
872
+ * @indexed
873
+ * @category Array
874
+ */
875
+ declare function indexBy<T>(array: ReadonlyArray<T>, fn: (item: T) => any): Record<string, T>;
876
+ /**
877
+ * Converts a list of objects into an object indexing the objects by the given key.
878
+ * @param array the array
879
+ * @param fn the indexing function
880
+ * @signature
881
+ * P.indexBy(fn)(array)
882
+ * @example
883
+ * P.pipe(
884
+ * ['one', 'two', 'three'],
885
+ * P.indexBy(x => x.length)
886
+ * ) // => {3: 'two', 5: 'three'}
887
+ * @dataLast
888
+ * @indexed
889
+ * @category Array
890
+ */
891
+ declare function indexBy<T>(fn: (item: T) => any): (array: ReadonlyArray<T>) => Record<string, T>;
892
+ declare namespace indexBy {
893
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, any>): Record<string, T>;
894
+ function indexed<T>(fn: PredIndexed<T, any>): (array: ReadonlyArray<T>) => Record<string, T>;
895
+ }
896
+
897
+ /**
898
+ * Returns a list of elements that exist in both array.
899
+ * @param array the source array
900
+ * @param other the second array
901
+ * @signature
902
+ * P.intersection(array, other)
903
+ * @example
904
+ * P.intersection([1, 2, 3], [2, 3, 5]) // => [2, 3]
905
+ * @dataFirst
906
+ * @category Array
907
+ * @pipeable
908
+ */
909
+ declare function intersection<T>(source: ReadonlyArray<T>, other: ReadonlyArray<T>): Array<T>;
910
+ /**
911
+ * Returns a list of elements that exist in both array.
912
+ * @param array the source array
913
+ * @param other the second array
914
+ * @signature
915
+ * P.intersection(other)(array)
916
+ * @example
917
+ * P.intersection([2, 3, 5])([1, 2, 3]) // => [2, 3]
918
+ * @dataLast
919
+ * @category Array
920
+ * @pipeable
921
+ */
922
+ declare function intersection<T, K>(other: ReadonlyArray<T>): (source: ReadonlyArray<K>) => Array<T>;
923
+ declare namespace intersection {
924
+ function lazy<T>(other: Array<T>): (value: T) => LazyResult<T>;
925
+ }
926
+
927
+ type Comparator<TFirst, TSecond> = (a: TFirst, b: TSecond) => boolean;
928
+ /**
929
+ * Returns a list of intersecting values based on a custom
930
+ * comparator function that compares elements of both arrays.
931
+ * @param array the source array
932
+ * @param other the second array
933
+ * @param comparator the custom comparator
934
+ * @signature
935
+ * P.intersectionWith(array, other, comparator)
936
+ * @example
937
+ * P.intersectionWith(
938
+ * [
939
+ * { id: 1, name: 'Ryan' },
940
+ * { id: 3, name: 'Emma' },
941
+ * ],
942
+ * [3, 5],
943
+ * (a, b) => a.id === b,
944
+ * ) // => [{ id: 3, name: 'Emma' }]
945
+ * @dataFirst
946
+ * @category Array
947
+ * @pipeable
948
+ */
949
+ declare function intersectionWith<TFirst, TSecond>(array: ReadonlyArray<TFirst>, other: ReadonlyArray<TSecond>, comparator: Comparator<TFirst, TSecond>): Array<TFirst>;
950
+ /**
951
+ * Returns a list of intersecting values based on a custom
952
+ * comparator function that compares elements of both arrays.
953
+ * @param other the second array
954
+ * @param comparator the custom comparator
955
+ * @signature
956
+ * P.intersectionWith(other, comparator)(array)
957
+ * @example
958
+ * P.intersectionWith(
959
+ * [3, 5],
960
+ * (a, b) => a.id === b
961
+ * )([
962
+ * { id: 1, name: 'Ryan' },
963
+ * { id: 3, name: 'Emma' },
964
+ * ]); // => [{ id: 3, name: 'Emma' }]
965
+ * @dataLast
966
+ * @category Array
967
+ * @pipeable
968
+ */
969
+ declare function intersectionWith<TFirst, TSecond>(other: ReadonlyArray<TSecond>,
970
+ /**
971
+ * type inference doesn't work properly for the comparator's first parameter
972
+ * in data last variant
973
+ */
974
+ comparator: Comparator<TFirst, TSecond>): (array: ReadonlyArray<TFirst>) => Array<TFirst>;
975
+ declare namespace intersectionWith {
976
+ function lazy<TFirst, TSecond>(other: Array<TSecond>, comparator: Comparator<TFirst, TSecond>): (value: TFirst) => LazyResult<TFirst>;
977
+ }
978
+
979
+ type Joinable = bigint | boolean | number | string | null | undefined;
980
+ type Joined<T extends IterableContainer, Glue extends string> = T[number] extends never ? '' : T extends readonly [Joinable?] ? `${NullishCoalesce<T[0], ''>}` : T extends readonly [infer First, ...infer Tail] ? `${NullishCoalesce<First, ''>}${Glue}${Joined<Tail, Glue>}` : T extends readonly [...infer Head, infer Last] ? `${Joined<Head, Glue>}${Glue}${NullishCoalesce<Last, ''>}` : string;
981
+ type NullishCoalesce<T, Fallback> = T extends Joinable ? T extends undefined | null ? NonNullable<T> | Fallback : T : never;
982
+ /**
983
+ * Joins the elements of the array by: casting them to a string and
984
+ * concatenating them one to the other, with the provided glue string in between
985
+ * every two elements.
986
+ *
987
+ * When called on a tuple and with stricter item types (union of literal values,
988
+ * the result is strictly typed to the tuples shape and it's item types).
989
+ *
990
+ * @param data The array to join
991
+ * @param glue The string to put in between every two elements
992
+ * @signature
993
+ * P.join(data, glue)
994
+ * @example
995
+ * P.join([1,2,3], ",") // => "1,2,3" (typed `string`)
996
+ * P.join(['a','b','c'], "") // => "abc" (typed `string`)
997
+ * P.join(['hello', 'world'] as const, " ") // => "hello world" (typed `hello world`)
998
+ * @dataFirst
999
+ * @category Array
1000
+ */
1001
+ declare function join<T extends ReadonlyArray<Joinable> | [], Glue extends string>(data: T, glue: Glue): Joined<T, Glue>;
1002
+ /**
1003
+ * Joins the elements of the array by: casting them to a string and
1004
+ * concatenating them one to the other, with the provided glue string in between
1005
+ * every two elements.
1006
+ *
1007
+ * When called on a tuple and with stricter item types (union of literal values,
1008
+ * the result is strictly typed to the tuples shape and it's item types).
1009
+ *
1010
+ * @param data The array to join
1011
+ * @param glue The string to put in between every two elements
1012
+ * @signature
1013
+ * P.join(glue)(data)
1014
+ * @example
1015
+ * P.pipe([1,2,3], P.join(",")) // => "1,2,3" (typed `string`)
1016
+ * P.pipe(['a','b','c'], P.join("")) // => "abc" (typed `string`)
1017
+ * P.pipe(['hello', 'world'] as const, P.join(" ")) // => "hello world" (typed `hello world`)
1018
+ * @dataLast
1019
+ * @category Array
1020
+ */
1021
+ declare function join<T extends ReadonlyArray<Joinable> | [], Glue extends string>(glue: Glue): (data: T) => Joined<T, Glue>;
1022
+
1023
+ /**
1024
+ * Gets the last element of `array`.
1025
+ * Note: In `pipe`, use `last()` form instead of `last`. Otherwise, the inferred type is lost.
1026
+ * @param array the array
1027
+ * @signature
1028
+ * P.last(array)
1029
+ * @example
1030
+ * P.last([1, 2, 3]) // => 3
1031
+ * P.last([]) // => undefined
1032
+ * P.pipe(
1033
+ * [1, 2, 4, 8, 16],
1034
+ * P.filter(x => x > 3),
1035
+ * P.last(),
1036
+ * x => x + 1
1037
+ * ); // => 17
1038
+ *
1039
+ * @category Array
1040
+ * @pipeable
1041
+ */
1042
+ declare function last<T>(array: NonEmptyArray<T>): T;
1043
+ declare function last<T>(array: ReadonlyArray<T>): T | undefined;
1044
+ declare function last<T>(): (array: ReadonlyArray<T>) => T | undefined;
1045
+
1046
+ type Enumerable<T> = ArrayLike<T> | Iterable<T>;
1047
+ /**
1048
+ * Counts values of the collection or iterable.
1049
+ * @param items The input data.
1050
+ * @signature
1051
+ * P.length(array)
1052
+ * @example
1053
+ * P.length([1, 2, 3]) // => 3
1054
+ * @category Array
1055
+ */
1056
+ declare function length<T>(items: Enumerable<T>): number;
1057
+ declare function length<T>(): (items: Enumerable<T>) => number;
1058
+
1059
+ interface Strict$4 {
1060
+ <T extends IterableContainer, K>(items: T, mapper: Pred<T[number], K>): StrictOut$1<T, K>;
1061
+ <T extends IterableContainer, K>(mapper: Pred<T[number], K>): (items: T) => StrictOut$1<T, K>;
1062
+ readonly indexed: {
1063
+ <T extends IterableContainer, K>(items: T, mapper: PredIndexed<T[number], K>): StrictOut$1<T, K>;
1064
+ <T extends IterableContainer, K>(mapper: PredIndexed<T[number], K>): (items: T) => StrictOut$1<T, K>;
1065
+ };
1066
+ }
1067
+ type StrictOut$1<T extends IterableContainer, K> = {
1068
+ -readonly [P in keyof T]: K;
1069
+ };
1070
+ /**
1071
+ * Map each element of an array using a defined callback function. If the input
1072
+ * array is a tuple use the `strict` variant to maintain it's shape.
1073
+ * @param array The array to map.
1074
+ * @param fn The function mapper.
1075
+ * @returns The new mapped array.
1076
+ * @signature
1077
+ * P.map(array, fn)
1078
+ * P.map.indexed(array, fn)
1079
+ * P.map.strict(array, fn)
1080
+ * P.map.strict.indexed(array, fn)
1081
+ * @example
1082
+ * P.map([1, 2, 3], x => x * 2) // => [2, 4, 6], typed number[]
1083
+ * P.map.indexed([0, 0, 0], (x, i) => i) // => [0, 1, 2], typed number[]
1084
+ * P.map.strict([0, 0] as const, x => x + 1) // => [1, 1], typed [number, number]
1085
+ * P.map.strict.indexed([0, 0] as const, (x, i) => x + i) // => [0, 1], typed [number, number]
1086
+ * @dataFirst
1087
+ * @indexed
1088
+ * @pipeable
1089
+ * @strict
1090
+ * @category Array
1091
+ */
1092
+ declare function map<T, K>(array: ReadonlyArray<T>, fn: Pred<T, K>): Array<K>;
1093
+ /**
1094
+ * Map each value of an object using a defined callback function.
1095
+ * @param fn the function mapper
1096
+ * @signature
1097
+ * P.map(fn)(array)
1098
+ * P.map.indexed(fn)(array)
1099
+ * @example
1100
+ * P.pipe([0, 1, 2], P.map(x => x * 2)) // => [0, 2, 4]
1101
+ * P.pipe([0, 0, 0], P.map.indexed((x, i) => i)) // => [0, 1, 2]
1102
+ * @dataLast
1103
+ * @indexed
1104
+ * @pipeable
1105
+ * @category Array
1106
+ */
1107
+ declare function map<T, K>(fn: Pred<T, K>): (array: ReadonlyArray<T>) => Array<K>;
1108
+ declare namespace map {
1109
+ function indexed<T, K>(array: ReadonlyArray<T>, fn: PredIndexed<T, K>): Array<K>;
1110
+ function indexed<T, K>(fn: PredIndexed<T, K>): (array: ReadonlyArray<T>) => Array<K>;
1111
+ const lazy: <T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<K>;
1112
+ const lazyIndexed: (<T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<K>) & {
1113
+ indexed: true;
1114
+ };
1115
+ const strict: Strict$4;
1116
+ }
1117
+
1118
+ /**
1119
+ * Map each element of an array into an object using a defined callback function.
1120
+ * @param array The array to map.
1121
+ * @param fn The mapping function, which should return a tuple of [key, value], similar to Object.fromEntries
1122
+ * @returns The new mapped object.
1123
+ * @signature
1124
+ * P.mapToObj(array, fn)
1125
+ * P.mapToObj.indexed(array, fn)
1126
+ * @example
1127
+ * P.mapToObj([1, 2, 3], x => [String(x), x * 2]) // => {1: 2, 2: 4, 3: 6}
1128
+ * P.mapToObj.indexed([0, 0, 0], (x, i) => [i, i]) // => {0: 0, 1: 1, 2: 2}
1129
+ * @dataFirst
1130
+ * @indexed
1131
+ * @category Array
1132
+ */
1133
+ declare function mapToObj<T, K extends keyof any, V>(array: ReadonlyArray<T>, fn: (element: T) => [K, V]): Record<K, V>;
1134
+ /**
1135
+ * Map each element of an array into an object using a defined callback function.
1136
+ * @param fn The mapping function, which should return a tuple of [key, value], similar to Object.fromEntries
1137
+ * @returns The new mapped object.
1138
+ * @signature
1139
+ * P.mapToObj(fn)(array)
1140
+ * P.mapToObj.indexed(fn)(array)
1141
+ * @example
1142
+ * P.pipe(
1143
+ * [1, 2, 3],
1144
+ * P.mapToObj(x => [String(x), x * 2])
1145
+ * ) // => {1: 2, 2: 4, 3: 6}
1146
+ * P.pipe(
1147
+ * [0, 0, 0],
1148
+ * P.mapToObj.indexed((x, i) => [i, i])
1149
+ * ) // => {0: 0, 1: 1, 2: 2}
1150
+ * @dataLast
1151
+ * @indexed
1152
+ * @category Array
1153
+ */
1154
+ declare function mapToObj<T, K extends keyof any, V>(fn: (element: T) => [K, V]): (array: ReadonlyArray<T>) => Record<K, V>;
1155
+ declare namespace mapToObj {
1156
+ function indexed<T, K extends keyof any, V>(array: ReadonlyArray<T>, fn: (element: T, index: number, array: ReadonlyArray<T>) => [K, V]): Record<K, V>;
1157
+ function indexed<T, K extends keyof any, V>(fn: (element: T, index: number, array: ReadonlyArray<T>) => [K, V]): (array: ReadonlyArray<T>) => Record<K, V>;
1158
+ }
1159
+
1160
+ /**
1161
+ * Returns the max element using the provided predicate.
1162
+ * @param fn the predicate
1163
+ * @signature
1164
+ * P.maxBy(fn)(array)
1165
+ * P.maxBy.indexed(fn)(array)
1166
+ * @example
1167
+ * P.pipe(
1168
+ * [{a: 5}, {a: 1}, {a: 3}],
1169
+ * P.maxBy(x => x.a)
1170
+ * ) // { a: 5 }
1171
+ * @dataLast
1172
+ * @indexed
1173
+ * @category Array
1174
+ */
1175
+ declare function maxBy<T>(fn: (item: T) => number): (items: ReadonlyArray<T>) => T | undefined;
1176
+ /**
1177
+ * Returns the max element using the provided predicate.
1178
+ * @param items the array
1179
+ * @param fn the predicate
1180
+ * @signature
1181
+ * P.maxBy(array, fn)
1182
+ * P.maxBy.indexed(array, fn)
1183
+ * @example
1184
+ * P.maxBy(
1185
+ * [{a: 5}, {a: 1}, {a: 3}],
1186
+ * x => x.a
1187
+ * ) // { a: 5 }
1188
+ * @dataFirst
1189
+ * @indexed
1190
+ * @category Array
1191
+ */
1192
+ declare function maxBy<T>(items: ReadonlyArray<T>, fn: (item: T) => number): T | undefined;
1193
+ declare namespace maxBy {
1194
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, number>): T | undefined;
1195
+ function indexed<T>(fn: PredIndexed<T, number>): (array: ReadonlyArray<T>) => T | undefined;
1196
+ }
1197
+
1198
+ /**
1199
+ * Returns the mean of the elements of an array using the provided predicate.
1200
+ * @param fn predicate function
1201
+ * @signature
1202
+ * P.meanBy(fn)(array)
1203
+ * P.meanBy.indexed(fn)(array)
1204
+ * @example
1205
+ * P.pipe(
1206
+ * [{a: 5}, {a: 1}, {a: 3}],
1207
+ * P.meanBy(x => x.a)
1208
+ * ) // 3
1209
+ * @dataLast
1210
+ * @indexed
1211
+ * @category Array
1212
+ */
1213
+ declare function meanBy<T>(fn: (item: T) => number): (items: ReadonlyArray<T>) => number;
1214
+ /**
1215
+ * Returns the mean of the elements of an array using the provided predicate.
1216
+ * @param items the array
1217
+ * @param fn predicate function
1218
+ * @signature
1219
+ * P.meanBy(array, fn)
1220
+ * P.meanBy.indexed(array, fn)
1221
+ * @example
1222
+ * P.meanBy(
1223
+ * [{a: 5}, {a: 1}, {a: 3}],
1224
+ * x => x.a
1225
+ * ) // 3
1226
+ * @dataFirst
1227
+ * @indexed
1228
+ * @category Array
1229
+ */
1230
+ declare function meanBy<T>(items: ReadonlyArray<T>, fn: (item: T) => number): number;
1231
+ declare namespace meanBy {
1232
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, number>): number;
1233
+ function indexed<T>(fn: PredIndexed<T, number>): (array: ReadonlyArray<T>) => number;
1234
+ }
1235
+
1236
+ /**
1237
+ * Merges a list of objects into a single object.
1238
+ * @param array the array of objects
1239
+ * @signature
1240
+ * P.mergeAll(objects)
1241
+ * @example
1242
+ * P.mergeAll([{ a: 1, b: 1 }, { b: 2, c: 3 }, { d: 10 }]) // => { a: 1, b: 2, c: 3, d: 10 }
1243
+ * @category Array
1244
+ */
1245
+ declare function mergeAll<A>(array: readonly [A]): A;
1246
+ declare function mergeAll<A, B>(array: readonly [A, B]): A & B;
1247
+ declare function mergeAll<A, B, C>(array: readonly [A, B, C]): A & B & C;
1248
+ declare function mergeAll<A, B, C, D>(array: readonly [A, B, C, D]): A & B & C & D;
1249
+ declare function mergeAll<A, B, C, D, E>(array: [A, B, C, D, E]): A & B & C & D & E;
1250
+ declare function mergeAll(array: ReadonlyArray<object>): object;
1251
+
1252
+ /**
1253
+ * Returns the min element using the provided predicate.
1254
+ * @param fn the predicate
1255
+ * @signature
1256
+ * P.minBy(fn)(array)
1257
+ * P.minBy.indexed(fn)(array)
1258
+ * @example
1259
+ * P.pipe(
1260
+ * [{a: 5}, {a: 1}, {a: 3}],
1261
+ * P.minBy(x => x.a)
1262
+ * ) // { a: 1 }
1263
+ * @dataLast
1264
+ * @indexed
1265
+ * @category Array
1266
+ */
1267
+ declare function minBy<T>(fn: (item: T) => number): (items: ReadonlyArray<T>) => T | undefined;
1268
+ /**
1269
+ * Returns the min element using the provided predicate.
1270
+ * @param items the array
1271
+ * @param fn the predicate
1272
+ * @signature
1273
+ * P.minBy(array, fn)
1274
+ * P.minBy.indexed(array, fn)
1275
+ * @example
1276
+ * P.minBy(
1277
+ * [{a: 5}, {a: 1}, {a: 3}],
1278
+ * x => x.a
1279
+ * ) // { a: 1 }
1280
+ * @dataFirst
1281
+ * @indexed
1282
+ * @category Array
1283
+ */
1284
+ declare function minBy<T>(items: ReadonlyArray<T>, fn: (item: T) => number): T | undefined;
1285
+ declare namespace minBy {
1286
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, number>): T | undefined;
1287
+ function indexed<T>(fn: PredIndexed<T, number>): (array: ReadonlyArray<T>) => T | undefined;
1288
+ }
1289
+
1290
+ /**
1291
+ * Splits a collection into two groups, the first of which contains elements the `predicate` type guard passes, and the second one containing the rest.
1292
+ * @param items the items to split
1293
+ * @param predicate a type guard function to invoke on every item
1294
+ * @returns the array of grouped elements.
1295
+ * @signature
1296
+ * P.partition(array, fn)
1297
+ * @example
1298
+ * P.partition(['one', 'two', 'forty two'], x => x.length === 3) // => [['one', 'two'], ['forty two']]
1299
+ * @dataFirst
1300
+ * @indexed
1301
+ * @category Array
1302
+ */
1303
+ declare function partition<T, S extends T>(items: ReadonlyArray<T>, predicate: (item: T) => item is S): [Array<S>, Array<Exclude<T, S>>];
1304
+ /**
1305
+ * Splits a collection into two groups, the first of which contains elements the `predicate` function matches, and the second one containing the rest.
1306
+ * @param items the items to split
1307
+ * @param predicate the function invoked per iteration
1308
+ * @returns the array of grouped elements.
1309
+ * @signature
1310
+ * P.partition(array, fn)
1311
+ * @example
1312
+ * P.partition(['one', 'two', 'forty two'], x => x.length === 3) // => [['one', 'two'], ['forty two']]
1313
+ * @dataFirst
1314
+ * @indexed
1315
+ * @category Array
1316
+ */
1317
+ declare function partition<T>(items: ReadonlyArray<T>, predicate: (item: T) => boolean): [Array<T>, Array<T>];
1318
+ /**
1319
+ * Splits a collection into two groups, the first of which contains elements the `predicate` type guard passes, and the second one containing the rest.
1320
+ * @param predicate the grouping function
1321
+ * @returns the array of grouped elements.
1322
+ * @signature
1323
+ * P.partition(fn)(array)
1324
+ * @example
1325
+ * P.pipe(['one', 'two', 'forty two'], P.partition(x => x.length === 3)) // => [['one', 'two'], ['forty two']]
1326
+ * @dataLast
1327
+ * @indexed
1328
+ * @category Array
1329
+ */
1330
+ declare function partition<T, S extends T>(predicate: (item: T) => item is S): (array: ReadonlyArray<T>) => [Array<S>, Array<Exclude<T, S>>];
1331
+ /**
1332
+ * Splits a collection into two groups, the first of which contains elements the `predicate` function matches, and the second one containing the rest.
1333
+ * @param predicate the grouping function
1334
+ * @returns the array of grouped elements.
1335
+ * @signature
1336
+ * P.partition(fn)(array)
1337
+ * @example
1338
+ * P.pipe(['one', 'two', 'forty two'], P.partition(x => x.length === 3)) // => [['one', 'two'], ['forty two']]
1339
+ * @dataLast
1340
+ * @indexed
1341
+ * @category Array
1342
+ */
1343
+ declare function partition<T>(predicate: (item: T) => boolean): (array: ReadonlyArray<T>) => [Array<T>, Array<T>];
1344
+ declare namespace partition {
1345
+ function indexed<T>(array: ReadonlyArray<T>, predicate: PredIndexed<T, boolean>): [Array<T>, Array<T>];
1346
+ function indexed<T>(predicate: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => [Array<T>, Array<T>];
1347
+ }
1348
+
1349
+ /**
1350
+ * Returns a list of numbers from `start` (inclusive) to `end` (exclusive).
1351
+ * @param start the start number
1352
+ * @param end the end number
1353
+ * @signature range(start, end)
1354
+ * @example
1355
+ * P.range(1, 5) // => [1, 2, 3, 4]
1356
+ * @dataFirst
1357
+ * @category Array
1358
+ */
1359
+ declare function range(start: number, end: number): Array<number>;
1360
+ /**
1361
+ * Returns a list of numbers from `start` (inclusive) to `end` (exclusive).
1362
+ * @param end the end number
1363
+ * @signature range(end)(start)
1364
+ * @example
1365
+ * P.range(5)(1) // => [1, 2, 3, 4]
1366
+ * @dataFirst
1367
+ * @category Array
1368
+ */
1369
+ declare function range(end: number): (start: number) => Array<number>;
1370
+
1371
+ /**
1372
+ * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
1373
+ * @param array the array to reduce
1374
+ * @param fn the callback function
1375
+ * @param initialValue the initial value to use as an accumulator value in the callback function
1376
+ * @signature
1377
+ * P.reduce(items, fn, initialValue)
1378
+ * P.reduce.indexed(items, fn, initialValue)
1379
+ * @example
1380
+ * P.reduce([1, 2, 3, 4, 5], (acc, x) => acc + x, 100) // => 115
1381
+ * P.reduce.indexed([1, 2, 3, 4, 5], (acc, x, i, array) => acc + x, 100) // => 115
1382
+ * @dataFirst
1383
+ * @indexed
1384
+ * @category Array
1385
+ */
1386
+ declare function reduce<T, K>(items: ReadonlyArray<T>, fn: (acc: K, item: T) => K, initialValue: K): K;
1387
+ /**
1388
+ * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
1389
+ * @param fn the callback function
1390
+ * @param initialValue the initial value to use as an accumulator value in the callback function
1391
+ * @signature
1392
+ * P.reduce(fn, initialValue)(array)
1393
+ * @example
1394
+ * P.pipe([1, 2, 3, 4, 5], P.reduce((acc, x) => acc + x, 100)) // => 115
1395
+ * P.pipe([1, 2, 3, 4, 5], P.reduce.indexed((acc, x, i, array) => acc + x, 100)) // => 115
1396
+ * @dataLast
1397
+ * @indexed
1398
+ * @category Array
1399
+ */
1400
+ declare function reduce<T, K>(fn: (acc: K, item: T) => K, initialValue: K): (items: ReadonlyArray<T>) => K;
1401
+ declare namespace reduce {
1402
+ function indexed<T, K>(array: ReadonlyArray<T>, fn: (acc: K, item: T, index: number, items: Array<T>) => K, initialValue: K): K;
1403
+ function indexed<T, K>(fn: (acc: K, item: T, index: number, items: Array<T>) => K, initialValue: K): (array: ReadonlyArray<T>) => K;
1404
+ }
1405
+
1406
+ /**
1407
+ * Reject the elements of an array that meet the condition specified in a callback function.
1408
+ * @param items The array to reject.
1409
+ * @param fn the callback function.
1410
+ * @signature
1411
+ * P.reject(array, fn)
1412
+ * P.reject.indexed(array, fn)
1413
+ * @example
1414
+ * P.reject([1, 2, 3], x => x % 2 === 0) // => [1, 3]
1415
+ * P.reject.indexed([1, 2, 3], (x, i, array) => x % 2 === 0) // => [1, 3]
1416
+ * @dataFirst
1417
+ * @indexed
1418
+ * @pipeable
1419
+ * @category Array
1420
+ */
1421
+ declare function reject<T>(items: ReadonlyArray<T>, fn: Pred<T, boolean>): Array<T>;
1422
+ /**
1423
+ * Reject the elements of an array that meet the condition specified in a callback function.
1424
+ * @param items The array to reject.
1425
+ * @param fn the callback function.
1426
+ * @signature
1427
+ * P.reject(array, fn)
1428
+ * P.reject.indexed(array, fn)
1429
+ * @example
1430
+ * P.reject([1, 2, 3], x => x % 2 === 0) // => [1, 3]
1431
+ * P.reject.indexed([1, 2, 3], (x, i, array) => x % 2 === 0) // => [1, 3]
1432
+ * @dataFirst
1433
+ * @indexed
1434
+ * @pipeable
1435
+ * @category Array
1436
+ */
1437
+ declare function reject<T>(fn: Pred<T, boolean>): (items: ReadonlyArray<T>) => Array<T>;
1438
+ declare namespace reject {
1439
+ function indexed<T, K>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): Array<K>;
1440
+ function indexed<T, K>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => Array<K>;
1441
+ const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>;
1442
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>) & {
1443
+ indexed: true;
1444
+ };
1445
+ }
1446
+
1447
+ type Reverse<T extends ReadonlyArray<unknown>, R extends ReadonlyArray<unknown> = []> = ReturnType<T extends IsNoTuple<T> ? () => [...T, ...R] : T extends readonly [infer F, ...infer L] ? () => Reverse<L, [F, ...R]> : () => R>;
1448
+ type IsNoTuple<T> = T extends readonly [unknown, ...Array<unknown>] ? never : T;
1449
+ /**
1450
+ * Reverses array.
1451
+ * @param array the array
1452
+ * @signature
1453
+ * P.reverse(arr);
1454
+ * @example
1455
+ * P.reverse([1, 2, 3]) // [3, 2, 1]
1456
+ * @dataFirst
1457
+ * @category Array
1458
+ */
1459
+ declare function reverse<T extends ReadonlyArray<unknown>>(array: T): Reverse<T>;
1460
+ /**
1461
+ * Reverses array.
1462
+ * @param array the array
1463
+ * @signature
1464
+ * P.reverse()(array);
1465
+ * @example
1466
+ * P.reverse()([1, 2, 3]) // [3, 2, 1]
1467
+ * @dataLast
1468
+ * @category Array
1469
+ */
1470
+ declare function reverse<T extends ReadonlyArray<unknown>>(): (array: T) => Reverse<T>;
1471
+
1472
+ type Sampled<T extends IterableContainer, N extends number> = number extends N ? SampledGeneric<T> : undefined extends T[N] ? T : SampledLiteral<T, N>;
1473
+ type SampledGeneric<T extends IterableContainer> = T[number] extends never ? T : T extends readonly [infer First, ...infer Rest] ? [First, ...SampledGeneric<Rest>] | SampledGeneric<Rest> : Array<T[number]>;
1474
+ type SampledLiteral<T extends IterableContainer, N extends number, Iteration extends Array<unknown> = []> = Iteration['length'] extends N ? [] : T extends readonly [infer First, ...infer Tail] ? [
1475
+ First | Tail[number],
1476
+ ...SampledLiteral<Tail, N, [unknown, ...Iteration]>
1477
+ ] : T extends readonly [...infer Head, infer Last] ? [...SampledLiteral<Head, N, [unknown, ...Iteration]>, Last] : [T[number], ...SampledLiteral<T, N, [unknown, ...Iteration]>] | SampledLiteral<T, N, [unknown, ...Iteration]>;
1478
+ /**
1479
+ * Returns a random subset of size `sampleSize` from `array`.
1480
+ *
1481
+ * Maintains and infers most of the typing information that could be passed
1482
+ * along to the output. This means that when using tuples, the output will be
1483
+ * a tuple too, and when using literals, those literals would be preserved.
1484
+ *
1485
+ * The items in the result are kept in the same order as they are in the input.
1486
+ * If you need to get a shuffled response you can pipe the shuffle function
1487
+ * after this one.
1488
+ *
1489
+ * @param array the array
1490
+ * @param sampleSize the number of elements to take
1491
+ * @signature
1492
+ * P.sample(array, sampleSize)
1493
+ * @example
1494
+ * P.sample(["hello", "world"], 1); // => ["hello"] // typed string[]
1495
+ * P.sample(["hello", "world"] as const, 1); // => ["world"] // typed ["hello" | "world"]
1496
+ * @dataFirst
1497
+ * @pipeable
1498
+ * @category Array
1499
+ */
1500
+ declare function sample<T extends IterableContainer, N extends number = number>(data: T, sampleSize: N): Sampled<T, N>;
1501
+ /**
1502
+ * Returns a random subset of size `sampleSize` from `array`.
1503
+ *
1504
+ * Maintains and infers most of the typing information that could be passed
1505
+ * along to the output. This means that when using tuples, the output will be
1506
+ * a tuple too, and when using literals, those literals would be preserved.
1507
+ *
1508
+ * The items in the result are kept in the same order as they are in the input.
1509
+ * If you need to get a shuffled response you can pipe the shuffle function
1510
+ * after this one.
1511
+ *
1512
+ * @param array the array
1513
+ * @param sampleSize the number of elements to take
1514
+ * @signature
1515
+ * P.sample(sampleSize)(array)
1516
+ * @example
1517
+ * P.sample(1)(["hello", "world"]); // => ["hello"] // typed string[]
1518
+ * P.sample(1)(["hello", "world"] as const); // => ["world"] // typed ["hello" | "world"]
1519
+ * @dataLast
1520
+ * @pipeable
1521
+ * @category Array
1522
+ */
1523
+ declare function sample<T extends IterableContainer, N extends number = number>(sampleSize: N): (data: T) => Sampled<T, N>;
1524
+
1525
+ /**
1526
+ * Shuffles the input array, returning a new array with the same elements in a random order.
1527
+ * @param items the array to shuffle
1528
+ * @signature
1529
+ * P.shuffle(array)
1530
+ * @example
1531
+ * P.shuffle([4, 2, 7, 5]) // => [7, 5, 4, 2]
1532
+ * @category Array
1533
+ * @dataFirst
1534
+ */
1535
+ declare function shuffle<T>(items: ReadonlyArray<T>): Array<T>;
1536
+ /**
1537
+ * Shuffles the input array, returning a new array with the same elements in a random order.
1538
+ * @signature
1539
+ * P.shuffle()(array)
1540
+ * @example
1541
+ * P.pipe([4, 2, 7, 5], P.shuffle()) // => [7, 5, 4, 2]
1542
+ * @category Array
1543
+ * @dataLast
1544
+ */
1545
+ declare function shuffle<T>(): (items: ReadonlyArray<T>) => Array<T>;
1546
+
1547
+ interface Strict$3 {
1548
+ <T extends IterableContainer>(items: T, cmp: (a: T[number], b: T[number]) => number): Sorted<T>;
1549
+ <T extends IterableContainer>(cmp: (a: T[number], b: T[number]) => number): (items: T) => Sorted<T>;
1550
+ }
1551
+ type Sorted<T extends IterableContainer> = {
1552
+ -readonly [P in keyof T]: T[number];
1553
+ };
1554
+ /**
1555
+ * Sorts an array. The comparator function should accept two values at a time and return a negative number if the first value is smaller, a positive number if it's larger, and zero if they are equal.
1556
+ * Sorting is based on a native `sort` function. It's not guaranteed to be stable.
1557
+ *
1558
+ * If the input array is more complex (non-empty array, tuple, etc...) use the
1559
+ * strict mode to maintain it's shape.
1560
+ *
1561
+ * @param items the array to sort
1562
+ * @param cmp the comparator function
1563
+ * @signature
1564
+ * P.sort(items, cmp)
1565
+ * P.sort.strict(items, cmp)
1566
+ * @example
1567
+ * P.sort([4, 2, 7, 5], (a, b) => a - b) // => [2, 4, 5, 7] typed Array<number>
1568
+ * P.sort.strict([4, 2] as [number, number], (a, b) => a - b) // [2, 4] typed [number, number]
1569
+ * @dataFirst
1570
+ * @category Array
1571
+ * @strict
1572
+ */
1573
+ declare function sort<T>(items: ReadonlyArray<T>, cmp: (a: T, b: T) => number): Array<T>;
1574
+ /**
1575
+ * Sorts an array. The comparator function should accept two values at a time and return a negative number if the first value is smaller, a positive number if it's larger, and zero if they are equal.
1576
+ * Sorting is based on a native `sort` function. It's not guaranteed to be stable.
1577
+ *
1578
+ * If the input array is more complex (non-empty array, tuple, etc...) use the
1579
+ * strict mode to maintain it's shape.
1580
+ *
1581
+ * @param cmp the comparator function
1582
+ * @signature
1583
+ * P.sort(cmp)(items)
1584
+ * P.sort.strict(cmp)(items)
1585
+ * @example
1586
+ * P.pipe([4, 2, 7, 5], P.sort((a, b) => a - b)) // => [2, 4, 5, 7] typed Array<number>
1587
+ * P.pipe([4, 2] as [number, number], P.sort.strict((a, b) => a - b)) // => [2, 4] typed [number, number]
1588
+ * @dataLast
1589
+ * @category Array
1590
+ * @strict
1591
+ */
1592
+ declare function sort<T>(cmp: (a: T, b: T) => number): (items: ReadonlyArray<T>) => Array<T>;
1593
+ declare namespace sort {
1594
+ const strict: Strict$3;
1595
+ }
1596
+
1597
+ declare const ALL_DIRECTIONS: readonly ["asc", "desc"];
1598
+ type Direction = (typeof ALL_DIRECTIONS)[number];
1599
+ type ComparablePrimitive = number | string | boolean;
1600
+ type Comparable = ComparablePrimitive | {
1601
+ valueOf(): ComparablePrimitive;
1602
+ };
1603
+ type SortProjection<T> = (x: T) => Comparable;
1604
+ type SortPair<T> = readonly [
1605
+ projector: SortProjection<T>,
1606
+ direction: Direction
1607
+ ];
1608
+ type SortRule<T> = SortProjection<T> | SortPair<T>;
1609
+ interface Strict$2 {
1610
+ <T extends IterableContainer>(...sortRules: Readonly<NonEmptyArray<SortRule<T[number]>>>): (array: T) => SortedBy<T>;
1611
+ <T extends IterableContainer>(array: T, ...sortRules: Readonly<NonEmptyArray<SortRule<T[number]>>>): SortedBy<T>;
1612
+ }
1613
+ type SortedBy<T extends IterableContainer> = {
1614
+ -readonly [P in keyof T]: T[number];
1615
+ };
1616
+ /**
1617
+ * Sorts the list according to the supplied functions and directions.
1618
+ * Sorting is based on a native `sort` function. It's not guaranteed to be stable.
1619
+ *
1620
+ * Directions are applied to functions in order and default to ascending if not specified.
1621
+ *
1622
+ * If the input array is more complex (non-empty array, tuple, etc...) use the
1623
+ * strict mode to maintain it's shape.
1624
+ *
1625
+ * @param sortRule main sort rule
1626
+ * @param additionalSortRules subsequent sort rules (these are only relevant when two items are equal based on the previous sort rule)
1627
+ * @signature
1628
+ * P.sortBy(sortRule, ...additionalSortRules)(array)
1629
+ * P.sortBy.strict(sortRule, ...additionalSortRules)(array)
1630
+ * @example
1631
+ * P.pipe(
1632
+ * [{ a: 1 }, { a: 3 }, { a: 7 }, { a: 2 }],
1633
+ * P.sortBy(x => x.a)
1634
+ * ) // => [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 7 }] typed Array<{a:number}>
1635
+ * P.pipe(
1636
+ * [{ a: 1 }, { a: 3 }] as const,
1637
+ * P.sortBy.strict(x => x.a)
1638
+ * ) // => [{ a: 1 }, { a: 3 }] typed [{a: 1 | 3}, {a: 1 | 3}]
1639
+ * @dataLast
1640
+ * @category Array
1641
+ * @strict
1642
+ */
1643
+ declare function sortBy<T>(...sortRules: Readonly<NonEmptyArray<SortRule<T>>>): (array: ReadonlyArray<T>) => Array<T>;
1644
+ /**
1645
+ * Sorts the list according to the supplied functions and directions.
1646
+ * Sorting is based on a native `sort` function. It's not guaranteed to be stable.
1647
+ *
1648
+ * Directions are applied to functions in order and default to ascending if not specified.
1649
+ *
1650
+ * If the input array is more complex (non-empty array, tuple, etc...) use the
1651
+ * strict mode to maintain it's shape.
1652
+ *
1653
+ * @param array the array to sort
1654
+ * @param sortRule main sort rule
1655
+ * @param additionalSortRules subsequent sort rules (these are only relevant when two items are equal based on the previous sort rule)
1656
+ * @signature
1657
+ * P.sortBy(array, sortRule, ...additionalSortRules)
1658
+ * P.sortBy.strict(array, sortRule, ...additionalSortRules)
1659
+ * @example
1660
+ * P.sortBy(
1661
+ * [{ a: 1 }, { a: 3 }, { a: 7 }, { a: 2 }],
1662
+ * x => x.a
1663
+ * )
1664
+ * // => [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 7 }] typed Array<{a:number}>
1665
+ *
1666
+ * P.sortBy(
1667
+ * [
1668
+ * {color: 'red', weight: 2},
1669
+ * {color: 'blue', weight: 3},
1670
+ * {color: 'green', weight: 1},
1671
+ * {color: 'purple', weight: 1},
1672
+ * ],
1673
+ * [x => x.weight, 'asc'], x => x.color
1674
+ * )
1675
+ * // =>
1676
+ * // {color: 'green', weight: 1},
1677
+ * // {color: 'purple', weight: 1},
1678
+ * // {color: 'red', weight: 2},
1679
+ * // {color: 'blue', weight: 3},
1680
+ * // typed Array<{color: string, weight: number}>
1681
+ *
1682
+ * P.sortBy.strict(
1683
+ * [{ a: 1 }, { a: 3 }] as const,
1684
+ * x => x.a
1685
+ * )
1686
+ * // => [{ a: 1 }, { a: 3 }] typed [{a: 1 | 3}, {a: 1 | 3}]
1687
+ * @dataFirst
1688
+ * @category Array
1689
+ * @strict
1690
+ */
1691
+ declare function sortBy<T>(array: ReadonlyArray<T>, ...sortRules: Readonly<NonEmptyArray<SortRule<T>>>): Array<T>;
1692
+ declare namespace sortBy {
1693
+ const strict: Strict$2;
1694
+ }
1695
+
1696
+ /**
1697
+ * Splits a given array at a given index.
1698
+ * @param array the array to split
1699
+ * @param index the index to split at
1700
+ * @signature
1701
+ * P.splitAt(array, index)
1702
+ * @example
1703
+ * P.splitAt([1, 2, 3], 1) // => [[1], [2, 3]]
1704
+ * P.splitAt([1, 2, 3, 4, 5], -1) // => [[1, 2, 3, 4], [5]]
1705
+ * @dataFirst
1706
+ * @category Array
1707
+ */
1708
+ declare function splitAt<T>(array: ReadonlyArray<T>, index: number): [Array<T>, Array<T>];
1709
+ /**
1710
+ * Splits a given array at a given index.
1711
+ * @param array the array to split
1712
+ * @param index the index to split at
1713
+ * @signature
1714
+ * P.splitAt(index)(array)
1715
+ * @example
1716
+ * P.splitAt(1)([1, 2, 3]) // => [[1], [2, 3]]
1717
+ * P.splitAt(-1)([1, 2, 3, 4, 5]) // => [[1, 2, 3, 4], [5]]
1718
+ * @dataLast
1719
+ * @category Array
1720
+ */
1721
+ declare function splitAt<T>(index: number): (array: ReadonlyArray<T>) => [Array<T>, Array<T>];
1722
+
1723
+ /**
1724
+ * Splits a given array at the first index where the given predicate returns true.
1725
+ * @param array the array to split
1726
+ * @param fn the predicate
1727
+ * @signature
1728
+ * P.splitWhen(array, fn)
1729
+ * @example
1730
+ * P.splitWhen([1, 2, 3], x => x === 2) // => [[1], [2, 3]]
1731
+ * @dataFirst
1732
+ * @category Array
1733
+ */
1734
+ declare function splitWhen<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean): [Array<T>, Array<T>];
1735
+ /**
1736
+ * Splits a given array at an index where the given predicate returns true.
1737
+ * @param fn the predicate
1738
+ * @signature
1739
+ * P.splitWhen(fn)(array)
1740
+ * @example
1741
+ * P.splitWhen(x => x === 2)([1, 2, 3]) // => [[1], [2, 3]]
1742
+ * @dataLast
1743
+ * @category Array
1744
+ */
1745
+ declare function splitWhen<T>(fn: (item: T) => boolean): (array: ReadonlyArray<T>) => [Array<T>, Array<T>];
1746
+
1747
+ /**
1748
+ * Returns the sum of the elements of an array using the provided predicate.
1749
+ * @param fn predicate function
1750
+ * @signature
1751
+ * P.sumBy(fn)(array)
1752
+ * P.sumBy.indexed(fn)(array)
1753
+ * @example
1754
+ * P.pipe(
1755
+ * [{a: 5}, {a: 1}, {a: 3}],
1756
+ * P.sumBy(x => x.a)
1757
+ * ) // 9
1758
+ * @dataLast
1759
+ * @indexed
1760
+ * @category Array
1761
+ */
1762
+ declare function sumBy<T>(fn: (item: T) => number): (items: ReadonlyArray<T>) => number;
1763
+ /**
1764
+ * Returns the sum of the elements of an array using the provided predicate.
1765
+ * @param items the array
1766
+ * @param fn predicate function
1767
+ * @signature
1768
+ * P.sumBy(array, fn)
1769
+ * P.sumBy.indexed(array, fn)
1770
+ * @example
1771
+ * P.sumBy(
1772
+ * [{a: 5}, {a: 1}, {a: 3}],
1773
+ * x => x.a
1774
+ * ) // 9
1775
+ * @dataFirst
1776
+ * @indexed
1777
+ * @category Array
1778
+ */
1779
+ declare function sumBy<T>(items: ReadonlyArray<T>, fn: (item: T) => number): number;
1780
+ declare namespace sumBy {
1781
+ function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, number>): number;
1782
+ function indexed<T>(fn: PredIndexed<T, number>): (array: ReadonlyArray<T>) => number;
1783
+ }
1784
+
1785
+ /**
1786
+ * @link https://github.com/sindresorhus/type-fest/blob/main/source/is-equal.d.ts
1787
+ */
1788
+ type isEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2 ? true : false;
1789
+ type Difference<A extends number, B extends number> = TupleOfLength<A> extends [
1790
+ ...infer U,
1791
+ ...TupleOfLength<B>
1792
+ ] ? U['length'] : never;
1793
+ type isLessThan<A extends number, B extends number> = isEqual<A, B> extends true ? false : 0 extends A ? true : 0 extends B ? false : isLessThan<Difference<A, 1>, Difference<B, 1>>;
1794
+ type TupleOfLength<L extends number, T extends IterableContainer = []> = T['length'] extends L ? T : TupleOfLength<L, [...T, unknown]>;
1795
+ type IsNonNegative<T extends number> = number extends T ? false : `${T}` extends `-${string}` ? false : true;
1796
+ type CharactersTuple<T extends string> = string extends T ? Array<string> : T extends `${infer C}${infer R}` ? [C, ...CharactersTuple<R>] : [];
1797
+ type SwapArrayInternal<T extends IterableContainer, Index1 extends number, Index2 extends number, Position extends ReadonlyArray<unknown> = [], Original extends IterableContainer = T> = T extends readonly [infer AtPosition, ...infer Rest] ? [
1798
+ Position['length'] extends Index1 ? Original[Index2] : Position['length'] extends Index2 ? Original[Index1] : AtPosition,
1799
+ ...SwapArrayInternal<Rest, Index1, Index2, [
1800
+ unknown,
1801
+ ...Position
1802
+ ], Original>
1803
+ ] : T;
1804
+ type SwapString<T extends string, K1 extends number, K2 extends number> = Joined<SwapArray<CharactersTuple<T>, K1, K2>, ''>;
1805
+ type SwapArray<T extends IterableContainer, K1 extends number, K2 extends number> = IsNonNegative<K1> extends false ? Array<T[number]> : IsNonNegative<K2> extends false ? Array<T[number]> : isLessThan<K1, T['length']> extends false ? T : isLessThan<K2, T['length']> extends false ? T : SwapArrayInternal<T, K1, K2>;
1806
+ type SwappedIndices<T extends IterableContainer | string, K1 extends number, K2 extends number> = T extends string ? SwapString<T, K1, K2> : T extends IterableContainer ? SwapArray<T, K1, K2> : never;
1807
+ /**
1808
+ * Swaps the positions of two elements in an array or string at the provided indices.
1809
+ *
1810
+ * Negative indices are supported and would be treated as an offset from the end of the array. The resulting type thought would be less strict than when using positive indices.
1811
+ *
1812
+ * If either index is out of bounds the result would be a shallow copy of the input, as-is.
1813
+ *
1814
+ * @param data the item to be manipulated. This can be an array, or a string.
1815
+ * @param index1 the first index
1816
+ * @param index2 the second index
1817
+ *
1818
+ * @signature
1819
+ * swapIndices(data, index1, index2)
1820
+ *
1821
+ * @example
1822
+ * swapIndices(['a', 'b', 'c'], 0, 1) // => ['b', 'a', 'c']
1823
+ * swapIndices(['a', 'b', 'c'], 1, -1) // => ['c', 'b', 'a']
1824
+ * swapIndices('abc', 0, 1) // => 'bac'
1825
+ *
1826
+ * @category Array
1827
+ *
1828
+ * @returns Returns the manipulated array or string.
1829
+ *
1830
+ * @dataFirst
1831
+ */
1832
+ declare function swapIndices<T extends IterableContainer | string, K1 extends number, K2 extends number>(data: T, index1: K1, index2: K2): SwappedIndices<T, K1, K2>;
1833
+ /**
1834
+ * @param index1 the first index
1835
+ * @param index2 the second index
1836
+ *
1837
+ * @signature
1838
+ * swapIndices(index1, index2)(data)
1839
+ *
1840
+ * @example
1841
+ * swapIndices(0, 1)(['a', 'b', 'c']) // => ['b', 'a', 'c']
1842
+ * swapIndices(0, -1)('abc') // => 'cba'
1843
+ *
1844
+ * @category Array
1845
+ * @returns Returns the manipulated array or string.
1846
+ * @dataLast
1847
+ */
1848
+ declare function swapIndices<K1 extends number, K2 extends number>(index1: K1, index2: K2): <T extends IterableContainer | string>(data: T) => SwappedIndices<T, K1, K2>;
1849
+
1850
+ /**
1851
+ * Returns the first `n` elements of `array`.
1852
+ * @param array the array
1853
+ * @param n the number of elements to take
1854
+ * @signature
1855
+ * P.take(array, n)
1856
+ * @example
1857
+ * P.take([1, 2, 3, 4, 3, 2, 1], 3) // => [1, 2, 3]
1858
+ * @dataFirst
1859
+ * @pipeable
1860
+ * @category Array
1861
+ */
1862
+ declare function take<T>(array: ReadonlyArray<T>, n: number): Array<T>;
1863
+ /**
1864
+ * Returns the first `n` elements of `array`.
1865
+ * @param n the number of elements to take
1866
+ * @signature
1867
+ * P.take(n)(array)
1868
+ * @example
1869
+ * P.pipe([1, 2, 3, 4, 3, 2, 1], P.take(n)) // => [1, 2, 3]
1870
+ * @dataLast
1871
+ * @pipeable
1872
+ * @category Array
1873
+ */
1874
+ declare function take<T>(n: number): (array: ReadonlyArray<T>) => Array<T>;
1875
+ declare namespace take {
1876
+ function lazy<T>(n: number): (value: T) => LazyResult<T>;
1877
+ }
1878
+
1879
+ /**
1880
+ * Returns elements from the array until predicate returns false.
1881
+ * @param array the array
1882
+ * @param fn the predicate
1883
+ * @signature
1884
+ * P.takeWhile(array, fn)
1885
+ * @example
1886
+ * P.takeWhile([1, 2, 3, 4, 3, 2, 1], x => x !== 4) // => [1, 2, 3]
1887
+ * @dataFirst
1888
+ * @category Array
1889
+ */
1890
+ declare function takeWhile<T>(array: ReadonlyArray<T>, fn: (item: T) => boolean): Array<T>;
1891
+ /**
1892
+ * Returns elements from the array until predicate returns false.
1893
+ * @param fn the predicate
1894
+ * @signature
1895
+ * P.takeWhile(fn)(array)
1896
+ * @example
1897
+ * P.pipe([1, 2, 3, 4, 3, 2, 1], P.takeWhile(x => x !== 4)) // => [1, 2, 3]
1898
+ * @dataLast
1899
+ * @category Array
1900
+ */
1901
+ declare function takeWhile<T>(fn: (item: T) => boolean): (array: ReadonlyArray<T>) => Array<T>;
1902
+
1903
+ /**
1904
+ * Returns a new array containing only one copy of each element in the original list.
1905
+ * Elements are compared by reference using Set.
1906
+ * Note: In `pipe`, use `uniq()` form instead of `uniq`. Otherwise, the inferred type is lost.
1907
+ * @param array
1908
+ * @signature
1909
+ * P.uniq(array)
1910
+ * @example
1911
+ * P.uniq([1, 2, 2, 5, 1, 6, 7]) // => [1, 2, 5, 6, 7]
1912
+ * P.pipe(
1913
+ * [1, 2, 2, 5, 1, 6, 7], // only 4 iterations
1914
+ * P.uniq(),
1915
+ * P.take(3)
1916
+ * ) // => [1, 2, 5]
1917
+ * @pipeable
1918
+ * @category Array
1919
+ */
1920
+ declare function uniq<T>(array: ReadonlyArray<T>): Array<T>;
1921
+ declare function uniq<T>(): (array: ReadonlyArray<T>) => Array<T>;
1922
+ declare namespace uniq {
1923
+ function lazy(): (value: any) => LazyResult<any>;
1924
+ }
1925
+
1926
+ declare function uniqBy<T, K>(array: ReadonlyArray<T>, transformer: (item: T) => K): Array<T>;
1927
+ /**
1928
+ * Returns a new array containing only one copy of each element in the original list transformed by a function.
1929
+ * Elements are compared by reference using Set.
1930
+ * @param array
1931
+ * @signature
1932
+ * P.uniqBy(array, fn)
1933
+ * @example
1934
+ * P.uniqBy(
1935
+ * [{ n: 1 }, { n: 2 }, { n: 2 }, { n: 5 }, { n: 1 }, { n: 6 }, { n: 7 }],
1936
+ * (obj) => obj.n,
1937
+ * ) // => [{n: 1}, {n: 2}, {n: 5}, {n: 6}, {n: 7}]
1938
+ * P.pipe(
1939
+ * [{n: 1}, {n: 2}, {n: 2}, {n: 5}, {n: 1}, {n: 6}, {n: 7}], // only 4 iterations
1940
+ * P.uniqBy(obj => obj.n),
1941
+ * P.take(3)
1942
+ * ) // => [{n: 1}, {n: 2}, {n: 5}]
1943
+ * @pipeable
1944
+ * @category Array
1945
+ */
1946
+ declare function uniqBy<T, K>(transformer: (item: T) => K): (array: ReadonlyArray<T>) => Array<T>;
1947
+
1948
+ type IsEquals<T> = (a: T, b: T) => boolean;
1949
+ declare function _lazy<T>(isEquals: IsEquals<T>): (value: T, index?: number, array?: Array<T>) => LazyResult<T>;
1950
+ /**
1951
+ * Returns a new array containing only one copy of each element in the original list.
1952
+ * Elements are compared by custom comparator isEquals.
1953
+ * @param array
1954
+ * @param isEquals the comparator
1955
+ * @signature
1956
+ * P.uniqWith(array, isEquals)
1957
+ * @example
1958
+ * P.uniqWith(
1959
+ * [{a: 1}, {a: 2}, {a: 2}, {a: 5}, {a: 1}, {a: 6}, {a: 7}],
1960
+ * P.equals,
1961
+ * ) // => [{a: 1}, {a: 2}, {a: 5}, {a: 6}, {a: 7}]
1962
+ * @dataFirst
1963
+ * @category Array
1964
+ */
1965
+ declare function uniqWith<T>(array: ReadonlyArray<T>, isEquals: IsEquals<T>): Array<T>;
1966
+ /**
1967
+ * Returns a new array containing only one copy of each element in the original list.
1968
+ * Elements are compared by custom comparator isEquals.
1969
+ * @param isEquals the comparator
1970
+ * @signature P.uniqWith(isEquals)(array)
1971
+ * @example
1972
+ * P.uniqWith(P.equals)(
1973
+ * [{a: 1}, {a: 2}, {a: 2}, {a: 5}, {a: 1}, {a: 6}, {a: 7}],
1974
+ * ) // => [{a: 1}, {a: 2}, {a: 5}, {a: 6}, {a: 7}]
1975
+ * P.pipe(
1976
+ * [{a: 1}, {a: 2}, {a: 2}, {a: 5}, {a: 1}, {a: 6}, {a: 7}], // only 4 iterations
1977
+ * P.uniqWith(P.equals),
1978
+ * P.take(3)
1979
+ * ) // => [{a: 1}, {a: 2}, {a: 5}]
1980
+ * @dataLast
1981
+ * @category Object
1982
+ */
1983
+ declare function uniqWith<T>(isEquals: IsEquals<T>): (array: ReadonlyArray<T>) => Array<T>;
1984
+ declare namespace uniqWith {
1985
+ const lazy: typeof _lazy & {
1986
+ indexed: true;
1987
+ };
1988
+ }
1989
+
1990
+ /**
1991
+ * Creates a new list from two supplied lists by pairing up equally-positioned items.
1992
+ * The length of the returned list will match the shortest of the two inputs.
1993
+ * @param first the first input list
1994
+ * @param second the second input list
1995
+ * @signature
1996
+ * P.zip(first, second)
1997
+ * @example
1998
+ * P.zip([1, 2], ['a', 'b']) // => [1, 'a'], [2, 'b']
1999
+ * @dataFirst
2000
+ * @category Array
2001
+ */
2002
+ declare function zip<F, S>(first: ReadonlyArray<F>, second: ReadonlyArray<S>): Array<[F, S]>;
2003
+ /**
2004
+ * Creates a new list from two supplied lists by pairing up equally-positioned items.
2005
+ * The length of the returned list will match the shortest of the two inputs.
2006
+ * @param second the second input list
2007
+ * @signature
2008
+ * P.zip(second)(first)
2009
+ * @example
2010
+ * P.zip(['a', 'b'])([1, 2]) // => [[1, 'a'], [2, 'b']
2011
+ * @dataLast
2012
+ * @category Array
2013
+ */
2014
+ declare function zip<S>(second: ReadonlyArray<S>): <F>(first: ReadonlyArray<F>) => Array<[F, S]>;
2015
+
2016
+ /**
2017
+ * Creates a new object from two supplied lists by pairing up equally-positioned items.
2018
+ * Key/value pairing is truncated to the length of the shorter of the two lists
2019
+ * @param first the first input list
2020
+ * @param second the second input list
2021
+ * @signature
2022
+ * P.zipObj(first, second)
2023
+ * @example
2024
+ * P.zipObj(['a', 'b'], [1, 2]) // => {a: 1, b: 2}
2025
+ * @dataFirst
2026
+ * @category Array
2027
+ */
2028
+ declare function zipObj<F extends string | number | symbol, S>(first: ReadonlyArray<F>, second: ReadonlyArray<S>): Record<F, S>;
2029
+ /**
2030
+ * Creates a new object from two supplied lists by pairing up equally-positioned items.
2031
+ * Key/value pairing is truncated to the length of the shorter of the two lists
2032
+ * @param second the second input list
2033
+ * @signature
2034
+ * P.zipObj(second)(first)
2035
+ * @example
2036
+ * P.zipObj([1, 2])(['a', 'b']) // => {a: 1, b: 2}
2037
+ * @dataLast
2038
+ * @category Array
2039
+ */
2040
+ declare function zipObj<S>(second: ReadonlyArray<S>): <F extends string | number | symbol>(first: ReadonlyArray<F>) => Record<F, S>;
2041
+
2042
+ /**
2043
+ * Creates a new list from two supplied lists by calling the supplied function
2044
+ * with the same-positioned element from each list.
2045
+ * @param first the first input list
2046
+ * @param second the second input list
2047
+ * @param fn the function applied to each position of the list
2048
+ * @signature
2049
+ * P.zipWith(first, second, fn)
2050
+ * @example
2051
+ * P.zipWith(['1', '2', '3'], ['a', 'b', 'c'], (a, b) => a + b) // => ['1a', '2b', '3c']
2052
+ * @dataFirst
2053
+ * @category Array
2054
+ */
2055
+ declare function zipWith<F, S, R>(first: Array<F>, second: Array<S>, fn: (f: F, s: S) => R): Array<R>;
2056
+ /**
2057
+ * Creates a new list from two supplied lists by calling the supplied function
2058
+ * with the same-positioned element from each list.
2059
+ * @param fn the function applied to each position of the list
2060
+ * @signature
2061
+ * P.zipWith(fn)(first, second)
2062
+ * @example
2063
+ * P.zipWith((a, b) => a + b)(['1', '2', '3'], ['a', 'b', 'c']) // => ['1a', '2b', '3c']
2064
+ * @dataLast
2065
+ * @category Array
2066
+ */
2067
+ declare function zipWith<F, S, R>(fn: (f: F, s: S) => R): (first: Array<F>, second: Array<S>) => Array<R>;
2068
+ /**
2069
+ * Creates a new list from two supplied lists by calling the supplied function
2070
+ * with the same-positioned element from each list.
2071
+ * @param fn the function applied to each position of the list
2072
+ * @param second the second input list
2073
+ * @signature
2074
+ * P.zipWith(fn)(first, second)
2075
+ * @example
2076
+ * P.zipWith((a, b) => a + b, ['a', 'b', 'c'])(['1', '2', '3']) // => ['1a', '2b', '3c']
2077
+ * @dataLast
2078
+ * @category Array
2079
+ */
2080
+ declare function zipWith<F, S, R>(fn: (f: F, s: S) => R, second: Array<S>): (first: Array<F>) => Array<R>;
2081
+
2082
+ /**
2083
+ * Creates a data-last pipe function. First function must be always annotated. Other functions are automatically inferred.
2084
+ * @signature
2085
+ * P.createPipe(op1, op2, op3)(data);
2086
+ * @example
2087
+ * P.createPipe(
2088
+ * (x: number) => x * 2,
2089
+ * x => x * 3
2090
+ * )(1) // => 6
2091
+ * @category Function
2092
+ */
2093
+ declare function createPipe<A, B>(op1: (input: A) => B): (value: A) => B;
2094
+ declare function createPipe<A, B, C>(op1: (input: A) => B, op2: (input: B) => C): (value: A) => C;
2095
+ declare function createPipe<A, B, C, D>(op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D): (value: A) => D;
2096
+ declare function createPipe<A, B, C, D, E>(op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E): (value: A) => E;
2097
+ declare function createPipe<A, B, C, D, E, F>(op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F): (value: A) => F;
2098
+ declare function createPipe<A, B, C, D, E, F, G>(op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F, op6: (input: F) => G): (value: A) => G;
2099
+ declare function createPipe<A, B, C, D, E, F, G, H>(op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F, op6: (input: F) => G, op7: (input: G) => H): (value: A) => H;
2100
+
2101
+ /**
2102
+ * A function that always returns the param passed to it
2103
+ * @signature
2104
+ * P.identity(data)
2105
+ * @example
2106
+ * P.identity('foo') // => 'foo'
2107
+ * @category Function
2108
+ */
2109
+ declare function identity<T>(value: T): T;
2110
+
2111
+ /**
2112
+ * A function that returns always `undefined`.
2113
+ * @signature
2114
+ * P.noop()
2115
+ * @example
2116
+ * onSomething(P.noop)
2117
+ * @category Function
2118
+ */
2119
+ declare function noop(): undefined;
2120
+
2121
+ /**
2122
+ * Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value of the first invocation.
2123
+ * @param fn the function to wrap
2124
+ * @signature P.once(fn)
2125
+ * @example
2126
+ * const initialize = P.once(createApplication);
2127
+ * initialize();
2128
+ * initialize();
2129
+ * // => `createApplication` is invoked once
2130
+ * @category Function
2131
+ */
2132
+ declare function once<T>(fn: () => T): () => T;
2133
+
2134
+ /**
2135
+ * Perform left-to-right function composition.
2136
+ * @param value The initial value.
2137
+ * @param operations the list of operations to apply.
2138
+ * @signature P.pipe(data, op1, op2, op3)
2139
+ * @example
2140
+ * P.pipe(
2141
+ * [1, 2, 3, 4],
2142
+ * P.map(x => x * 2),
2143
+ * arr => [arr[0] + arr[1], arr[2] + arr[3]],
2144
+ * ) // => [6, 14]
2145
+ *
2146
+ *
2147
+ * @dataFirst
2148
+ * @category Function
2149
+ */
2150
+ declare function pipe<A, B>(value: A, op1: (input: A) => B): B;
2151
+ declare function pipe<A, B, C>(value: A, op1: (input: A) => B, op2: (input: B) => C): C;
2152
+ declare function pipe<A, B, C, D>(value: A, op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D): D;
2153
+ declare function pipe<A, B, C, D, E>(value: A, op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E): E;
2154
+ declare function pipe<A, B, C, D, E, F>(value: A, op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F): F;
2155
+ declare function pipe<A, B, C, D, E, F, G>(value: A, op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F, op6: (input: F) => G): G;
2156
+ declare function pipe<A, B, C, D, E, F, G, H>(value: A, op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F, op6: (input: F) => G, op7: (input: G) => H): H;
2157
+ declare function pipe<A, B, C, D, E, F, G, H, I>(value: A, op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F, op6: (input: F) => G, op7: (input: G) => H, op8: (input: H) => I): I;
2158
+ declare function pipe<A, B, C, D, E, F, G, H, I, J>(value: A, op1: (input: A) => B, op2: (input: B) => C, op3: (input: C) => D, op4: (input: D) => E, op5: (input: E) => F, op6: (input: F) => G, op7: (input: G) => H, op8: (input: H) => I, op9: (input: I) => J): J;
2159
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(value: A, op01: (input: A) => B, op02: (input: B) => C, op03: (input: C) => D, op04: (input: D) => E, op05: (input: E) => F, op06: (input: F) => G, op07: (input: G) => H, op08: (input: H) => I, op09: (input: I) => J, op10: (input: J) => K): K;
2160
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(value: A, op01: (input: A) => B, op02: (input: B) => C, op03: (input: C) => D, op04: (input: D) => E, op05: (input: E) => F, op06: (input: F) => G, op07: (input: G) => H, op08: (input: H) => I, op09: (input: I) => J, op10: (input: J) => K, op11: (input: K) => L): L;
2161
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(value: A, op01: (input: A) => B, op02: (input: B) => C, op03: (input: C) => D, op04: (input: D) => E, op05: (input: E) => F, op06: (input: F) => G, op07: (input: G) => H, op08: (input: H) => I, op09: (input: I) => J, op10: (input: J) => K, op11: (input: K) => L, op12: (input: L) => M): M;
2162
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(value: A, op01: (input: A) => B, op02: (input: B) => C, op03: (input: C) => D, op04: (input: D) => E, op05: (input: E) => F, op06: (input: F) => G, op07: (input: G) => H, op08: (input: H) => I, op09: (input: I) => J, op10: (input: J) => K, op11: (input: K) => L, op12: (input: L) => M, op13: (input: M) => N): N;
2163
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(value: A, op01: (input: A) => B, op02: (input: B) => C, op03: (input: C) => D, op04: (input: D) => E, op05: (input: E) => F, op06: (input: F) => G, op07: (input: G) => H, op08: (input: H) => I, op09: (input: I) => J, op10: (input: J) => K, op11: (input: K) => L, op12: (input: L) => M, op13: (input: M) => N, op14: (input: N) => O): O;
2164
+ declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(value: A, op01: (input: A) => B, op02: (input: B) => C, op03: (input: C) => D, op04: (input: D) => E, op05: (input: E) => F, op06: (input: F) => G, op07: (input: G) => H, op08: (input: H) => I, op09: (input: I) => J, op10: (input: J) => K, op11: (input: K) => L, op12: (input: L) => M, op13: (input: M) => N, op14: (input: N) => O, op15: (input: O) => P): P;
2165
+
2166
+ /**
2167
+ * Creates a function with `data-first` and `data-last` signatures.
2168
+ *
2169
+ * `purry` is a dynamic function and it's not type safe. It should be wrapped by a function that have proper typings.
2170
+ * Refer to the example below for correct usage.
2171
+ *
2172
+ * @param fn the function to purry.
2173
+ * @param args the arguments
2174
+ * @signature P.purry(fn, arguments);
2175
+ * @exampleRaw
2176
+ * function _findIndex(array, fn) {
2177
+ * for (let i = 0; i < array.length; i++) {
2178
+ * if (fn(array[i])) {
2179
+ * return i;
2180
+ * }
2181
+ * }
2182
+ * return -1;
2183
+ * }
2184
+ *
2185
+ * // data-first
2186
+ * function findIndex<T>(array: T[], fn: (item: T) => boolean): number;
2187
+ *
2188
+ * // data-last
2189
+ * function findIndex<T>(fn: (item: T) => boolean): (array: T[]) => number;
2190
+ *
2191
+ * function findIndex() {
2192
+ * return P.purry(_findIndex, arguments);
2193
+ * }
2194
+ * @category Function
2195
+ */
2196
+ declare function purry(fn: any, args: IArguments | ReadonlyArray<any>, lazy?: any): any;
2197
+
2198
+ type DefinitelyArray<T> = Extract<T, Array<any> | ReadonlyArray<any>> extends never ? ReadonlyArray<unknown> : Extract<T, Array<any> | ReadonlyArray<any>>;
2199
+ /**
2200
+ * A function that checks if the passed parameter is an Array and narrows its type accordingly
2201
+ * @param data the variable to check
2202
+ * @signature
2203
+ * P.isArray(data)
2204
+ * @returns true if the passed input is an Array, false otherwise
2205
+ * @example
2206
+ * P.isArray([5]) //=> true
2207
+ * P.isArray([]) //=> true
2208
+ * P.isArray('somethingElse') //=> false
2209
+ * @category Guard
2210
+ */
2211
+ declare function isArray<T>(data: T | ReadonlyArray<unknown>): data is DefinitelyArray<T>;
2212
+
2213
+ type DefinitelyBoolean<T> = Extract<T, boolean> extends never ? boolean : Extract<T, boolean> extends any ? boolean : Extract<T, number>;
2214
+ /**
2215
+ * A function that checks if the passed parameter is a boolean and narrows its type accordingly
2216
+ * @param data the variable to check
2217
+ * @signature
2218
+ * P.isBoolean(data)
2219
+ * @returns true if the passed input is a boolean, false otherwise
2220
+ * @example
2221
+ * P.isBoolean(true) //=> true
2222
+ * P.isBoolean(false) //=> true
2223
+ * P.isBoolean('somethingElse') //=> false
2224
+ * @category Guard
2225
+ */
2226
+ declare function isBoolean<T>(data: T | boolean): data is DefinitelyBoolean<T>;
2227
+
2228
+ /**
2229
+ * A function that checks if the passed parameter is a Date and narrows its type accordingly
2230
+ * @param data the variable to check
2231
+ * @signature
2232
+ * P.isDate(data)
2233
+ * @returns true if the passed input is a Date, false otherwise
2234
+ * @example
2235
+ * P.isDate(new Date()) //=> true
2236
+ * P.isDate('somethingElse') //=> false
2237
+ * @category Guard
2238
+ */
2239
+ declare function isDate(data: unknown): data is Date;
2240
+
2241
+ /**
2242
+ * A function that checks if the passed parameter is defined and narrows its type accordingly.
2243
+ * To test specifically for `undefined` (and not `null`) use the strict variant of this function.
2244
+ * @param data the variable to check
2245
+ * @signature
2246
+ * P.isDefined(data)
2247
+ * P.isDefined.strict(data)
2248
+ * @returns true if the passed input is defined, false otherwise
2249
+ * @example
2250
+ * P.isDefined('string') //=> true
2251
+ * P.isDefined(null) //=> false
2252
+ * P.isDefined(undefined) //=> false
2253
+ * P.isDefined.strict(null) //=> true
2254
+ * P.isDefined.strict(undefined) //=> false
2255
+ * @category Guard
2256
+ * @strict
2257
+ */
2258
+ declare function isDefined<T>(data: T): data is NonNullable<T>;
2259
+ declare namespace isDefined {
2260
+ function strict<T>(data: T | undefined): data is T;
2261
+ }
2262
+
2263
+ /**
2264
+ * A function that checks if the passed parameter is empty
2265
+ * @param data the variable to check
2266
+ * @signature
2267
+ * P.isEmpty(data)
2268
+ * @returns true if the passed input is empty, false otherwise
2269
+ * @example
2270
+ * P.isEmpty('') //=> true
2271
+ * P.isEmpty([]) //=> true
2272
+ * P.isEmpty({}) //=> true
2273
+ * P.isEmpty('test') //=> false
2274
+ * P.isEmpty([1, 2, 3]) //=> false
2275
+ * P.isEmpty({ length: 0 }) //=> false
2276
+ * @category Function
2277
+ */
2278
+ declare function isEmpty(data: string): data is '';
2279
+ declare function isEmpty(data: ReadonlyArray<unknown> | []): data is [];
2280
+ declare function isEmpty<T extends Readonly<Record<PropertyKey, unknown>>>(data: T): data is Record<keyof T, never>;
2281
+
2282
+ type DefinitelyError<T> = Extract<T, Error> extends never ? Error : Extract<T, Error>;
2283
+ /**
2284
+ * A function that checks if the passed parameter is an Error and narrows its type accordingly
2285
+ * @param data the variable to check
2286
+ * @signature
2287
+ * P.isError(data)
2288
+ * @returns true if the passed input is an Error, false otherwise
2289
+ * @example
2290
+ * P.isError(new Error('message')) //=> true
2291
+ * P.isError('somethingElse') //=> false
2292
+ * @category Guard
2293
+ */
2294
+ declare function isError<T>(data: T | Error): data is DefinitelyError<T>;
2295
+
2296
+ type DefinitelyFunction<T> = Extract<T, Function> extends never ? Function : Extract<T, Function>;
2297
+ /**
2298
+ * A function that checks if the passed parameter is a Function and narrows its type accordingly
2299
+ * @param data the variable to check
2300
+ * @signature
2301
+ * P.isFunction(data)
2302
+ * @returns true if the passed input is a Function, false otherwise
2303
+ * @example
2304
+ * P.isFunction(() => {}) //=> true
2305
+ * P.isFunction('somethingElse') //=> false
2306
+ * @category Guard
2307
+ */
2308
+ declare function isFunction<T>(data: T | Function): data is DefinitelyFunction<T>;
2309
+
2310
+ /**
2311
+ * A function that checks if the passed parameter is Nil (null or undefined) and narrows its type accordingly
2312
+ * @param data the variable to check
2313
+ * @signature
2314
+ * P.isNil(data)
2315
+ * @returns true if the passed input is Nil (null or undefined), false otherwise
2316
+ * @example
2317
+ * P.isNil(undefined) //=> true
2318
+ * P.isNil(null) //=> true
2319
+ * P.isNil('somethingElse') //=> false
2320
+ * @category Guard
2321
+ */
2322
+ declare function isNil<T>(data: T): data is Extract<T, null | undefined>;
2323
+
2324
+ /**
2325
+ * A function that checks if the passed parameter is not `null` and narrows its type accordingly.
2326
+ * Notice that `undefined` is not null!
2327
+ * @param data the variable to check
2328
+ * @signature
2329
+ * P.isNonNull(data)
2330
+ * @returns true if the passed input is defined, false otherwise
2331
+ * @example
2332
+ * P.isNonNull('string') //=> true
2333
+ * P.isNonNull(null) //=> false
2334
+ * P.isNonNull(undefined) //=> true
2335
+ * @category Guard
2336
+ */
2337
+ declare function isNonNull<T>(data: T | null): data is T;
2338
+
2339
+ /**
2340
+ * A function that takes a guard function as predicate and returns a guard that negates it
2341
+ * @param predicate the guard function to negate
2342
+ * @signature
2343
+ * P.isNot(P.isTruthy)(data)
2344
+ * @returns function A guard function
2345
+ * @example
2346
+ * P.isNot(P.isTruthy)(false) //=> true
2347
+ * P.isNot(P.isTruthy)(true) //=> false
2348
+ * @dataLast
2349
+ * @category Guard
2350
+ */
2351
+ declare function isNot<T, S extends T>(predicate: (data: T) => data is S): (data: T) => data is Exclude<T, S>;
2352
+ declare function isNot<T>(predicate: (data: T) => any): (data: T) => boolean;
2353
+
2354
+ type DefinitelyNumber<T> = Extract<T, number> extends never ? number : Extract<T, number> extends any ? number : Extract<T, number>;
2355
+ /**
2356
+ * A function that checks if the passed parameter is a number and narrows its type accordingly
2357
+ * @param data the variable to check
2358
+ * @signature
2359
+ * R.isNumber(data)
2360
+ * @returns true if the passed input is a number, false otherwise
2361
+ * @example
2362
+ * R.isNumber(1) //=> true
2363
+ * R.isNumber('notANumber') //=> false
2364
+ * @category Guard
2365
+ */
2366
+ declare function isNumber<T>(data: T | number): data is DefinitelyNumber<T>;
2367
+
2368
+ type DefinitelyObject<T> = Exclude<Extract<T, object>, Array<any> | Function | ReadonlyArray<any>> extends never ? Record<string, unknown> : Exclude<Extract<T, object>, Array<any> | Function | ReadonlyArray<any>>;
2369
+ /**
2370
+ * A function that checks if the passed parameter is of type Object and narrows its type accordingly
2371
+ * @param data the variable to check
2372
+ * @signature
2373
+ * P.isObject(data)
2374
+ * @returns true if the passed input is an Object, Promise, Date or Error, false otherwise
2375
+ * @example
2376
+ * P.isObject({}) //=> true
2377
+ * P.isObject(Promise.resolve("something")) //=> true
2378
+ * P.isObject(new Date()) //=> true
2379
+ * P.isObject(new Error("error")) //=> true
2380
+ * P.isObject('somethingElse') //=> false
2381
+ * @category Guard
2382
+ */
2383
+ declare function isObject<T>(data: T | object): data is DefinitelyObject<T>;
2384
+
2385
+ /**
2386
+ * A function that checks if the passed parameter is a Promise and narrows its type accordingly
2387
+ * @param data the variable to check
2388
+ * @signature
2389
+ * P.isPromise(data)
2390
+ * @returns true if the passed input is a Promise, false otherwise
2391
+ * @example
2392
+ * P.isPromise(Promise.resolve(5)) //=> true
2393
+ * P.isPromise(Promise.reject(5)) //=> true
2394
+ * P.isPromise('somethingElse') //=> false
2395
+ * @category Guard
2396
+ */
2397
+ declare function isPromise<T, S>(data: Promise<T> | S): data is Promise<T>;
2398
+
2399
+ type DefinitelyString<T> = Extract<T, string> extends never ? string : Extract<T, string> extends any ? string : Extract<T, string>;
2400
+ /**
2401
+ * A function that checks if the passed parameter is a string and narrows its type accordingly
2402
+ * @param data the variable to check
2403
+ * @signature
2404
+ * P.isString(data)
2405
+ * @returns true if the passed input is a string, false otherwise
2406
+ * @example
2407
+ * P.isString('string') //=> true
2408
+ * P.isString(1) //=> false
2409
+ * @category Guard
2410
+ */
2411
+ declare function isString<T>(data: T | string): data is DefinitelyString<T>;
2412
+
2413
+ /**
2414
+ * A function that checks if the passed parameter is truthy and narrows its type accordingly
2415
+ * @param data the variable to check
2416
+ * @signature
2417
+ * P.isTruthy(data)
2418
+ * @returns true if the passed input is truthy, false otherwise
2419
+ * @example
2420
+ * P.isTruthy('somethingElse') //=> true
2421
+ * P.isTruthy(null) //=> false
2422
+ * P.isTruthy(undefined) //=> false
2423
+ * P.isTruthy(false) //=> false
2424
+ * P.isTruthy(0) //=> false
2425
+ * P.isTruthy('') //=> false
2426
+ * @category Guard
2427
+ */
2428
+ declare function isTruthy<T>(data: T): data is Exclude<T, null | undefined | false | '' | 0>;
2429
+
2430
+ declare function convertToUnit(str: string | number | null | undefined, unit?: string): string | undefined;
2431
+ /**
2432
+ * Increase string a value with unit
2433
+ *
2434
+ */
2435
+ declare function increaseWithUnit({ target, delta }: {
2436
+ target: string | number;
2437
+ delta: number;
2438
+ }): string | number;
2439
+ declare function humanReadableFileSize(bytes: number, base?: 1000 | 1024): string;
2440
+ declare function sleep(timeout: number): Promise<void>;
2441
+
2442
+ /**
2443
+ * Clamp the given value within the inclusive min and max bounds.
2444
+ * @param value the number
2445
+ * @param limits the bounds limits
2446
+ * @signature
2447
+ * P.clamp(value, { min, max });
2448
+ * @example
2449
+ * clamp(10, { min: 20 }) // => 20
2450
+ * clamp(10, { max: 5 }) // => 5
2451
+ * clamp(10, { max: 20, min: 5 }) // => 10
2452
+ * @dataFirst
2453
+ * @category Number
2454
+ */
2455
+ declare function clamp(value: number, limits: {
2456
+ min?: number;
2457
+ max?: number;
2458
+ }): number;
2459
+ /**
2460
+ * Clamp the given value within the inclusive min and max bounds.
2461
+ * @param value the number
2462
+ * @param limits the bounds limits
2463
+ * @signature
2464
+ * P.clamp({ min, max })(value);
2465
+ * @example
2466
+ * clamp({ min: 20 })(10) // => 20
2467
+ * clamp({ max: 5 })(10) // => 5
2468
+ * clamp({ max: 20, min: 5 })(10) // => 10
2469
+ * @dataLast
2470
+ * @category Number
2471
+ */
2472
+ declare function clamp(limits: {
2473
+ min?: number;
2474
+ max?: number;
2475
+ }): (value: number) => number;
2476
+
2477
+ /**
2478
+ * Add a new property to an object.
2479
+ * @param obj the target object
2480
+ * @param prop the property name
2481
+ * @param value the property value
2482
+ * @signature
2483
+ * P.addProp(obj, prop, value)
2484
+ * @example
2485
+ * P.addProp({firstName: 'john'}, 'lastName', 'doe') // => {firstName: 'john', lastName: 'doe'}
2486
+ * @dataFirst
2487
+ * @category Object
2488
+ */
2489
+ declare function addProp<T extends Record<PropertyKey, any>, K extends string, V>(obj: T, prop: K, value: V): T & {
2490
+ [x in K]: V;
2491
+ };
2492
+ /**
2493
+ * Add a new property to an object.
2494
+ * @param prop the property name
2495
+ * @param value the property value
2496
+ * @signature
2497
+ * P.addProp(prop, value)(obj)
2498
+ * @example
2499
+ * P.addProp('lastName', 'doe')({firstName: 'john'}) // => {firstName: 'john', lastName: 'doe'}
2500
+ * @dataLast
2501
+ * @category Object
2502
+ */
2503
+ declare function addProp<T extends Record<PropertyKey, any>, K extends string, V>(prop: K, value: V): (obj: T) => T & {
2504
+ [x in K]: V;
2505
+ };
2506
+
2507
+ /**
2508
+ * Creates a deep copy of the value. Supported types: `Array`, `Object`, `Number`, `String`, `Boolean`, `Date`, `RegExp`. Functions are assigned by reference rather than copied.
2509
+ * @param value the object to clone
2510
+ * @category Object
2511
+ * @signature P.clone(value)
2512
+ * @example P.clone({foo: 'bar'}) // {foo: 'bar'}
2513
+ */
2514
+ declare function clone<T>(value: T): T;
2515
+
2516
+ /**
2517
+ * Returns true if its arguments are equivalent, false otherwise.
2518
+ * NOTE: Doesn't handle cyclical data structures.
2519
+ * @param a the first object to compare
2520
+ * @param b the second object to compare
2521
+ * @signature
2522
+ * P.equals(a, b)
2523
+ * @example
2524
+ * P.equals(1, 1) //=> true
2525
+ * P.equals(1, '1') //=> false
2526
+ * P.equals([1, 2, 3], [1, 2, 3]) //=> true
2527
+ * @dataFirst
2528
+ * @category Object
2529
+ */
2530
+ declare function equals(a: any, b: any): boolean;
2531
+ /**
2532
+ * Returns true if its arguments are equivalent, false otherwise.
2533
+ * NOTE: Doesn't handle cyclical data structures.
2534
+ * @param a the first object to compare
2535
+ * @param b the second object to compare
2536
+ * @signature
2537
+ * P.equals(b)(a)
2538
+ * @example
2539
+ * P.equals(1)(1) //=> true
2540
+ * P.equals('1')(1) //=> false
2541
+ * P.equals([1, 2, 3])([1, 2, 3]) //=> true
2542
+ * @dataLast
2543
+ * @category Object
2544
+ */
2545
+ declare function equals(a: any): (b: any) => boolean;
2546
+
2547
+ type IndexedIteratee<T extends Record<PropertyKey, any>, K extends keyof T> = (value: T[K], key: K, obj: T) => void;
2548
+ type UnindexedIteratee<T extends Record<PropertyKey, any>> = (value: T[keyof T]) => void;
2549
+ /**
2550
+ * Iterate an object using a defined callback function. The original object is returned.
2551
+ * @param object The object.
2552
+ * @param fn The callback function.
2553
+ * @returns The original object
2554
+ * @signature
2555
+ * P.forEachObj(object, fn)
2556
+ * @example
2557
+ * P.forEachObj({a: 1}, (val) => {
2558
+ * console.log(`${val}`)
2559
+ * }) // "1"
2560
+ * P.forEachObj.indexed({a: 1}, (val, key, obj) => {
2561
+ * console.log(`${key}: ${val}`)
2562
+ * }) // "a: 1"
2563
+ * @dataFirst
2564
+ * @category Object
2565
+ */
2566
+ declare function forEachObj<T extends Record<PropertyKey, any>>(object: T, fn: UnindexedIteratee<T>): T;
2567
+ /**
2568
+ * Iterate an object using a defined callback function. The original object is returned.
2569
+ * @param fn The callback function.
2570
+ * @signature
2571
+ * P.forEachObj(fn)(object)
2572
+ * @example
2573
+ * P.pipe(
2574
+ * {a: 1},
2575
+ * P.forEachObj((val) => console.log(`${val}`))
2576
+ * ) // "1"
2577
+ * P.pipe(
2578
+ * {a: 1},
2579
+ * P.forEachObj.indexed((val, key) => console.log(`${key}: ${val}`))
2580
+ * ) // "a: 1"
2581
+ * @dataLast
2582
+ * @category Object
2583
+ */
2584
+ declare function forEachObj<T extends Record<PropertyKey, any>>(fn: UnindexedIteratee<T>): (object: T) => T;
2585
+ declare namespace forEachObj {
2586
+ function indexed<T extends Record<PropertyKey, any>>(object: T, fn: IndexedIteratee<T, keyof T>): T;
2587
+ function indexed<T extends Record<PropertyKey, any>>(fn: IndexedIteratee<T, keyof T>): (object: T) => T;
2588
+ }
2589
+
2590
+ type Entry<Key extends PropertyKey = PropertyKey, Value = unknown> = readonly [
2591
+ key: Key,
2592
+ value: Value
2593
+ ];
2594
+ type Strict$1 = <Entries extends IterableContainer<Entry>>(entries: Entries) => StrictOut<Entries>;
2595
+ type StrictOut<Entries> = Entries extends readonly [infer First, ...infer Tail] ? FromPairsTuple<First, Tail> : Entries extends readonly [...infer Head, infer Last] ? FromPairsTuple<Last, Head> : Entries extends IterableContainer<Entry> ? FromPairsArray<Entries> : 'ERROR: Entries array-like could not be infered';
2596
+ type FromPairsTuple<E, Rest> = E extends Entry ? Record<E[0], E[1]> & StrictOut<Rest> : 'ERROR: Array-like contains a non-entry element';
2597
+ type FromPairsArray<Entries extends IterableContainer<Entry>> = string extends AllKeys$1<Entries> ? Record<string, Entries[number][1]> : number extends AllKeys$1<Entries> ? Record<number, Entries[number][1]> : symbol extends AllKeys$1<Entries> ? Record<symbol, Entries[number][1]> : FromPairsArrayWithLiteralKeys<Entries>;
2598
+ type FromPairsArrayWithLiteralKeys<Entries extends IterableContainer<Entry>> = {
2599
+ [K in AllKeys$1<Entries>]?: ValueForKey<Entries, K>;
2600
+ };
2601
+ type AllKeys$1<Entries extends IterableContainer<Entry>> = Extract<Entries[number], Entry>[0];
2602
+ type ValueForKey<Entries extends IterableContainer<Entry>, K extends PropertyKey> = (Extract<Entries[number], Entry<K>> extends never ? Entries[number] : Extract<Entries[number], Entry<K>>)[1];
2603
+ /**
2604
+ * Creates a new object from an array of tuples by pairing up first and second elements as {[key]: value}.
2605
+ * If a tuple is not supplied for any element in the array, the element will be ignored
2606
+ * If duplicate keys exist, the tuple with the greatest index in the input array will be preferred.
2607
+ *
2608
+ * The strict option supports more sophisticated use-cases like those that would
2609
+ * result when calling the strict `toPairs` function.
2610
+ * @param pairs the list of input tuples
2611
+ * @signature
2612
+ * P.fromPairs(tuples)
2613
+ * P.fromPairs.strict(tuples)
2614
+ * @example
2615
+ * P.fromPairs([['a', 'b'], ['c', 'd']]) // => {a: 'b', c: 'd'} (type: Record<string, string>)
2616
+ * P.fromPairs.strict(['a', 1] as const) // => {a: 1} (type: {a: 1})
2617
+ * @category Object
2618
+ * @strict
2619
+ */
2620
+ declare function fromPairs<V>(pairs: ReadonlyArray<Entry<number, V>>): Record<number, V>;
2621
+ declare function fromPairs<V>(pairs: ReadonlyArray<Entry<string, V>>): Record<string, V>;
2622
+ declare namespace fromPairs {
2623
+ const strict: Strict$1;
2624
+ }
2625
+
2626
+ type Inverted<T extends object> = T[keyof T] extends PropertyKey ? Record<T[keyof T], keyof T> : never;
2627
+ /**
2628
+ * Returns an object whose keys are values are swapped. If the object contains duplicate values,
2629
+ * subsequent values will overwrite previous values.
2630
+ * @param object the object
2631
+ * @signature
2632
+ * P.invert(object)
2633
+ * @example
2634
+ * P.invert({ a: "d", b: "e", c: "f" }) // => { d: "a", e: "b", f: "c" }
2635
+ * @dataFirst
2636
+ * @category object
2637
+ * @pipeable
2638
+ */
2639
+ declare function invert<T extends object>(object: T): Inverted<T>;
2640
+ /**
2641
+ * Returns an object whose keys are values are swapped. If the object contains duplicate values,
2642
+ * subsequent values will overwrite previous values.
2643
+ * @param object the object
2644
+ * @signature
2645
+ * P.invert()(object)
2646
+ * @example
2647
+ * P.pipe({ a: "d", b: "e", c: "f" }, P.invert()); // => { d: "a", e: "b", f: "c" }
2648
+ * @dataLast
2649
+ * @category object
2650
+ * @pipeable
2651
+ */
2652
+ declare function invert<T extends object>(): (object: T) => Inverted<T>;
2653
+
2654
+ /**
2655
+ * Returns a new array containing the keys of the array or object.
2656
+ * @param source Either an array or an object
2657
+ * @signature
2658
+ * P.keys(source)
2659
+ * P.keys.strict(source)
2660
+ * @example
2661
+ * P.keys(['x', 'y', 'z']) // => ['0', '1', '2']
2662
+ * P.keys({ a: 'x', b: 'y', c: 'z' }) // => ['a', 'b', 'c']
2663
+ * P.pipe(
2664
+ * { a: 'x', b: 'y', c: 'z' },
2665
+ * P.keys,
2666
+ * P.first
2667
+ * ) // => 'a'
2668
+ * P.keys.strict({ a: 'x', b: 'y', 5: 'z' } as const ) // => ['a', 'b', '5'], typed Array<'a' | 'b' | '5'>
2669
+ * @pipeable
2670
+ * @strict
2671
+ * @category Object
2672
+ */
2673
+
2674
+ type Strict = <T extends object>(source: T) => Keys<T>;
2675
+ type Keys<T> = T extends IterableContainer ? ArrayKeys<T> : ObjectKeys$1<T>;
2676
+ type ArrayKeys<T extends IterableContainer> = {
2677
+ -readonly [Index in keyof T]: Index extends string | number ? `${IsIndexAfterSpread<T, Index> extends true ? number : Index}` : never;
2678
+ };
2679
+ type IsIndexAfterSpread<T extends IterableContainer, Index extends string | number> = IndicesAfterSpread<T> extends never ? false : Index extends `${IndicesAfterSpread<T>}` ? true : false;
2680
+ type IndicesAfterSpread<T extends ReadonlyArray<unknown> | [], Iterations extends ReadonlyArray<unknown> = []> = T[number] extends never ? never : T extends readonly [unknown, ...infer Tail] ? IndicesAfterSpread<Tail, [unknown, ...Iterations]> : T extends readonly [...infer Head, unknown] ? IndicesAfterSpread<Head, [unknown, ...Iterations]> | Iterations['length'] : Iterations['length'];
2681
+ type ObjectKeys$1<T> = T extends Record<PropertyKey, never> ? [] : Array<`${Exclude<keyof T, symbol>}`>;
2682
+ declare function keys(source: Record<PropertyKey, unknown> | ArrayLike<unknown>): Array<string>;
2683
+ declare namespace keys {
2684
+ const strict: Strict;
2685
+ }
2686
+
2687
+ /**
2688
+ * Maps keys of `object` and keeps the same values.
2689
+ * @param object the object to map
2690
+ * @param fn the mapping function
2691
+ * @signature
2692
+ * P.mapKeys(object, fn)
2693
+ * @example
2694
+ * P.mapKeys({a: 1, b: 2}, (key, value) => key + value) // => { a1: 1, b2: 2 }
2695
+ * @dataFirst
2696
+ * @category Object
2697
+ */
2698
+ declare function mapKeys<T, S extends keyof any>(object: T, fn: (key: keyof T, value: T[keyof T]) => S): Record<S, T[keyof T]>;
2699
+ /**
2700
+ * Maps keys of `object` and keeps the same values.
2701
+ * @param fn the mapping function
2702
+ * @signature
2703
+ * P.mapKeys(fn)(object)
2704
+ * @example
2705
+ * P.pipe({a: 1, b: 2}, P.mapKeys((key, value) => key + value)) // => { a1: 1, b2: 2 }
2706
+ * @dataLast
2707
+ * @category Object
2708
+ */
2709
+ declare function mapKeys<T, S extends keyof any>(fn: (key: keyof T, value: T[keyof T]) => S): (object: T) => Record<S, T[keyof T]>;
2710
+
2711
+ /**
2712
+ * Maps values of `object` and keeps the same keys.
2713
+ * @param object the object to map
2714
+ * @param fn the mapping function
2715
+ * @signature
2716
+ * P.mapValues(object, fn)
2717
+ * @example
2718
+ * P.mapValues({a: 1, b: 2}, (value, key) => value + key) // => {a: '1a', b: '2b'}
2719
+ * @dataFirst
2720
+ * @category Object
2721
+ */
2722
+ declare function mapValues<T extends Record<PropertyKey, any>, S>(object: T, fn: (value: T[keyof T], key: keyof T) => S): Record<keyof T, S>;
2723
+ /**
2724
+ * Maps values of `object` and keeps the same keys.
2725
+ * @param fn the mapping function
2726
+ * @signature
2727
+ * P.mapValues(fn)(object)
2728
+ * @example
2729
+ * P.pipe({a: 1, b: 2}, P.mapValues((value, key) => value + key)) // => {a: '1a', b: '2b'}
2730
+ * @dataLast
2731
+ * @category Object
2732
+ */
2733
+ declare function mapValues<T extends Record<PropertyKey, any>, S>(fn: (value: T[keyof T], key: keyof T) => S): (object: T) => Record<keyof T, S>;
2734
+
2735
+ /**
2736
+ * Merges two objects. The same as `Object.assign`.
2737
+ * `b` object will override properties of `a`.
2738
+ * @param a the first object
2739
+ * @param b the second object
2740
+ * @signature
2741
+ * P.merge(a, b)
2742
+ * @example
2743
+ * P.merge({ x: 1, y: 2 }, { y: 10, z: 2 }) // => { x: 1, y: 10, z: 2 }
2744
+ * @dataFirst
2745
+ * @category Object
2746
+ */
2747
+ declare function merge<A, B>(a: A, b: B): A & B;
2748
+ /**
2749
+ * Merges two objects. The same as `Object.assign`. `b` object will override properties of `a`.
2750
+ * @param b the second object
2751
+ * @signature
2752
+ * P.merge(b)(a)
2753
+ * @example
2754
+ * P.merge({ y: 10, z: 2 })({ x: 1, y: 2 }) // => { x: 1, y: 10, z: 2 }
2755
+ * @dataLast
2756
+ * @category Object
2757
+ */
2758
+ declare function merge<A, B>(b: B): (a: A) => A & B;
2759
+
2760
+ /**
2761
+ * Returns a partial copy of an object omitting the keys specified.
2762
+ * @param data the object
2763
+ * @param propNames the property names
2764
+ * @signature
2765
+ * P.omit(obj, names);
2766
+ * @example
2767
+ * P.omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { b: 2, c: 3 }
2768
+ * @dataFirst
2769
+ * @category Object
2770
+ */
2771
+ declare function omit<T extends object, K extends keyof T>(data: T, propNames: ReadonlyArray<K>): Omit<T, K>;
2772
+ /**
2773
+ * Returns a partial copy of an object omitting the keys specified.
2774
+ * @param data the object
2775
+ * @param propNames the property names
2776
+ * @signature
2777
+ * P.omit(names)(obj);
2778
+ * @example
2779
+ * P.pipe({ a: 1, b: 2, c: 3, d: 4 }, P.omit(['a', 'd'])) // => { b: 2, c: 3 }
2780
+ * @dataLast
2781
+ * @category Object
2782
+ */
2783
+ declare function omit<K extends PropertyKey>(propNames: ReadonlyArray<K>): <T extends object>(data: T) => Omit<T, K>;
2784
+
2785
+ /**
2786
+ * Returns a partial copy of an object omitting the keys matching predicate.
2787
+ * @param object the target object
2788
+ * @param fn the predicate
2789
+ * @signature P.omitBy(object, fn)
2790
+ * @example
2791
+ * P.omitBy({a: 1, b: 2, A: 3, B: 4}, (val, key) => key.toUpperCase() === key) // => {a: 1, b: 2}
2792
+ * @dataFirst
2793
+ * @category Object
2794
+ */
2795
+ declare function omitBy<T>(object: T, fn: <K extends keyof T>(value: T[K], key: K) => boolean): T extends Record<keyof T, T[keyof T]> ? T : Partial<T>;
2796
+ /**
2797
+ * Returns a partial copy of an object omitting the keys matching predicate.
2798
+ * @param fn the predicate
2799
+ * @signature P.omitBy(fn)(object)
2800
+ * @example
2801
+ * P.omitBy((val, key) => key.toUpperCase() === key)({a: 1, b: 2, A: 3, B: 4}) // => {a: 1, b: 2}
2802
+ * @dataLast
2803
+ * @category Object
2804
+ */
2805
+ declare function omitBy<T>(fn: <K extends keyof T>(value: T[K], key: K) => boolean): (object: T) => T extends Record<keyof T, T[keyof T]> ? T : Partial<T>;
2806
+
2807
+ /**
2808
+ * Given a union of indexable types `T`, we derive an indexable type
2809
+ * containing all of the keys of each variant of `T`. If a key is
2810
+ * present in multiple variants of `T`, then the corresponding type in
2811
+ * `Pathable<T>` will be the intersection of all types for that key.
2812
+ * @example
2813
+ * type T1 = Pathable<{a: number} | {a: string; b: boolean}>
2814
+ * // {a: number | string; b: boolean}
2815
+ *
2816
+ * type T2 = Pathable<{a?: {b: string}}
2817
+ * // {a: {b: string} | undefined}
2818
+ *
2819
+ * type T3 = Pathable<{a: string} | number>
2820
+ * // {a: string}
2821
+ *
2822
+ * type T4 = Pathable<{a: number} | {a: string} | {b: boolean}>
2823
+ * // {a: number | string; b: boolean}
2824
+ *
2825
+ * This type lets us answer the questions:
2826
+ * - Given some object of type `T`, what keys might this object have?
2827
+ * - If this object did happen to have a particular key, what values
2828
+ * might that key have?
2829
+ */
2830
+ type Pathable<T> = {
2831
+ [K in AllKeys<T>]: TypesForKey<T, K>;
2832
+ };
2833
+ type AllKeys<T> = T extends infer I ? keyof I : never;
2834
+ type TypesForKey<T, K extends PropertyKey> = T extends infer I ? K extends keyof I ? I[K] : never : never;
2835
+ type StrictlyRequired<T> = {
2836
+ [K in keyof T]-?: NonNullable<T[K]>;
2837
+ };
2838
+ /**
2839
+ * Given some `A` which is a key of at least one variant of `T`, derive
2840
+ * `T[A]` for the cases where `A` is present in `T`, and `T[A]` is not
2841
+ * null or undefined.
2842
+ */
2843
+ type PathValue1<T, A extends keyof Pathable<T>> = StrictlyRequired<Pathable<T>>[A];
2844
+ /** All possible options after successfully reaching `T[A]` */
2845
+ type Pathable1<T, A extends keyof Pathable<T>> = Pathable<PathValue1<T, A>>;
2846
+ /** As `PathValue1`, but for `T[A][B]` */
2847
+ type PathValue2<T, A extends keyof Pathable<T>, B extends keyof Pathable1<T, A>> = StrictlyRequired<Pathable1<T, A>>[B];
2848
+ /** As `Pathable1`, but for `T[A][B]` */
2849
+ type Pathable2<T, A extends keyof Pathable<T>, B extends keyof Pathable1<T, A>> = Pathable<PathValue2<T, A, B>>;
2850
+ /** As `PathValue1`, but for `T[A][B][C]` */
2851
+ type PathValue3<T, A extends keyof Pathable<T>, B extends keyof Pathable1<T, A>, C extends keyof Pathable2<T, A, B>> = StrictlyRequired<Pathable2<T, A, B>>[C];
2852
+ /**
2853
+ * Gets the value at `path` of `object`. If the resolved value is `undefined`, the `defaultValue` is returned in its place.
2854
+ * @param object the target object
2855
+ * @param path the path of the property to get
2856
+ * @param defaultValue the default value
2857
+ * @signature P.pathOr(object, array, defaultValue)
2858
+ * @example
2859
+ * P.pathOr({x: 10}, ['y'], 2) // 2
2860
+ * P.pathOr({y: 10}, ['y'], 2) // 10
2861
+ * @dataFirst
2862
+ * @category Object
2863
+ */
2864
+ declare function pathOr<T, A extends keyof Pathable<T>>(object: T, path: readonly [A], defaultValue: PathValue1<T, A>): PathValue1<T, A>;
2865
+ declare function pathOr<T, A extends keyof Pathable<T>, B extends keyof Pathable1<T, A>>(object: T, path: readonly [A, B], defaultValue: PathValue2<T, A, B>): PathValue2<T, A, B>;
2866
+ declare function pathOr<T, A extends keyof Pathable<T>, B extends keyof Pathable1<T, A>, C extends keyof Pathable2<T, A, B>>(object: T, path: readonly [A, B, C], defaultValue: PathValue3<T, A, B, C>): PathValue3<T, A, B, C>;
2867
+ /**
2868
+ * Gets the value at `path` of `object`. If the resolved value is `undefined`, the `defaultValue` is returned in its place.
2869
+ * @param object the target object
2870
+ * @param path the path of the property to get
2871
+ * @param defaultValue the default value
2872
+ * @signature P.pathOr(array, defaultValue)(object)
2873
+ * @example
2874
+ * P.pipe({x: 10}, P.pathOr(['y'], 2)) // 2
2875
+ * P.pipe({y: 10}, P.pathOr(['y'], 2)) // 10
2876
+ * @dataLast
2877
+ * @category Object
2878
+ */
2879
+ declare function pathOr<T, A extends keyof Pathable<T>>(path: readonly [A], defaultValue: PathValue1<T, A>): (object: T) => PathValue1<T, A>;
2880
+ declare function pathOr<T, A extends keyof Pathable<T>, B extends keyof Pathable1<T, A>>(path: readonly [A, B], defaultValue: PathValue2<T, A, B>): (object: T) => PathValue2<T, A, B>;
2881
+ declare function pathOr<T, A extends keyof Pathable<T>, B extends keyof Pathable1<T, A>, C extends keyof Pathable2<T, A, B>>(path: readonly [A, B, C], defaultValue: PathValue3<T, A, B, C>): (object: T) => PathValue3<T, A, B, C>;
2882
+
2883
+ /**
2884
+ * Creates an object composed of the picked `object` properties.
2885
+ * @param object the target object
2886
+ * @param names the properties names
2887
+ * @signature P.pick(object, [prop1, prop2])
2888
+ * @example
2889
+ * P.pick({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { a: 1, d: 4 }
2890
+ * @dataFirst
2891
+ * @category Object
2892
+ */
2893
+ declare function pick<T extends object, K extends keyof T>(object: T, names: ReadonlyArray<K>): Pick<T, K>;
2894
+ /**
2895
+ * Creates an object composed of the picked `object` properties.
2896
+ * @param names the properties names
2897
+ * @signature P.pick([prop1, prop2])(object)
2898
+ * @example
2899
+ * P.pipe({ a: 1, b: 2, c: 3, d: 4 }, P.pick(['a', 'd'])) // => { a: 1, d: 4 }
2900
+ * @dataLast
2901
+ * @category Object
2902
+ */
2903
+ declare function pick<K extends PropertyKey>(names: ReadonlyArray<K>): <T extends Record<PropertyKey, any>>(object: T) => Pick<T, K>;
2904
+
2905
+ /**
2906
+ * Creates an object composed of the picked `object` properties.
2907
+ * @param object the target object
2908
+ * @param fn the predicate
2909
+ * @signature P.pickBy(object, fn)
2910
+ * @example
2911
+ * P.pickBy({a: 1, b: 2, A: 3, B: 4}, (val, key) => key.toUpperCase() === key) // => {A: 3, B: 4}
2912
+ * @dataFirst
2913
+ * @category Object
2914
+ */
2915
+ declare function pickBy<T>(object: T, fn: <K extends keyof T>(value: T[K], key: K) => boolean): T extends Record<keyof T, T[keyof T]> ? T : Partial<T>;
2916
+ /**
2917
+ * Creates an object composed of the picked `object` properties.
2918
+ * @param fn the predicate
2919
+ * @signature P.pickBy(fn)(object)
2920
+ * @example
2921
+ * P.pickBy((val, key) => key.toUpperCase() === key)({a: 1, b: 2, A: 3, B: 4}) // => {A: 3, B: 4}
2922
+ * @dataLast
2923
+ * @category Object
2924
+ */
2925
+ declare function pickBy<T>(fn: <K extends keyof T>(value: T[K], key: K) => boolean): (object: T) => T extends Record<keyof T, T[keyof T]> ? T : Partial<T>;
2926
+
2927
+ /**
2928
+ * Gets the value of the given property.
2929
+ * @param propName the property name
2930
+ * @signature P.prop(prop)(object)
2931
+ * @example
2932
+ * P.pipe({foo: 'bar'}, P.prop('foo')) // => 'bar'
2933
+ * @dataLast
2934
+ * @category Object
2935
+ */
2936
+ declare function prop<T, K extends keyof T>(propName: K): ({ [propName]: value }: T) => T[K];
2937
+
2938
+ /**
2939
+ * Sets the `value` at `prop` of `object`.
2940
+ * @param obj the target method
2941
+ * @param prop the property name
2942
+ * @param value the value to set
2943
+ * @signature
2944
+ * P.set(obj, prop, value)
2945
+ * @example
2946
+ * P.set({ a: 1 }, 'a', 2) // => { a: 2 }
2947
+ * @dataFirst
2948
+ * @category Object
2949
+ */
2950
+ declare function set<T, K extends keyof T>(obj: T, prop: K, value: T[K]): T;
2951
+ /**
2952
+ * Sets the `value` at `prop` of `object`.
2953
+ * @param prop the property name
2954
+ * @param value the value to set
2955
+ * @signature
2956
+ * P.set(prop, value)(obj)
2957
+ * @example
2958
+ * P.pipe({ a: 1 }, P.set('a', 2)) // => { a: 2 }
2959
+ * @dataLast
2960
+ * @category Object
2961
+ */
2962
+ declare function set<T, K extends keyof T>(prop: K, value: T[K]): (obj: T) => T;
2963
+
2964
+ type Path<Obj, Prefix extends Array<PropertyKey> = []> = Obj extends Primitive ? Prefix : Obj extends Array<infer Item> ? Prefix | Path<Item, [...Prefix, number]> : Prefix | PathsOfObject<Obj, Prefix>;
2965
+ type PathsOfObject<Obj, Prefix extends Array<PropertyKey>> = {
2966
+ [K in keyof Obj]: Path<Obj[K], [...Prefix, K]>;
2967
+ }[keyof Obj];
2968
+ type ValueAtPath<Obj, ObjPath extends Array<PropertyKey> = []> = ObjPath extends [] ? Obj : ObjPath extends [infer Head, ...infer Tail] ? Tail extends Array<PropertyKey> ? Head extends keyof Obj ? ValueAtPath<Obj[Head], Tail> : never : never : never;
2969
+ type SupportsValueAtPath<Obj, Path extends Array<PropertyKey>, Value> = Value extends ValueAtPath<Obj, Path> ? Obj : never;
2970
+ type Primitive = string | number | boolean | null | undefined | symbol;
2971
+
2972
+ /**
2973
+ * Copied from ts-toolbelt
2974
+ * https://github.com/millsp/ts-toolbelt/blob/master/sources/Function/Narrow.ts
2975
+ */
2976
+ /**
2977
+ * Similar to [[Cast]] but with a custom fallback `Catch`. If it fails,
2978
+ * it will enforce `Catch` instead of `A2`.
2979
+ * @param A1 to check against
2980
+ * @param A2 to try/test with
2981
+ * @param Catch to fallback to if the test failed
2982
+ * @returns `A1 | Catch`
2983
+ * @example
2984
+ * ```ts
2985
+ * import {A} from 'ts-toolbelt'
2986
+ *
2987
+ * type test0 = A.Try<'42', string> // '42'
2988
+ * type test1 = A.Try<'42', number> // never
2989
+ * type test1 = A.Try<'42', number, 'tried'> // 'tried'
2990
+ * ```
2991
+ */
2992
+ type Try<A1, A2, Catch = never> = A1 extends A2 ? A1 : Catch;
2993
+ /**
2994
+ * Describes types that can be narrowed
2995
+ */
2996
+ type Narrowable = string | number | bigint | boolean;
2997
+ /**
2998
+ * @hidden
2999
+ */
3000
+ type NarrowRaw<A> = (A extends [] ? [] : never) | (A extends Narrowable ? A : never) | {
3001
+ [K in keyof A]: A[K] extends (...args: Array<any>) => any ? A[K] : NarrowRaw<A[K]>;
3002
+ };
3003
+ /**
3004
+ * Prevent type widening on generic function parameters
3005
+ * @param A to narrow
3006
+ * @returns `A`
3007
+ * @example
3008
+ * ```ts
3009
+ * import {F} from 'ts-toolbelt'
3010
+ *
3011
+ * declare function foo<A extends any[]>(x: F.Narrow<A>): A;
3012
+ * declare function bar<A extends object>(x: F.Narrow<A>): A;
3013
+ *
3014
+ * const test0 = foo(['e', 2, true, {f: ['g', ['h']]}])
3015
+ * // `A` inferred : ['e', 2, true, {f: ['g']}]
3016
+ *
3017
+ * const test1 = bar({a: 1, b: 'c', d: ['e', 2, true, {f: ['g']}]})
3018
+ * // `A` inferred : {a: 1, b: 'c', d: ['e', 2, true, {f: ['g']}]}
3019
+ * ```
3020
+ */
3021
+ type Narrow<A> = Try<A, [], NarrowRaw<A>>;
3022
+
3023
+ /**
3024
+ * Sets the value at `path` of `object`. `path` can be an array or a path string.
3025
+ * @param object the target method
3026
+ * @param path the property name
3027
+ * @param value the value to set
3028
+ * @signature
3029
+ * P.setPath(obj, path, value)
3030
+ * @example
3031
+ * P.setPath({ a: { b: 1 } }, ['a', 'b'], 2) // => { a: { b: 2 } }
3032
+ * @dataFirst
3033
+ * @category Object
3034
+ */
3035
+ declare function setPath<T, TPath extends Array<PropertyKey> & Path<T>>(object: T, path: Narrow<TPath>, value: ValueAtPath<T, TPath>): T;
3036
+ /**
3037
+ * Sets the value at `path` of `object`. `path` can be an array or a path string.
3038
+ * @param obj the target method
3039
+ * @param path the property name
3040
+ * @param value the value to set
3041
+ * @signature
3042
+ * P.setPath(obj, path, value)
3043
+ * @example
3044
+ * P.pipe({ a: { b: 1 } }, P.setPath(['a', 'b'], 2)) // { a: { b: 2 } }
3045
+ * @dataFirst
3046
+ * @category Object
3047
+ */
3048
+ declare function setPath<TPath extends Array<PropertyKey>, Value>(path: Narrow<TPath>, value: Value): <Obj>(object: SupportsValueAtPath<Obj, TPath, Value>) => Obj;
3049
+ declare function _setPath(object: any, path: Array<any>, defaultValue: any): any;
3050
+
3051
+ type SwappedProps<T, K1 extends keyof T, K2 extends keyof T> = {
3052
+ [K in keyof T]: T[K1 extends K ? K2 : K2 extends K ? K1 : K];
3053
+ };
3054
+ /**
3055
+ * Swaps the positions of two properties in an object based on the provided keys.
3056
+ *
3057
+ * @param data the object to be manipulated
3058
+ * @param key1 the first property key
3059
+ * @param key2 the second property key
3060
+ *
3061
+ * @signature
3062
+ * swap(data, key1, key2)
3063
+ *
3064
+ * @returns Returns the manipulated object.
3065
+ *
3066
+ * @example
3067
+ * swap({a: 1, b: 2, c: 3}, 'a', 'b') // => {a: 2, b: 1, c: 3}
3068
+ *
3069
+ * @category Object
3070
+ *
3071
+ * @dataFirst
3072
+ */
3073
+ declare function swapProps<T extends object, K1 extends keyof T, K2 extends keyof T>(data: T, key1: K1, key2: K2): SwappedProps<T, K1, K2>;
3074
+ /**
3075
+ * Swaps the positions of two properties in an object based on the provided keys.
3076
+ *
3077
+ * @param key1 the first property key
3078
+ * @param key2 the second property key
3079
+ *
3080
+ * @signature
3081
+ * swap(key1, key2)(data)
3082
+ *
3083
+ * @example
3084
+ * swap('a', 'b')({a: 1, b: 2, c: 3}) // => {a: 2, b: 1, c: 3}
3085
+ *
3086
+ * @returns Returns the manipulated object.
3087
+ *
3088
+ * @category Object
3089
+ *
3090
+ * @dataLast
3091
+ */
3092
+ declare function swapProps<T extends object, K1 extends keyof T, K2 extends keyof T>(key1: K1, key2: K2): (data: T) => SwappedProps<T, K1, K2>;
3093
+
3094
+ type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;
3095
+ type ObjectValues<T extends Record<PropertyKey, unknown>> = Required<T>[ObjectKeys<T>];
3096
+ type ObjectEntry<T extends Record<PropertyKey, unknown>> = [
3097
+ ObjectKeys<T>,
3098
+ ObjectValues<T>
3099
+ ];
3100
+ type ObjectEntries<T extends Record<PropertyKey, unknown>> = Array<ObjectEntry<T>>;
3101
+ /**
3102
+ * Returns an array of key/values of the enumerable properties of an object.
3103
+ * @param object
3104
+ * @signature
3105
+ * P.toPairs(object)
3106
+ * P.toPairs.strict(object)
3107
+ * @example
3108
+ * P.toPairs({ a: 1, b: 2, c: 3 }) // => [['a', 1], ['b', 2], ['c', 3]]
3109
+ * P.toPairs.strict({ a: 1 } as const) // => [['a', 1]] typed Array<['a', 1]>
3110
+ * @strict
3111
+ * @category Object
3112
+ */
3113
+ declare function toPairs<T>(object: Record<string, T>): Array<[string, T]>;
3114
+ declare namespace toPairs {
3115
+ function strict<T extends Record<PropertyKey, unknown>>(object: T): ObjectEntries<T>;
3116
+ }
3117
+
3118
+ /**
3119
+ * Returns a new array containing the values of the array or object.
3120
+ * @param source Either an array or an object
3121
+ * @signature
3122
+ * P.values(source)
3123
+ * @example
3124
+ * P.values(['x', 'y', 'z']) // => ['x', 'y', 'z']
3125
+ * P.values({ a: 'x', b: 'y', c: 'z' }) // => ['x', 'y', 'z']
3126
+ * P.pipe(
3127
+ * { a: 'x', b: 'y', c: 'z' },
3128
+ * P.values,
3129
+ * P.first
3130
+ * ) // => 'x'
3131
+ * @pipeable
3132
+ * @category Object
3133
+ */
3134
+ declare function values<T>(source: Record<PropertyKey, T> | ArrayLike<T>): Array<T>;
3135
+
3136
+ type Splitter = '-' | '_' | '/' | '.';
3137
+ type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
3138
+ type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
3139
+ type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
3140
+ type IsLower<S extends string> = S extends Lowercase<S> ? true : false;
3141
+ type SameLetterCase<X extends string, Y extends string> = IsUpper<X> extends IsUpper<Y> ? true : IsLower<X> extends IsLower<Y> ? true : false;
3142
+ type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
3143
+ type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
3144
+ type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends '' ? SplitByCase<R, Separator, [
3145
+ ...RemoveLastOfArray<Accumulator>,
3146
+ `${LastOfArray<Accumulator>}${F}`
3147
+ ]> : SameLetterCase<F, FirstOfString<R>> extends true ? F extends Separator ? FirstOfString<R> extends Separator ? SplitByCase<R, Separator, [...Accumulator, '']> : IsUpper<FirstOfString<R>> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
3148
+ ...Accumulator,
3149
+ FirstOfString<R>
3150
+ ]> : SplitByCase<R, Separator, [...Accumulator, '']> : SplitByCase<R, Separator, [
3151
+ ...RemoveLastOfArray<Accumulator>,
3152
+ `${LastOfArray<Accumulator>}${F}`
3153
+ ]> : IsLower<F> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
3154
+ ...RemoveLastOfArray<Accumulator>,
3155
+ `${LastOfArray<Accumulator>}${F}`,
3156
+ FirstOfString<R>
3157
+ ]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends '' ? [] : string[] : Accumulator;
3158
+ type CapitalizedWords<T extends readonly string[], Accumulator extends string = ''> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<F>}`> : Accumulator;
3159
+ type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ''> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends '' ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
3160
+ type PascalCase<T> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>> : never : T extends readonly string[] ? CapitalizedWords<T> : never;
3161
+ type CamelCase<T> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T>>;
3162
+ type JoinByCase<T, Joiner extends string> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? JoinLowercaseWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? JoinLowercaseWords<T, Joiner> : never;
3163
+
3164
+ declare function isUppercase(char?: string): boolean | undefined;
3165
+ declare function splitByCase<T extends string>(string_: T): SplitByCase<T>;
3166
+ declare function splitByCase<T extends string, Separator extends readonly string[]>(string_: T, separators: Separator): SplitByCase<T, Separator[number]>;
3167
+ declare function toUpperFirst<S extends string>(string_: S): Capitalize<S>;
3168
+ declare function toLowerFirst<S extends string>(string_: S): Uncapitalize<S>;
3169
+ declare function toPascalCase(): '';
3170
+ declare function toPascalCase<T extends string | readonly string[]>(string_?: T): PascalCase<T>;
3171
+ declare function toCamelCase(): '';
3172
+ declare function toCamelCase<T extends string | readonly string[]>(string_?: T): CamelCase<T>;
3173
+ declare function toKebabCase(): '';
3174
+ declare function toKebabCase<T extends string | readonly string[]>(string_?: T): JoinByCase<T, '-'>;
3175
+ declare function toKebabCase<T extends string | readonly string[], Joiner extends string>(string_: T, joiner: Joiner): JoinByCase<T, Joiner>;
3176
+ declare function toSnakeCase(): '';
3177
+ declare function toSnakeCase<T extends string | readonly string[]>(string_?: T): JoinByCase<T, '_'>;
3178
+
3179
+ /**
3180
+ * Random a non-cryptographic random string from characters a-zA-Z0-9.
3181
+ * @param length the length of the random string
3182
+ * @signature randomString(length)
3183
+ * @example
3184
+ * randomString(5) // => aB92J
3185
+ * @category String
3186
+ */
3187
+ declare function randomString(length: number): string;
3188
+
3189
+ /**
3190
+ * Converts a path string to an array of keys.
3191
+ * @param path a string path
3192
+ * @signature P.stringToPathArray(path)
3193
+ * @example P.stringToPathArray('a.b[0].c') // => ['a', 'b', 0, 'c']
3194
+ * @dataFirst
3195
+ * @category String
3196
+ */
3197
+ declare function stringToPath<Path extends string>(path: Path): StringToPath<Path>;
3198
+ type StringToPath<T extends string> = T extends '' ? [] : T extends `[${infer Head}].${infer Tail}` ? [Head, ...StringToPath<Tail>] : T extends `.${infer Head}${infer Tail}` ? [Head, ...StringToPath<Tail>] : T extends `${infer Head}${infer Tail}` ? [Head, ...StringToPath<Tail>] : [T];
3199
+
3200
+ /**
3201
+ * Gives a single-word string description of the (native) type of a value, returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not attempt to distinguish user Object types any further, reporting them all as 'Object'.
3202
+ * @param val
3203
+ * @signature
3204
+ * P.type(obj)
3205
+ * @example
3206
+ * P.type({}); //=> "Object"
3207
+ * P.type(1); //=> "Number"
3208
+ * P.type(false); //=> "Boolean"
3209
+ * P.type('s'); //=> "String"
3210
+ * P.type(null); //=> "Null"
3211
+ * P.type([]); //=> "Array"
3212
+ * P.type(/[A-z]/); //=> "RegExp"
3213
+ * P.type(() => {}); //=> "Function"
3214
+ * P.type(undefined); //=> "Undefined"
3215
+ * @category Type
3216
+ */
3217
+ declare function type(val: any): string;
3218
+
3219
+ declare const isBrowser: boolean;
3220
+
3221
+ export { Joined, KEY_CODES, StringToPath, _setPath, addProp, allPass, anyPass, chunk, clamp, clone, compact, concat, convertToUnit, countBy, createPipe, difference, differenceWith, drop, dropLast, equals, filter, find, findIndex, findLast, findLastIndex, first, flatMap, flatMapToObj, flatten, flattenDeep, forEach, forEachObj, fromPairs, groupBy, humanReadableFileSize, identity, increaseWithUnit, indexBy, intersection, intersectionWith, invert, isArray, isBoolean, isBrowser, isDate, isDefined, isEmpty, isError, isFunction, isNil, isNonNull, isNot, isNumber, isObject, isPromise, isString, isTruthy, isUppercase, join, keys, last, length, map, mapKeys, mapToObj, mapValues, maxBy, meanBy, merge, mergeAll, minBy, noop, omit, omitBy, once, partition, pathOr, pick, pickBy, pipe, prop, purry, randomString, range, reduce, reject, reverse, sample, set, setPath, shuffle, sleep, sort, sortBy, splitAt, splitByCase, splitWhen, stringToPath, sumBy, swapIndices, swapProps, take, takeWhile, toCamelCase, toKebabCase, toLowerFirst, toPairs, toPascalCase, toSnakeCase, toUpperFirst, type, uniq, uniqBy, uniqWith, values, zip, zipObj, zipWith };