type-plus 7.3.1 → 7.5.0

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 (376) hide show
  1. package/README.md +146 -183
  2. package/cjs/any/any_type.d.ts +8 -8
  3. package/cjs/any/any_type.d.ts.map +1 -1
  4. package/cjs/array/array.at.d.ts +3 -1
  5. package/cjs/array/array.at.d.ts.map +1 -1
  6. package/cjs/array/array.entries.d.ts +4 -3
  7. package/cjs/array/array.entries.d.ts.map +1 -1
  8. package/cjs/array/array.find_last.d.ts +3 -1
  9. package/cjs/array/array.find_last.d.ts.map +1 -1
  10. package/cjs/array/array.some.d.ts +1 -1
  11. package/cjs/array/array.some.d.ts.map +1 -1
  12. package/cjs/array/array_plus.common_prop_keys.d.ts +27 -0
  13. package/cjs/array/array_plus.common_prop_keys.d.ts.map +1 -0
  14. package/cjs/array/array_plus.common_prop_keys.js +3 -0
  15. package/cjs/array/array_plus.common_prop_keys.js.map +1 -0
  16. package/cjs/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
  17. package/cjs/array/array_plus.concat.d.ts.map +1 -0
  18. package/cjs/array/array_plus.concat.js +3 -0
  19. package/cjs/array/array_plus.concat.js.map +1 -0
  20. package/cjs/array/array_plus.d.ts +7 -3
  21. package/cjs/array/array_plus.d.ts.map +1 -1
  22. package/cjs/array/array_plus.drop_match.d.ts +4 -0
  23. package/cjs/array/array_plus.drop_match.d.ts.map +1 -0
  24. package/cjs/array/array_plus.drop_match.js +3 -0
  25. package/cjs/array/array_plus.drop_match.js.map +1 -0
  26. package/cjs/array/array_plus.element_match.d.ts +44 -0
  27. package/cjs/array/array_plus.element_match.d.ts.map +1 -0
  28. package/cjs/array/array_plus.element_match.js +3 -0
  29. package/cjs/array/array_plus.element_match.js.map +1 -0
  30. package/cjs/array/array_plus.filter.d.ts +2 -0
  31. package/cjs/array/array_plus.filter.d.ts.map +1 -0
  32. package/cjs/array/array_plus.filter.js +3 -0
  33. package/cjs/array/array_plus.filter.js.map +1 -0
  34. package/cjs/array/array_plus.find.d.ts +57 -0
  35. package/cjs/array/array_plus.find.d.ts.map +1 -0
  36. package/cjs/array/array_plus.find.js +3 -0
  37. package/cjs/array/array_plus.find.js.map +1 -0
  38. package/cjs/array/array_plus.pad_start.d.ts +5 -0
  39. package/cjs/array/array_plus.pad_start.d.ts.map +1 -0
  40. package/cjs/array/array_plus.pad_start.js +3 -0
  41. package/cjs/array/array_plus.pad_start.js.map +1 -0
  42. package/cjs/array/array_type.d.ts +30 -12
  43. package/cjs/array/array_type.d.ts.map +1 -1
  44. package/cjs/array/filter.d.ts +24 -4
  45. package/cjs/array/filter.d.ts.map +1 -1
  46. package/cjs/array/find_first.d.ts +62 -0
  47. package/cjs/array/find_first.d.ts.map +1 -0
  48. package/cjs/array/{array.find.js → find_first.js} +1 -1
  49. package/cjs/array/find_first.js.map +1 -0
  50. package/cjs/array/head.d.ts +30 -1
  51. package/cjs/array/head.d.ts.map +1 -1
  52. package/cjs/array/intersect_of_props.d.ts +5 -3
  53. package/cjs/array/intersect_of_props.d.ts.map +1 -1
  54. package/cjs/array/last.d.ts +27 -2
  55. package/cjs/array/last.d.ts.map +1 -1
  56. package/cjs/array/literal_array.d.ts +5 -0
  57. package/cjs/array/literal_array.d.ts.map +1 -1
  58. package/cjs/array/literal_array.js +5 -0
  59. package/cjs/array/literal_array.js.map +1 -1
  60. package/cjs/array/pad_start.d.ts +5 -5
  61. package/cjs/array/pad_start.d.ts.map +1 -1
  62. package/cjs/array/reduce_while.d.ts +6 -0
  63. package/cjs/array/reduce_while.d.ts.map +1 -1
  64. package/cjs/array/reduce_while.js +6 -0
  65. package/cjs/array/reduce_while.js.map +1 -1
  66. package/cjs/array/reverse.d.ts +5 -0
  67. package/cjs/array/reverse.d.ts.map +1 -1
  68. package/cjs/array/union_of_props.d.ts +1 -1
  69. package/cjs/array/union_of_props.d.ts.map +1 -1
  70. package/cjs/assertion/assert_type.d.ts +4 -1
  71. package/cjs/assertion/assert_type.d.ts.map +1 -1
  72. package/cjs/assertion/assert_type.js.map +1 -1
  73. package/cjs/functional/compose.d.ts +2 -1
  74. package/cjs/functional/compose.d.ts.map +1 -1
  75. package/cjs/functional/compose.js.map +1 -1
  76. package/cjs/functional/context.d.ts.map +1 -1
  77. package/cjs/index.d.ts +22 -3
  78. package/cjs/index.d.ts.map +1 -1
  79. package/cjs/index.js +9 -3
  80. package/cjs/index.js.map +1 -1
  81. package/cjs/math/numeric_struct.d.ts +1 -1
  82. package/cjs/math/numeric_struct.d.ts.map +1 -1
  83. package/cjs/mix_types/any_or_never_type.d.ts +1 -1
  84. package/cjs/never/never_type.d.ts +11 -0
  85. package/cjs/never/never_type.d.ts.map +1 -1
  86. package/cjs/nodejs/isNodeError.d.ts.map +1 -1
  87. package/cjs/nominal/brand.d.ts.map +1 -1
  88. package/cjs/nominal/flavor.d.ts.map +1 -1
  89. package/cjs/object/index.d.ts +0 -1
  90. package/cjs/object/index.d.ts.map +1 -1
  91. package/cjs/object/index.js.map +1 -1
  92. package/cjs/testing/test_type.d.ts +277 -233
  93. package/cjs/testing/test_type.d.ts.map +1 -1
  94. package/cjs/testing/test_type.js.map +1 -1
  95. package/cjs/tuple/common_prop_keys.d.ts +34 -0
  96. package/cjs/tuple/common_prop_keys.d.ts.map +1 -0
  97. package/cjs/tuple/common_prop_keys.js.map +1 -0
  98. package/cjs/tuple/create_tuple.d.ts.map +1 -1
  99. package/cjs/tuple/drop.d.ts +91 -0
  100. package/cjs/tuple/drop.d.ts.map +1 -0
  101. package/cjs/{array → tuple}/drop.js +3 -1
  102. package/cjs/tuple/drop.js.map +1 -0
  103. package/{esm/array → cjs/tuple}/tail.d.ts +1 -1
  104. package/cjs/{array → tuple}/tail.d.ts.map +1 -1
  105. package/cjs/{array → tuple}/tail.js.map +1 -1
  106. package/cjs/tuple/tuple_plus.common_prop_keys.d.ts +28 -0
  107. package/cjs/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -0
  108. package/cjs/tuple/tuple_plus.common_prop_keys.js +3 -0
  109. package/cjs/tuple/tuple_plus.common_prop_keys.js.map +1 -0
  110. package/cjs/tuple/tuple_plus.d.ts +5 -1
  111. package/cjs/tuple/tuple_plus.d.ts.map +1 -1
  112. package/cjs/tuple/tuple_plus.drop_match.d.ts +6 -0
  113. package/cjs/tuple/tuple_plus.drop_match.d.ts.map +1 -0
  114. package/cjs/tuple/tuple_plus.drop_match.js +3 -0
  115. package/cjs/tuple/tuple_plus.drop_match.js.map +1 -0
  116. package/cjs/tuple/tuple_plus.filter.d.ts +13 -0
  117. package/cjs/tuple/tuple_plus.filter.d.ts.map +1 -0
  118. package/cjs/tuple/tuple_plus.filter.js +3 -0
  119. package/cjs/tuple/tuple_plus.filter.js.map +1 -0
  120. package/cjs/tuple/tuple_plus.find.d.ts +64 -0
  121. package/cjs/tuple/tuple_plus.find.d.ts.map +1 -0
  122. package/cjs/tuple/tuple_plus.find.js +3 -0
  123. package/cjs/tuple/tuple_plus.find.js.map +1 -0
  124. package/cjs/tuple/tuple_plus.js +0 -15
  125. package/cjs/tuple/tuple_plus.js.map +1 -1
  126. package/cjs/tuple/tuple_plus.pad_start.d.ts +11 -5
  127. package/cjs/tuple/tuple_plus.pad_start.d.ts.map +1 -1
  128. package/cjs/tuple/tuple_type.d.ts +41 -23
  129. package/cjs/tuple/tuple_type.d.ts.map +1 -1
  130. package/cjs/union/union.d.ts +33 -0
  131. package/cjs/union/union.d.ts.map +1 -0
  132. package/cjs/{array/array.concat.js → union/union.js} +1 -1
  133. package/cjs/union/union.js.map +1 -0
  134. package/cjs/unknown/unknown_type.d.ts +12 -0
  135. package/cjs/unknown/unknown_type.d.ts.map +1 -1
  136. package/cjs/utils/options.d.ts +10 -0
  137. package/cjs/utils/options.d.ts.map +1 -0
  138. package/cjs/utils/options.js +3 -0
  139. package/cjs/utils/options.js.map +1 -0
  140. package/esm/any/any_type.d.ts +8 -8
  141. package/esm/any/any_type.d.ts.map +1 -1
  142. package/esm/array/array.at.d.ts +3 -1
  143. package/esm/array/array.at.d.ts.map +1 -1
  144. package/esm/array/array.entries.d.ts +4 -3
  145. package/esm/array/array.entries.d.ts.map +1 -1
  146. package/esm/array/array.find_last.d.ts +3 -1
  147. package/esm/array/array.find_last.d.ts.map +1 -1
  148. package/esm/array/array.some.d.ts +1 -1
  149. package/esm/array/array.some.d.ts.map +1 -1
  150. package/esm/array/array_plus.common_prop_keys.d.ts +27 -0
  151. package/esm/array/array_plus.common_prop_keys.d.ts.map +1 -0
  152. package/esm/array/array_plus.common_prop_keys.js +2 -0
  153. package/esm/array/array_plus.common_prop_keys.js.map +1 -0
  154. package/esm/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
  155. package/esm/array/array_plus.concat.d.ts.map +1 -0
  156. package/esm/array/array_plus.concat.js +2 -0
  157. package/esm/array/array_plus.concat.js.map +1 -0
  158. package/esm/array/array_plus.d.ts +7 -3
  159. package/esm/array/array_plus.d.ts.map +1 -1
  160. package/esm/array/array_plus.drop_match.d.ts +4 -0
  161. package/esm/array/array_plus.drop_match.d.ts.map +1 -0
  162. package/esm/array/array_plus.drop_match.js +2 -0
  163. package/esm/array/array_plus.drop_match.js.map +1 -0
  164. package/esm/array/array_plus.element_match.d.ts +44 -0
  165. package/esm/array/array_plus.element_match.d.ts.map +1 -0
  166. package/esm/array/array_plus.element_match.js +2 -0
  167. package/esm/array/array_plus.element_match.js.map +1 -0
  168. package/esm/array/array_plus.filter.d.ts +2 -0
  169. package/esm/array/array_plus.filter.d.ts.map +1 -0
  170. package/esm/array/array_plus.filter.js +2 -0
  171. package/esm/array/array_plus.filter.js.map +1 -0
  172. package/esm/array/array_plus.find.d.ts +57 -0
  173. package/esm/array/array_plus.find.d.ts.map +1 -0
  174. package/esm/array/array_plus.find.js +2 -0
  175. package/esm/array/array_plus.find.js.map +1 -0
  176. package/esm/array/array_plus.pad_start.d.ts +5 -0
  177. package/esm/array/array_plus.pad_start.d.ts.map +1 -0
  178. package/esm/array/array_plus.pad_start.js +2 -0
  179. package/esm/array/array_plus.pad_start.js.map +1 -0
  180. package/esm/array/array_type.d.ts +30 -12
  181. package/esm/array/array_type.d.ts.map +1 -1
  182. package/esm/array/filter.d.ts +24 -4
  183. package/esm/array/filter.d.ts.map +1 -1
  184. package/esm/array/find_first.d.ts +62 -0
  185. package/esm/array/find_first.d.ts.map +1 -0
  186. package/esm/array/find_first.js +2 -0
  187. package/esm/array/find_first.js.map +1 -0
  188. package/esm/array/head.d.ts +30 -1
  189. package/esm/array/head.d.ts.map +1 -1
  190. package/esm/array/intersect_of_props.d.ts +5 -3
  191. package/esm/array/intersect_of_props.d.ts.map +1 -1
  192. package/esm/array/last.d.ts +27 -2
  193. package/esm/array/last.d.ts.map +1 -1
  194. package/esm/array/literal_array.d.ts +5 -0
  195. package/esm/array/literal_array.d.ts.map +1 -1
  196. package/esm/array/literal_array.js +5 -0
  197. package/esm/array/literal_array.js.map +1 -1
  198. package/esm/array/pad_start.d.ts +5 -5
  199. package/esm/array/pad_start.d.ts.map +1 -1
  200. package/esm/array/reduce_while.d.ts +6 -0
  201. package/esm/array/reduce_while.d.ts.map +1 -1
  202. package/esm/array/reduce_while.js +6 -0
  203. package/esm/array/reduce_while.js.map +1 -1
  204. package/esm/array/reverse.d.ts +5 -0
  205. package/esm/array/reverse.d.ts.map +1 -1
  206. package/esm/array/union_of_props.d.ts +1 -1
  207. package/esm/array/union_of_props.d.ts.map +1 -1
  208. package/esm/assertion/assert_type.d.ts +4 -1
  209. package/esm/assertion/assert_type.d.ts.map +1 -1
  210. package/esm/assertion/assert_type.js.map +1 -1
  211. package/esm/functional/compose.d.ts +2 -1
  212. package/esm/functional/compose.d.ts.map +1 -1
  213. package/esm/functional/compose.js.map +1 -1
  214. package/esm/functional/context.d.ts.map +1 -1
  215. package/esm/index.d.ts +22 -3
  216. package/esm/index.d.ts.map +1 -1
  217. package/esm/index.js +4 -2
  218. package/esm/index.js.map +1 -1
  219. package/esm/math/numeric_struct.d.ts +1 -1
  220. package/esm/math/numeric_struct.d.ts.map +1 -1
  221. package/esm/mix_types/any_or_never_type.d.ts +1 -1
  222. package/esm/never/never_type.d.ts +11 -0
  223. package/esm/never/never_type.d.ts.map +1 -1
  224. package/esm/nodejs/isNodeError.d.ts.map +1 -1
  225. package/esm/nominal/brand.d.ts.map +1 -1
  226. package/esm/nominal/flavor.d.ts.map +1 -1
  227. package/esm/object/index.d.ts +0 -1
  228. package/esm/object/index.d.ts.map +1 -1
  229. package/esm/object/index.js.map +1 -1
  230. package/esm/testing/test_type.d.ts +277 -233
  231. package/esm/testing/test_type.d.ts.map +1 -1
  232. package/esm/testing/test_type.js.map +1 -1
  233. package/esm/tuple/common_prop_keys.d.ts +34 -0
  234. package/esm/tuple/common_prop_keys.d.ts.map +1 -0
  235. package/esm/tuple/common_prop_keys.js.map +1 -0
  236. package/esm/tuple/create_tuple.d.ts.map +1 -1
  237. package/esm/tuple/drop.d.ts +91 -0
  238. package/esm/tuple/drop.d.ts.map +1 -0
  239. package/esm/tuple/drop.js +9 -0
  240. package/esm/tuple/drop.js.map +1 -0
  241. package/{cjs/array → esm/tuple}/tail.d.ts +1 -1
  242. package/esm/{array → tuple}/tail.d.ts.map +1 -1
  243. package/esm/{array → tuple}/tail.js.map +1 -1
  244. package/esm/tuple/tuple_plus.common_prop_keys.d.ts +28 -0
  245. package/esm/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -0
  246. package/esm/tuple/tuple_plus.common_prop_keys.js +2 -0
  247. package/esm/tuple/tuple_plus.common_prop_keys.js.map +1 -0
  248. package/esm/tuple/tuple_plus.d.ts +5 -1
  249. package/esm/tuple/tuple_plus.d.ts.map +1 -1
  250. package/esm/tuple/tuple_plus.drop_match.d.ts +6 -0
  251. package/esm/tuple/tuple_plus.drop_match.d.ts.map +1 -0
  252. package/esm/tuple/tuple_plus.drop_match.js +2 -0
  253. package/esm/tuple/tuple_plus.drop_match.js.map +1 -0
  254. package/esm/tuple/tuple_plus.filter.d.ts +13 -0
  255. package/esm/tuple/tuple_plus.filter.d.ts.map +1 -0
  256. package/esm/tuple/tuple_plus.filter.js +2 -0
  257. package/esm/tuple/tuple_plus.filter.js.map +1 -0
  258. package/esm/tuple/tuple_plus.find.d.ts +64 -0
  259. package/esm/tuple/tuple_plus.find.d.ts.map +1 -0
  260. package/esm/tuple/tuple_plus.find.js +2 -0
  261. package/esm/tuple/tuple_plus.find.js.map +1 -0
  262. package/esm/tuple/tuple_plus.js +1 -1
  263. package/esm/tuple/tuple_plus.js.map +1 -1
  264. package/esm/tuple/tuple_plus.pad_start.d.ts +11 -5
  265. package/esm/tuple/tuple_plus.pad_start.d.ts.map +1 -1
  266. package/esm/tuple/tuple_type.d.ts +41 -23
  267. package/esm/tuple/tuple_type.d.ts.map +1 -1
  268. package/esm/union/union.d.ts +33 -0
  269. package/esm/union/union.d.ts.map +1 -0
  270. package/esm/union/union.js +2 -0
  271. package/esm/union/union.js.map +1 -0
  272. package/esm/unknown/unknown_type.d.ts +12 -0
  273. package/esm/unknown/unknown_type.d.ts.map +1 -1
  274. package/esm/utils/options.d.ts +10 -0
  275. package/esm/utils/options.d.ts.map +1 -0
  276. package/esm/utils/options.js +2 -0
  277. package/esm/utils/options.js.map +1 -0
  278. package/package.json +12 -9
  279. package/ts/any/any_type.ts +8 -9
  280. package/ts/any/readme.md +71 -4
  281. package/ts/array/array.at.ts +3 -1
  282. package/ts/array/array.entries.ts +4 -2
  283. package/ts/array/array.find_last.ts +3 -1
  284. package/ts/array/array.some.ts +1 -1
  285. package/ts/array/array_plus.common_prop_keys.ts +35 -0
  286. package/ts/array/{array.concat.ts → array_plus.concat.ts} +3 -0
  287. package/ts/array/array_plus.drop_match.ts +16 -0
  288. package/ts/array/array_plus.element_match.ts +61 -0
  289. package/ts/array/array_plus.filter.ts +5 -0
  290. package/ts/array/array_plus.find.ts +71 -0
  291. package/ts/array/array_plus.pad_start.ts +13 -0
  292. package/ts/array/array_plus.ts +7 -3
  293. package/ts/array/array_type.ts +30 -12
  294. package/ts/array/filter.ts +27 -22
  295. package/ts/array/find_first.ts +71 -0
  296. package/ts/array/head.ts +40 -1
  297. package/ts/array/intersect_of_props.ts +7 -3
  298. package/ts/array/last.ts +36 -2
  299. package/ts/array/literal_array.ts +5 -0
  300. package/ts/array/pad_start.ts +6 -10
  301. package/ts/array/readme.md +297 -32
  302. package/ts/array/reduce_while.ts +6 -0
  303. package/ts/array/reverse.ts +5 -0
  304. package/ts/array/union_of_props.ts +1 -1
  305. package/ts/assertion/assert_type.ts +4 -1
  306. package/ts/assertion/readme.md +4 -3
  307. package/ts/functional/compose.ts +2 -1
  308. package/ts/functional/context.ts +1 -1
  309. package/ts/index.ts +22 -3
  310. package/ts/math/numeric_struct.ts +9 -9
  311. package/ts/mix_types/any_or_never_type.ts +1 -1
  312. package/ts/mix_types/readme.md +7 -1
  313. package/ts/never/never_type.ts +13 -0
  314. package/ts/nodejs/isNodeError.ts +13 -13
  315. package/ts/nominal/brand.ts +1 -1
  316. package/ts/nominal/flavor.ts +1 -1
  317. package/ts/object/index.ts +0 -1
  318. package/ts/testing/readme.md +30 -0
  319. package/ts/testing/test_type.ts +279 -234
  320. package/ts/tuple/common_prop_keys.ts +41 -0
  321. package/ts/tuple/create_tuple.ts +9 -9
  322. package/ts/tuple/drop.ts +125 -0
  323. package/ts/tuple/readme.md +263 -9
  324. package/ts/{array → tuple}/tail.ts +1 -1
  325. package/ts/tuple/tuple_plus.common_prop_keys.ts +47 -0
  326. package/ts/tuple/tuple_plus.drop_match.ts +20 -0
  327. package/ts/tuple/tuple_plus.filter.ts +29 -0
  328. package/ts/tuple/tuple_plus.find.ts +88 -0
  329. package/ts/tuple/tuple_plus.pad_start.ts +37 -21
  330. package/ts/tuple/tuple_plus.ts +5 -1
  331. package/ts/tuple/tuple_type.ts +67 -25
  332. package/ts/union/readme.md +81 -0
  333. package/ts/union/union.ts +37 -0
  334. package/ts/unknown/unknown_type.ts +13 -0
  335. package/ts/utils/options.ts +10 -0
  336. package/cjs/array/array.concat.d.ts.map +0 -1
  337. package/cjs/array/array.concat.js.map +0 -1
  338. package/cjs/array/array.find.d.ts +0 -21
  339. package/cjs/array/array.find.d.ts.map +0 -1
  340. package/cjs/array/array.find.js.map +0 -1
  341. package/cjs/array/common_prop_keys.d.ts +0 -11
  342. package/cjs/array/common_prop_keys.d.ts.map +0 -1
  343. package/cjs/array/common_prop_keys.js.map +0 -1
  344. package/cjs/array/drop.d.ts +0 -19
  345. package/cjs/array/drop.d.ts.map +0 -1
  346. package/cjs/array/drop.js.map +0 -1
  347. package/cjs/array/index.d.ts +0 -17
  348. package/cjs/array/index.d.ts.map +0 -1
  349. package/cjs/array/index.js +0 -33
  350. package/cjs/array/index.js.map +0 -1
  351. package/esm/array/array.concat.d.ts.map +0 -1
  352. package/esm/array/array.concat.js +0 -2
  353. package/esm/array/array.concat.js.map +0 -1
  354. package/esm/array/array.find.d.ts +0 -21
  355. package/esm/array/array.find.d.ts.map +0 -1
  356. package/esm/array/array.find.js +0 -2
  357. package/esm/array/array.find.js.map +0 -1
  358. package/esm/array/common_prop_keys.d.ts +0 -11
  359. package/esm/array/common_prop_keys.d.ts.map +0 -1
  360. package/esm/array/common_prop_keys.js.map +0 -1
  361. package/esm/array/drop.d.ts +0 -19
  362. package/esm/array/drop.d.ts.map +0 -1
  363. package/esm/array/drop.js +0 -7
  364. package/esm/array/drop.js.map +0 -1
  365. package/esm/array/index.d.ts +0 -17
  366. package/esm/array/index.d.ts.map +0 -1
  367. package/esm/array/index.js +0 -17
  368. package/esm/array/index.js.map +0 -1
  369. package/ts/array/array.find.ts +0 -32
  370. package/ts/array/common_prop_keys.ts +0 -18
  371. package/ts/array/drop.ts +0 -71
  372. package/ts/array/index.ts +0 -16
  373. /package/cjs/{array → tuple}/common_prop_keys.js +0 -0
  374. /package/cjs/{array → tuple}/tail.js +0 -0
  375. /package/esm/{array → tuple}/common_prop_keys.js +0 -0
  376. /package/esm/{array → tuple}/tail.js +0 -0
@@ -0,0 +1,44 @@
1
+ import type { IsNever } from '../never/never_type.js';
2
+ import type { IsUnion } from '../union/union.js';
3
+ import type { MergeOptions } from '../utils/options.js';
4
+ /**
5
+ * 🦴 *utilities*
6
+ * 🔢 *customizable*
7
+ *
8
+ * Filter the element `T` in an array or tuple to match `Criteria`.
9
+ *
10
+ * @typeParam Options['widen'] Allow using narrow type to match widen type.
11
+ * e.g. `number, 1` -> `1 | undefined`.
12
+ * Default to `true`.
13
+ *
14
+ * @typeParam Options['caseNotMatch'] Return value when `T` does not match `Criteria`.
15
+ * Default to `never`.
16
+ *
17
+ * @typeParam Options['caseWiden'] Return value when `widen` is true.
18
+ * Default to `Criteria | undefined`.
19
+ *
20
+ * @typeParam Options['caseUnionNotMatch'] Return value when a branch of the union `T` does not match `Criteria`.
21
+ * Default to `never`.
22
+ *
23
+ * If you want the type to behave more like JavaScript,
24
+ * you can override it to return `undefined`.
25
+ *
26
+ * Since it is a union, the result will be joined to the matched branch as union.
27
+ * e.g. `ElementMatch<1 | 2, 1>` -> `1 | undefined`
28
+ */
29
+ export type ElementMatch<T, Criteria, Options extends ElementMatch.Options = ElementMatch.DefaultOptions<Criteria>> = [T] extends [Criteria] ? T : (MergeOptions<Options, ElementMatch.DefaultOptions<Criteria>> extends infer C extends Record<keyof ElementMatch.Options, unknown> ? ((T extends Criteria ? T : (C['widen'] extends true ? (Criteria extends T ? C['caseWiden'] : C['caseNotMatch']) : C['caseNotMatch'])) extends infer R ? IsUnion<T, IsNever<R, R, R | C['caseUnionNotMatch']>, R> : C['caseNotMatch']) : never);
30
+ export declare namespace ElementMatch {
31
+ interface Options {
32
+ widen?: boolean | undefined;
33
+ caseNotMatch?: unknown;
34
+ caseWiden?: unknown;
35
+ caseUnionNotMatch?: unknown;
36
+ }
37
+ interface DefaultOptions<Criteria> {
38
+ widen: true;
39
+ caseNotMatch: never;
40
+ caseWiden: Criteria | undefined;
41
+ caseUnionNotMatch: never;
42
+ }
43
+ }
44
+ //# sourceMappingURL=array_plus.element_match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.element_match.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.element_match.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,YAAY,CACvB,CAAC,EACD,QAAQ,EACR,OAAO,SAAS,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,IACzE,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,GACvB,CAAC,GACD,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,GAChI,CAAC,CAAC,CAAC,SAAS,QAAQ,GACnB,CAAC,GACD,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,GACvB,CAAC,QAAQ,SAAS,CAAC,GAClB,CAAC,CAAC,WAAW,CAAC,GACd,CAAC,CAAC,cAAc,CAAC,CAAC,GACnB,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GACpC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GACxD,CAAC,CAAC,cAAc,CAAC,CAAC,GACnB,KAAK,CAAC,CAAA;AAEV,yBAAiB,YAAY,CAAC;IAC7B,UAAiB,OAAO;QACvB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAC3B;IACD,UAAiB,cAAc,CAAC,QAAQ;QACvC,KAAK,EAAE,IAAI,CAAC;QACZ,YAAY,EAAE,KAAK,CAAC;QACpB,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAC;QAChC,iBAAiB,EAAE,KAAK,CAAA;KACxB;CACD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=array_plus.element_match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.element_match.js","sourceRoot":"","sources":["../../ts/array/array_plus.element_match.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type Filter<A extends unknown[], Criteria> = A[0] extends Criteria ? A : Criteria extends A[0] ? Array<Criteria> : never[];
2
+ //# sourceMappingURL=array_plus.filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.filter.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.filter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GACtE,CAAC,GACD,QAAQ,SAAS,CAAC,CAAC,CAAC,CAAC,GACrB,KAAK,CAAC,QAAQ,CAAC,GACf,KAAK,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=array_plus.filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.filter.js","sourceRoot":"","sources":["../../ts/array/array_plus.filter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import type { NeverType } from '../never/never_type.js';
2
+ import type { TupleType } from '../tuple/tuple_type.js';
3
+ import type { MergeOptions } from '../utils/options.js';
4
+ import type { ElementMatch } from './array_plus.element_match.js';
5
+ /**
6
+ * 🦴 *utilities*
7
+ * 🔢 *customizable*
8
+ *
9
+ * Finds the type in array `A` that matches `Criteria`.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * type R = ArrayPlus.Find<Array<string>, string> // string
14
+ * type R = ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
15
+ * type R = ArrayPlus.Find<Array<string | number>, number | string> // string | number
16
+ * type R = ArrayPlus.Find<Array<number>, 1> // widen: 1 | undefined
17
+ * type R = ArrayPlus.Find<Array<string | number>, number> // unionMiss: number | undefined
18
+ *
19
+ * type R = ArrayPlus.Find<string[], number> // never
20
+ * ```
21
+ *
22
+ * @typeParam Options['widen'] performs widen match.
23
+ * Default to `true`.
24
+ * With widen match, a narrowed type will match its widen type.
25
+ * e.g. matching `1` against `number` yields `1 | undefined`
26
+ *
27
+ * The widen behavior can be customized by `Options['caseWiden']`
28
+ *
29
+ * @typeParam Options['caseNever'] return type when `A` is `never`. Default to `never`.
30
+ *
31
+ * @typeParam Options['caseNotMatch'] Return value when `T` does not match `Criteria`.
32
+ * Default to `never`.
33
+ *
34
+ * @typeParam Options['caseTuple'] return type when `A` is a tuple. Default to `not supported` message.
35
+ *
36
+ * @typeParam Options['caseWiden'] return type when `T` in `A` is a widen type of `Criteria`.
37
+ * Default to `Criteria | undefined`.
38
+ * Set it to `never` for a more type-centric behavior
39
+ *
40
+ * @typeParam Options['caseUnionNotMatch'] Return value when a branch of the union `T` does not match `Criteria`.
41
+ * Default to `never`.
42
+ *
43
+ * If you want the type to behave more like JavaScript,
44
+ * you can override it to return `undefined`.
45
+ *
46
+ * Since it is a union, the result will be joined to the matched branch as union.
47
+ */
48
+ export type Find<A extends unknown[], Criteria, Options extends Find.Options = Find.DefaultOptions<Criteria>> = MergeOptions<Options, Find.DefaultOptions<Criteria>> extends infer O extends Find.Options ? TupleType<A, O['caseTuple'], A extends Array<infer T> ? ElementMatch<T, Criteria, O> : never, O> : never;
49
+ export declare namespace Find {
50
+ interface Options extends ElementMatch.Options, NeverType.Options {
51
+ caseTuple?: unknown;
52
+ }
53
+ interface DefaultOptions<Criteria> extends ElementMatch.DefaultOptions<Criteria>, NeverType.DefaultOptions {
54
+ caseTuple: 'does not support tuple. Please use `FindFirst` or `TuplePlus.Find` instead.';
55
+ }
56
+ }
57
+ //# sourceMappingURL=array_plus.find.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.find.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,MAAM,IAAI,CACf,CAAC,SAAS,OAAO,EAAE,EACnB,QAAQ,EACR,OAAO,SAAS,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAE5D,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,SAAS,IAAI,CAAC,OAAO,GACvF,SAAS,CACV,CAAC,EACD,CAAC,CAAC,WAAW,CAAC,EACd,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,KAAK,EAC/D,CAAC,CACD,GACC,KAAK,CAAA;AAER,yBAAiB,IAAI,CAAC;IACrB,UAAiB,OAAQ,SAAQ,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO;QACvE,SAAS,CAAC,EAAE,OAAO,CAAC;KACpB;IAED,UAAiB,cAAc,CAAC,QAAQ,CAAE,SAAQ,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,cAAc;QAChH,SAAS,EAAE,6EAA6E,CAAC;KACzF;CACD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=array_plus.find.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.find.js","sourceRoot":"","sources":["../../ts/array/array_plus.find.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { CanAssign } from '../index.js';
2
+ import type { CreateTuple } from '../tuple/create_tuple.js';
3
+ import type { UnionOfValues } from './union_of_values.js';
4
+ export type PadStart<A extends unknown[], MaxLength extends number, PadWith = unknown> = MaxLength extends 0 ? A : CanAssign<PadWith, UnionOfValues<A>> extends true ? A : PadStart<[...CreateTuple<MaxLength, PadWith>, ...A], MaxLength, PadWith>;
5
+ //# sourceMappingURL=array_plus.pad_start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.pad_start.d.ts","sourceRoot":"","sources":["../../ts/array/array_plus.pad_start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,MAAM,MAAM,QAAQ,CACnB,CAAC,SAAS,OAAO,EAAE,EACnB,SAAS,SAAS,MAAM,EACxB,OAAO,GAAG,OAAO,IACd,SAAS,SAAS,CAAC,GACpB,CAAC,GACD,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GACjD,CAAC,GACD,QAAQ,CAAC,CAAC,GAAG,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=array_plus.pad_start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array_plus.pad_start.js","sourceRoot":"","sources":["../../ts/array/array_plus.pad_start.ts"],"names":[],"mappings":""}
@@ -1,42 +1,60 @@
1
1
  import type { IsNever } from '../never/never_type.js';
2
2
  import type { StrictNumberType } from '../number/strict_number_type.js';
3
3
  /**
4
- * Check if the type `T` is an array and not a tuple.
4
+ * 🌪️ *filter*
5
5
  *
6
+ * Filter `T` to ensure it is an array, excluding tuple.
7
+ *
8
+ * @example
6
9
  * ```ts
7
10
  * type R = ArrayType<number[]> // number[]
8
11
  *
9
12
  * type R = ArrayType<[1]> // never
13
+ * type R = ArrayType<number[] | 1> // never
14
+ * type R = ArrayType<number[] & { a: 1 }> // never
10
15
  * ```
11
16
  */
12
17
  export type ArrayType<T, Then = T, Else = never> = IsNever<T, Else, [
13
18
  any[]
14
19
  ] extends [T] ? ([T] extends [any[]] ? StrictNumberType<T['length'], Then, Else> : Else) : Else>;
15
20
  /**
16
- * Check if the type `T` is not an array.
21
+ * 🎭 *validate*
22
+ *
23
+ * Validate that `T` is an array, excluding tuple.
17
24
  *
25
+ * @example
18
26
  * ```ts
19
- * type R = NotArrayType<number[]> // never
27
+ * type R = IsArray<number[]> // true
20
28
  *
21
- * type R = NotArrayType<number> // number
22
- * type R = NotArrayType<[1]> // [1]
29
+ * type R = IsArray<number> // false
30
+ * type R = IsArray<[1]> // false
23
31
  * ```
24
32
  */
25
- export type NotArrayType<T, Then = T, Else = never> = ArrayType<T, Else, Then>;
33
+ export type IsArray<T, Then = true, Else = false> = ArrayType<T, Then, Else>;
26
34
  /**
27
- * Is `T` an array?
35
+ * 🌪️ *filter*
36
+ *
37
+ * Filter `T` to ensure it is not an array, excluding tuple.
28
38
  *
39
+ * i.e. *tuple* will pass through this filter.
40
+ *
41
+ * @example
29
42
  * ```ts
30
- * type R = IsArray<number[]> // true
43
+ * type R = NotArrayType<number[]> // never
31
44
  *
32
- * type R = IsArray<number> // false
33
- * type R = IsArray<[1]> // false
45
+ * type R = NotArrayType<number> // number
46
+ * type R = NotArrayType<[1]> // [1]
34
47
  * ```
35
48
  */
36
- export type IsArray<T, Then = true, Else = false> = ArrayType<T, Then, Else>;
49
+ export type NotArrayType<T, Then = T, Else = never> = ArrayType<T, Else, Then>;
37
50
  /**
38
- * Is `T` not an array?
51
+ * 🎭 *validate*
52
+ *
53
+ * Validate that `T` is not an array, excluding tuple.
54
+ *
55
+ * i.e. *tuple* will pass through this filter.
39
56
  *
57
+ * @example
40
58
  * ```ts
41
59
  * type R = IsNotArray<number[]> // false
42
60
  *
@@ -1 +1 @@
1
- {"version":3,"file":"array_type.d.ts","sourceRoot":"","sources":["../../ts/array/array_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CACzD,CAAC,EACD,IAAI,EACJ;IAAC,GAAG,EAAE;CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CACrG,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE9E;;;;;;;;;GASG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
1
+ {"version":3,"file":"array_type.d.ts","sourceRoot":"","sources":["../../ts/array/array_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CACzD,CAAC,EACD,IAAI,EACJ;IAAC,GAAG,EAAE;CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CACrG,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE5E;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
@@ -1,9 +1,29 @@
1
+ import type { Filter as FilterTuple } from '../tuple/tuple_plus.filter.js';
2
+ import type { Filter as FilterArray } from './array_plus.filter.js';
1
3
  /**
2
- * filter the array or tuple `A`, keeping entries satisfying `Criteria`.
4
+ * ⚗️ *transform*
5
+ *
6
+ * Filter the array or tuple `A`, keeping entries satisfying `Criteria`.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * type R = Filter<[1, 2, '3'], number> // [1, 2]
11
+ * type R = Filter<Array<string | undefined>, string> // string[]
12
+ * ```
3
13
  */
4
- export type Filter<A extends Array<any>, Criteria> = number extends A['length'] ? A[0] extends Criteria ? A : Criteria extends A[0] ? Array<Criteria> : never[] : A['length'] extends 0 ? never : A extends [infer Head, ...infer Tail] ? Tail['length'] extends 0 ? Head extends Criteria ? [Head] : never[] : Head extends Criteria ? [Head, ...Filter<Tail, Criteria>] : Filter<Tail, Criteria> : never;
14
+ export type Filter<A extends unknown[], Criteria> = number extends A['length'] ? FilterArray<A, Criteria> : FilterTuple<A, Criteria>;
5
15
  /**
6
- * keeps entries satisfying `Criteria` in array or tuple `A`.
16
+ * ⚗️ *transform*
17
+ * 👽 *alias*
18
+ *
19
+ * Keeps entries satisfying `Criteria` in array or tuple `A`.
20
+ *
21
+ * @alias of [Filter](./filter.ts)
22
+ * @example
23
+ * ```ts
24
+ * type R = KeepMatch<[1, 2, 3], number> // [1, 2]
25
+ * type R = KeepMatch<Array<string|undefined>, string> // string[]
26
+ * ```
7
27
  */
8
- export type KeepMatch<A extends Array<any>, Criteria> = Filter<A, Criteria>;
28
+ export type KeepMatch<A extends unknown[], Criteria> = Filter<A, Criteria>;
9
29
  //# sourceMappingURL=filter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../ts/array/filter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAE5E,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GACpB,CAAC,GACD,QAAQ,SAAS,CAAC,CAAC,CAAC,CAAC,GACrB,KAAK,CAAC,QAAQ,CAAC,GACf,KAAK,EAAE,GAEV,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACnB,KAAK,GACL,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GACvB,IAAI,SAAS,QAAQ,GACpB,CAAC,IAAI,CAAC,GACN,KAAK,EAAE,GACR,IAAI,SAAS,QAAQ,GACrB,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,GACjC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GACvB,KAAK,CAAA;AAER;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,IAAI,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../ts/array/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEnE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC3E,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,GACxB,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;AAE3B;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
@@ -0,0 +1,62 @@
1
+ import type { TupleType } from '../tuple/tuple_type.js';
2
+ import type { Find as TupleFind } from '../tuple/tuple_plus.find.js';
3
+ import type { Find as ArrayFind } from './array_plus.find.js';
4
+ /**
5
+ * 🦴 *utilities*
6
+ * 🔢 *customizable*
7
+ *
8
+ * Find the first type in the array or tuple `A` that matches `Criteria`.
9
+ *
10
+ * If the `Criteria` is not met, it will return `never'.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * type R = FindFirst<[true, 1, 'x', 3], string> // 'x'
15
+ * type R = FindFirst<[true, 1, 'x', 3], number> // 1
16
+ * type R = FindFirst<[string, number, 1], 1> // widen: 1 | undefined
17
+ * type R = FindFirst<[true, number | string], string> // unionMiss: string | undefined
18
+ * type R = FindFirst<Array<string>, string> // string
19
+ * type R = FindFirst<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
20
+ * type R = FindFirst<Array<string | number>, number | string> // string | number
21
+ * type R = FindFirst<Array<number>, 1> // widen: 1 | undefined
22
+ * type R = FindFirst<Array<string | number>, number> // unionMiss: number | undefined
23
+ *
24
+ * type R = FindFirst<[true, 1, 'x'], 2> // never
25
+ * type R = FindFirst<string[], number> // never
26
+ * ```
27
+ *
28
+ * @typeParam Options['widen'] performs widen match.
29
+ * Default to `true`.
30
+ * With widen match, a narrowed type will match its widen type.
31
+ * e.g. matching `1` against `number` yields `1 | undefined`
32
+ *
33
+ * The widen behavior can be customized by `Options['caseWiden']`
34
+ *
35
+ * @typeParam Options['caseEmptyTuple'] return type when `A` is an empty tuple.
36
+ * Default to `never`.
37
+ *
38
+ * @typeParam Options['caseNever'] return type when `A` is `never`. Default to `never`.
39
+ *
40
+ * @typeParam Options['caseNoMatch'] Return value when `T` does not match `Criteria`.
41
+ * Default to `never`.
42
+ *
43
+ * @typeParam Options['caseWiden'] return type when `T` in `A` is a widen type of `Criteria`.
44
+ * Default to `Criteria | undefined`.
45
+ * Set it to `never` for a more type-centric behavior
46
+ *
47
+ * @typeParam Options['caseUnionMiss'] Return value when a branch of the union `T` does not match `Criteria`.
48
+ * Default to `undefined`.
49
+ * Since it is a union, the result will be join to the matched branch as union.
50
+ */
51
+ export type FindFirst<A extends unknown[], Criteria, Options extends FindFirst.Options = FindFirst.DefaultOptions<Criteria>> = TupleType<A, TupleFind<A, Criteria, Options>, ArrayFind<A, Criteria, Options>>;
52
+ export declare namespace FindFirst {
53
+ interface Options extends ArrayFind.Options, TupleFind.Options {
54
+ }
55
+ interface DefaultOptions<Criteria> extends ArrayFind.DefaultOptions<Criteria>, TupleFind.DefaultOptions<Criteria> {
56
+ }
57
+ }
58
+ /**
59
+ * @deprecated use FindFirst
60
+ */
61
+ export type First<A extends any[], Criteria> = FindFirst<A, Criteria>;
62
+ //# sourceMappingURL=find_first.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find_first.d.ts","sourceRoot":"","sources":["../../ts/array/find_first.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,MAAM,SAAS,CACpB,CAAC,SAAS,OAAO,EAAE,EACnB,QAAQ,EAAE,OAAO,SAAS,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,IAC7E,SAAS,CACZ,CAAC,EACD,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAC/B,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAC/B,CAAA;AAED,yBAAiB,SAAS,CAAC;IAC1B,UAAiB,OAAQ,SAAQ,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO;KAAI;IACzE,UAAiB,cAAc,CAAC,QAAQ,CACvC,SAAQ,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC;KAAI;CACnF;AAGD;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=array.find.js.map
3
+ //# sourceMappingURL=find_first.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find_first.js","sourceRoot":"","sources":["../../ts/array/find_first.ts"],"names":[],"mappings":""}
@@ -1,2 +1,31 @@
1
- export type Head<T extends any[]> = T['length'] extends 0 ? never : T[0];
1
+ import type { NeverType } from '../never/never_type.js';
2
+ /**
3
+ * 🦴 *utilities*
4
+ * 🔢 *customizable*
5
+ *
6
+ * Gets the first entry in the tuple or the type of array `T`.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * type R = Head<[1, 2, 3]> // 1
11
+ * type R = Head<string[]> // string
12
+ *
13
+ * type R = Head<[]> // never
14
+ * ```
15
+ *
16
+ * @typeParam Options['caseNever'] Return type when `T` is `never`.
17
+ * Default to `never`.
18
+ *
19
+ * @typeParam Options['caseEmptyTuple'] Return type when `T` is `[]`.
20
+ * Default to `never`.
21
+ */
22
+ export type Head<T extends unknown[], Options extends Head.Options = Head.DefaultOptions> = NeverType<T, Options['caseNever'], T['length'] extends 0 ? Options['caseEmptyTuple'] : T[0]>;
23
+ export declare namespace Head {
24
+ interface Options extends NeverType.Options {
25
+ caseEmptyTuple?: unknown;
26
+ }
27
+ interface DefaultOptions extends NeverType.DefaultOptions {
28
+ caseEmptyTuple: never;
29
+ }
30
+ }
2
31
  //# sourceMappingURL=head.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../ts/array/head.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../ts/array/head.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,IAAI,CACf,CAAC,SAAS,OAAO,EAAE,EACnB,OAAO,SAAS,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,IAC/C,SAAS,CACZ,CAAC,EACD,OAAO,CAAC,WAAW,CAAC,EACpB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACxD,CAAA;AAED,yBAAiB,IAAI,CAAC;IACrB,UAAiB,OAAQ,SAAQ,SAAS,CAAC,OAAO;QACjD,cAAc,CAAC,EAAE,OAAO,CAAA;KACxB;IAED,UAAiB,cAAe,SAAQ,SAAS,CAAC,cAAc;QAC/D,cAAc,EAAE,KAAK,CAAA;KACrB;CACD"}
@@ -1,9 +1,11 @@
1
1
  import type { KeyTypes } from '../object/index.js';
2
- import type { Tail } from './tail.js';
2
+ import type { Tail } from '../tuple/tail.js';
3
3
  /**
4
- * Gets the intersect of properties of the elements in `A`
4
+ * 🦴 *utilities*
5
+ *
6
+ * Gets the intersect of properties of the elements in `A`.
5
7
  */
6
- export type IntersectOfProps<A extends Record<any, unknown>[], P extends KeyTypes> = A['length'] extends 0 ? never : A['length'] extends 1 ? A[0][P] : A[0][P] & IntersectOfProps<Tail<A>, P>;
8
+ export type IntersectOfProps<A extends Record<any, unknown>[], P extends KeyTypes> = number extends A['length'] ? A[0][P] : A['length'] extends 0 ? never : A['length'] extends 1 ? A[0][P] : A[0][P] & IntersectOfProps<Tail<A>, P>;
7
9
  /**
8
10
  * Gets the intersect of properties of the elements in `A`
9
11
  * This will be deprecated in 4.0. Please use IntersectOfProps instead.
@@ -1 +1 @@
1
- {"version":3,"file":"intersect_of_props.d.ts","sourceRoot":"","sources":["../../ts/array/intersect_of_props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACvG,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACP,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAEzC;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"intersect_of_props.d.ts","sourceRoot":"","sources":["../../ts/array/intersect_of_props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE5C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC5G,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACP,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACP,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAEzC;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA"}
@@ -1,5 +1,30 @@
1
+ import type { NeverType } from '../never/never_type.js';
1
2
  /**
2
- * Get the last type of an array or tuple.
3
+ * 🦴 *utilities*
4
+ *
5
+ * Gets the last entry in the tuple or the type of array `T`.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * type R = Last<[1, 2, 3]> // 3
10
+ * type R = Last<string[]> // string
11
+ *
12
+ * type R = Last<[]> // never
13
+ * ```
14
+ *
15
+ * @typeParam Options['caseNever'] Return type when `T` is `never`.
16
+ * Default to `never`.
17
+ *
18
+ * @typeParam Options['caseEmptyTuple'] Return type when `T` is `[]`.
19
+ * Default to `never`.
3
20
  */
4
- export type Last<T extends any[]> = T extends [...any[], infer R] ? R : T[0];
21
+ export type Last<T extends unknown[], Options extends Last.Options = Last.DefaultOptions> = NeverType<T, Options['caseNever'], T['length'] extends 0 ? Options['caseEmptyTuple'] : T extends [...unknown[], infer R] ? R : T[0]>;
22
+ export declare namespace Last {
23
+ interface Options extends NeverType.Options {
24
+ caseEmptyTuple?: unknown;
25
+ }
26
+ interface DefaultOptions extends NeverType.DefaultOptions {
27
+ caseEmptyTuple: never;
28
+ }
29
+ }
5
30
  //# sourceMappingURL=last.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"last.d.ts","sourceRoot":"","sources":["../../ts/array/last.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"last.d.ts","sourceRoot":"","sources":["../../ts/array/last.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,IAAI,CACf,CAAC,SAAS,OAAO,EAAE,EACnB,OAAO,SAAS,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,IAC/C,SAAS,CAAC,CAAC,EACd,OAAO,CAAC,WAAW,CAAC,EACpB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAChG,CAAA;AAED,yBAAiB,IAAI,CAAC;IACrB,UAAiB,OAAQ,SAAQ,SAAS,CAAC,OAAO;QACjD,cAAc,CAAC,EAAE,OAAO,CAAA;KACxB;IAED,UAAiB,cAAe,SAAQ,SAAS,CAAC,cAAc;QAC/D,cAAc,EAAE,KAAK,CAAA;KACrB;CACD"}
@@ -1,3 +1,8 @@
1
1
  import type { KeyTypes } from '../object/index.js';
2
+ /**
3
+ * 🦴 *utilities*
4
+ *
5
+ * return an array whose items are restricted to the provided literals.
6
+ */
2
7
  export declare function literalArray<T extends KeyTypes>(...entries: T[]): T[];
3
8
  //# sourceMappingURL=literal_array.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"literal_array.d.ts","sourceRoot":"","sources":["../../ts/array/literal_array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAElD,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAErE"}
1
+ {"version":3,"file":"literal_array.d.ts","sourceRoot":"","sources":["../../ts/array/literal_array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAElD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAErE"}
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.literalArray = void 0;
4
+ /**
5
+ * 🦴 *utilities*
6
+ *
7
+ * return an array whose items are restricted to the provided literals.
8
+ */
4
9
  function literalArray(...entries) {
5
10
  return entries;
6
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"literal_array.js","sourceRoot":"","sources":["../../ts/array/literal_array.ts"],"names":[],"mappings":";;;AAEA,SAAgB,YAAY,CAAqB,GAAG,OAAY;IAC/D,OAAO,OAAO,CAAA;AACf,CAAC;AAFD,oCAEC"}
1
+ {"version":3,"file":"literal_array.js","sourceRoot":"","sources":["../../ts/array/literal_array.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,YAAY,CAAqB,GAAG,OAAY;IAC/D,OAAO,OAAO,CAAA;AACf,CAAC;AAFD,oCAEC"}
@@ -1,10 +1,10 @@
1
- import type { CanAssign } from '../index.js';
2
- import type { CreateTuple } from '../tuple/create_tuple.js';
3
- import type { PadStart as TuplePadStart } from '../tuple/tuple_plus.pad_start.js';
4
- import type { UnionOfValues } from './union_of_values.js';
1
+ import type { PadStart as PadStartTuple } from '../tuple/tuple_plus.pad_start.js';
2
+ import type { PadStart as PadStartArray } from './array_plus.pad_start.js';
5
3
  /**
6
4
  * Pads the start of an array or tuple with `PadWith`.
7
5
  *
6
+ * ⚗️ *transform*
7
+ *
8
8
  * @example
9
9
  * ```ts
10
10
  * // Padding array
@@ -24,7 +24,7 @@ import type { UnionOfValues } from './union_of_values.js';
24
24
  * PadStart<[1, 2, 3], 5> // [unknown, unknown, 1, 2, 3]
25
25
  * ```
26
26
  */
27
- export type PadStart<A extends unknown[], MaxLength extends number, PadWith = unknown> = number extends A['length'] ? MaxLength extends 0 ? A : CanAssign<PadWith, UnionOfValues<A>> extends true ? A : PadStart<[...CreateTuple<MaxLength, PadWith>, ...A], MaxLength, PadWith> : TuplePadStart<A, MaxLength, PadWith>;
27
+ export type PadStart<A extends unknown[], MaxLength extends number, PadWith = unknown> = number extends A['length'] ? PadStartArray<A, MaxLength, PadWith> : PadStartTuple<A, MaxLength, PadWith>;
28
28
  /**
29
29
  * @deprecated use PadStart instead
30
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"pad_start.d.ts","sourceRoot":"","sources":["../../ts/array/pad_start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,QAAQ,CACnB,CAAC,SAAS,OAAO,EAAE,EACnB,SAAS,SAAS,MAAM,EACxB,OAAO,GAAG,OAAO,IACd,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC3B,SAAS,SAAS,CAAC,GAClB,CAAC,GACD,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GACjD,CAAC,GACD,QAAQ,CAAC,CAAC,GAAG,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,GACzE,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;AAEvC;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,KAAK,SAAS,MAAM,EAAE,OAAO,GAAG,GAAG,IAAI,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA"}
1
+ {"version":3,"file":"pad_start.d.ts","sourceRoot":"","sources":["../../ts/array/pad_start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,KAAK,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE1E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,QAAQ,CACnB,CAAC,SAAS,OAAO,EAAE,EACnB,SAAS,SAAS,MAAM,EACxB,OAAO,GAAG,OAAO,IACd,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC3B,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,GACpC,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;AAEvC;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,KAAK,SAAS,MAAM,EAAE,OAAO,GAAG,GAAG,IAAI,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA"}
@@ -1,2 +1,8 @@
1
+ /**
2
+ * 🦴 *utilities*
3
+ *
4
+ * `reduce()` with predicate for early termination.
5
+ * A simple version of the same function in the `ramda` package.
6
+ */
1
7
  export declare function reduceWhile<T, R>(predicate: (acc: R, currentValue: T) => boolean, callbackfn: (previousValue: R, currentValue: T, currentIndex: number, array: T[]) => R, initialValue: R, array: T[]): R;
2
8
  //# sourceMappingURL=reduce_while.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reduce_while.d.ts","sourceRoot":"","sources":["../../ts/array/reduce_while.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC/B,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,KAAK,OAAO,EAC/C,UAAU,EAAE,CAAC,aAAa,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EACtF,YAAY,EAAE,CAAC,EACf,KAAK,EAAE,CAAC,EAAE,KASV"}
1
+ {"version":3,"file":"reduce_while.d.ts","sourceRoot":"","sources":["../../ts/array/reduce_while.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAC/B,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,KAAK,OAAO,EAC/C,UAAU,EAAE,CAAC,aAAa,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,EACtF,YAAY,EAAE,CAAC,EACf,KAAK,EAAE,CAAC,EAAE,KASV"}
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reduceWhile = void 0;
4
+ /**
5
+ * 🦴 *utilities*
6
+ *
7
+ * `reduce()` with predicate for early termination.
8
+ * A simple version of the same function in the `ramda` package.
9
+ */
4
10
  function reduceWhile(predicate, callbackfn, initialValue, array) {
5
11
  let acc = initialValue;
6
12
  for (let i = 0; i < array.length; i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"reduce_while.js","sourceRoot":"","sources":["../../ts/array/reduce_while.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAC1B,SAA+C,EAC/C,UAAsF,EACtF,YAAe,EACf,KAAU;IAEV,IAAI,GAAG,GAAG,YAAY,CAAA;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAA;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC;YAAE,OAAO,GAAG,CAAA;QACtC,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;KACtC;IACD,OAAO,GAAG,CAAA;AACX,CAAC;AAbD,kCAaC"}
1
+ {"version":3,"file":"reduce_while.js","sourceRoot":"","sources":["../../ts/array/reduce_while.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,WAAW,CAC1B,SAA+C,EAC/C,UAAsF,EACtF,YAAe,EACf,KAAU;IAEV,IAAI,GAAG,GAAG,YAAY,CAAA;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAA;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC;YAAE,OAAO,GAAG,CAAA;QACtC,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;KACtC;IACD,OAAO,GAAG,CAAA;AACX,CAAC;AAbD,kCAaC"}
@@ -1,2 +1,7 @@
1
+ /**
2
+ * ⚗️ *transform*
3
+ *
4
+ * reverses the order of `A`.
5
+ */
1
6
  export type Reverse<A extends unknown[]> = number extends A['length'] ? A : A['length'] extends 0 ? A : A['length'] extends 1 ? A : A extends [any, ...infer T] ? T extends any[] ? [...Reverse<T>, A[0]] : never : never;
2
7
  //# sourceMappingURL=reverse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../ts/array/reverse.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAClE,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,GACD,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,GAC3B,CAAC,SAAS,GAAG,EAAE,GACd,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GACrB,KAAK,GACN,KAAK,CAAA"}
1
+ {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../ts/array/reverse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAClE,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,GACD,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,GAC3B,CAAC,SAAS,GAAG,EAAE,GACd,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GACrB,KAAK,GACN,KAAK,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { KeyTypes } from '../object/index.js';
2
- import type { Tail } from './tail.js';
2
+ import type { Tail } from '../tuple/tail.js';
3
3
  /**
4
4
  * Gets the union of properties of the elements in `A`
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"union_of_props.d.ts","sourceRoot":"","sources":["../../ts/array/union_of_props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC/F,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACP,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAErC;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"union_of_props.d.ts","sourceRoot":"","sources":["../../ts/array/union_of_props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE5C;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC/F,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACP,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAErC;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA"}
@@ -1,7 +1,10 @@
1
1
  import { type AnyConstructor } from '../class/index.js';
2
2
  import { type AnyFunction } from '../function/any_function.js';
3
3
  /**
4
- * assert the subject satisfies the specified type T
4
+ * 💥 *immediate*
5
+ * 🚦 *assertion*
6
+ *
7
+ * Assert the subject satisfies the specified type T
5
8
  * @type T the type to check against.
6
9
  */
7
10
  export declare function assertType<T>(subject: T): asserts subject is T;