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
@@ -1,8 +1,13 @@
1
- import type { IsNever } from '../never/never_type.js'
1
+ import type { IsNever, NeverType } from '../never/never_type.js'
2
2
 
3
3
  /**
4
- * Check if `T` is a tuple and not an array.
4
+ * 🌪️ *filter*
5
5
  *
6
+ * Filter `T` to ensure it is a tuple, excluding array.
7
+ *
8
+ * @typeParam Cases['never'] Return type when `T` is `never`. Default to `Else`.
9
+ *
10
+ * @example
6
11
  * ```ts
7
12
  * type R = TupleType<[]> // []
8
13
  * type R = TupleType<[1]> // [1]
@@ -13,52 +18,89 @@ import type { IsNever } from '../never/never_type.js'
13
18
  * type R = TupleType<unknown> // never
14
19
  * ```
15
20
  */
16
- export type TupleType<T, Then = T, Else = never> = IsNever<
21
+ export type TupleType<
22
+ T,
23
+ Then = T,
24
+ Else = never,
25
+ Options extends TupleType.Options = TupleType.DefaultOptions<Else>
26
+ > = IsNever<
17
27
  T,
18
- Else,
28
+ Options['caseNever'],
19
29
  [T] extends [any[]] ? (number extends T['length'] ? Else : Then) : Else
20
30
  >
21
31
 
32
+ export namespace TupleType {
33
+ export interface Options extends NeverType.Options {
34
+ }
35
+
36
+ export interface DefaultOptions<Else> {
37
+ caseNever: Else
38
+ }
39
+ }
40
+
41
+
22
42
  /**
23
- * Check if `T` is not a tuple.
43
+ * 🎭 *validate*
44
+ *
45
+ * Validate that `T` is a tuple, excluding array.
24
46
  *
25
47
  * ```ts
26
- * type R = NotTupleType<[]> // never
27
- * type R = NotTupleType<[1]> // never
48
+ * type R = IsTuple<[]> // true
28
49
  *
29
- * type R = NotTupleType<number[]> // number[]
30
- * type R = NotTupleType<string> // string
31
- * type R = NotTupleType<never> // never
32
- * type R = NotTupleType<unknown> // unknown
50
+ * type R = IsTuple<number[]> // false
51
+ * type R = IsTuple<string> // false
52
+ * type R = IsTuple<never> // false
53
+ * type R = IsTuple<unknown> // false
33
54
  * ```
34
55
  */
35
- export type NotTupleType<T, Then = T, Else = never> = TupleType<T, Else, Then>
56
+ export type IsTuple<
57
+ T,
58
+ Then = true,
59
+ Else = false,
60
+ Options extends TupleType.Options = TupleType.DefaultOptions<Else>
61
+ > = TupleType<T, Then, Else, Options>
62
+
36
63
 
37
64
  /**
38
- * Is `T` a tuple and not an array.
65
+ * 🌪️ *filter*
66
+ *
67
+ * Filter `T` to ensure it is not an tuple, excluding array.
39
68
  *
40
69
  * ```ts
41
- * type R = IsTuple<[]> // true
70
+ * type R = NotTupleType<[]> // never
71
+ * type R = NotTupleType<[1]> // never
42
72
  *
43
- * type R = IsTuple<number[]> // false
44
- * type R = IsTuple<string> // false
45
- * type R = IsTuple<never> // false
46
- * type R = IsTuple<unknown> // false
73
+ * type R = NotTupleType<number[]> // number[]
74
+ * type R = NotTupleType<string> // string
75
+ * type R = NotTupleType<never> // never
76
+ * type R = NotTupleType<unknown> // unknown
47
77
  * ```
48
78
  */
49
- export type IsTuple<T, Then = true, Else = false> = TupleType<T, Then, Else>
79
+ export type NotTupleType<
80
+ T,
81
+ Then = T,
82
+ Else = never,
83
+ Options extends TupleType.Options = TupleType.DefaultOptions<Then>
84
+ > = TupleType<T, Else, Then, Options>
50
85
 
51
86
  /**
52
- * Is `T` not a tuple.
87
+ * 🎭 *validate*
88
+ *
89
+ * Validate that `T` is not a tuple, excluding array.
53
90
  *
54
91
  * ```ts
55
92
  * type R = IsNotTuple<[]> // false
56
93
  * type R = IsNotTuple<[1]> // false
57
94
  *
58
- * type R = IsNotTuple<number[]> // false
59
- * type R = IsNotTuple<string> // false
60
- * type R = IsNotTuple<never> // false
61
- * type R = IsNotTuple<unknown> // false
95
+ * type R = IsNotTuple<number[]> // true
96
+ * type R = IsNotTuple<string> // true
97
+ * type R = IsNotTuple<never> // true
98
+ * type R = IsNotTuple<unknown> // true
62
99
  * ```
63
100
  */
64
- export type IsNotTuple<T, Then = true, Else = false> = TupleType<T, Else, Then>
101
+ export type IsNotTuple<
102
+ T,
103
+ Then = true,
104
+ Else = false,
105
+ Options extends TupleType.Options = TupleType.DefaultOptions<Then>
106
+ > = TupleType<T, Else, Then, Options>
@@ -0,0 +1,81 @@
1
+ # union
2
+
3
+ Union type is a type that combines multiple types as union.
4
+
5
+ A value belongs to a union type if it belongs to one (or more) of its member types.
6
+
7
+ For example:
8
+
9
+ ```ts
10
+ type U1 = string | number
11
+
12
+ const u1: U1 = 'a'
13
+ const u2: U1 = 1
14
+ ```
15
+
16
+ As a mental shortcut, you can think of it as an *or* operator.
17
+ But it is better to think of it as union of category instead.
18
+
19
+ ## Union Members
20
+
21
+ Each member of a union type is referred to as the union's member.
22
+
23
+ It is useful to understand the relationship between members of a union type.
24
+
25
+ In this context, we are going to consider types as sets,
26
+ instead of categories, to make it easier to understand.
27
+
28
+ Given two union members of a union,
29
+ their relationship can be describe as "A x B" where "x" is:
30
+
31
+ - disjoint: there is no overlap between A and B (e.g. `number | string`).
32
+ - overlap: there are some overlap between A and B (e.g. `1 | 2` and `2 | 3` has overlap `2`)
33
+ - subset/superset: A is a subset of B (or B is a superset of A) when every element in A is also in B (e.g. `1 | 2` is a subset of `number`)
34
+
35
+ The union type will consider these relations when it is declared.
36
+
37
+ There are other relations between members of a union type,
38
+ which will affect how the union type behaves.
39
+
40
+ For example:
41
+
42
+ - property overlap: e.g. `{ a: 1 } | { a: 2 }`
43
+ - property overlap with extension: e.g. `{ a: 1, b?: 2 } | { a: 1, c?: 3 }`
44
+
45
+ The names of these relations are not properly defined and may change in the future.
46
+
47
+ ## [UnionType](./union.ts#l13)
48
+
49
+ `UnionType<T, Then = T, Else = never>`
50
+
51
+ 🌪️ *filter*
52
+
53
+ Filter the type `T` to ensure it is a union.
54
+
55
+ ```ts
56
+ import type { UnionType } from 'type-plus'
57
+
58
+ type R = UnionType<1 | 2> // 1 | 2
59
+ type R = UnionType<boolean> // boolean
60
+ type R = UnionType<number> // never
61
+ ```
62
+
63
+ ## [IsUnion](./union.ts#l30)
64
+
65
+ 🎭 *validate*
66
+
67
+ Validate that `T` is a union.
68
+
69
+ ```ts
70
+ import type { IsUnion } from 'type-plus'
71
+
72
+ type R = IsUnion<1 | 2> // true
73
+ type R = IsUnion<boolean> // true
74
+ type R = IsUnion<number> // false
75
+ ```
76
+
77
+ ## Reference
78
+
79
+ - [handbook]
80
+
81
+ [handbook]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 🌪️ *filter*
3
+ *
4
+ * Filter the type `T` to ensure it is a union.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * type R = IsUnion<'a' | 'b'> // 'a' | 'b'
9
+ * type R = IsUnion<boolean> // boolean
10
+ * type R = IsUnion<number> // never
11
+ * ```
12
+ */
13
+ export type UnionType<T, Then = T, Else = never> = UnionType.Device<T, Then, Else>
14
+
15
+ /**
16
+ * 🎭 *validate*
17
+ *
18
+ * Validate the type `T` is a union.
19
+ *
20
+ * @author Nurbol Alpysbayev
21
+ * @see https://stackoverflow.com/questions/53953814/typescript-check-if-a-type-is-a-union
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * type R = IsUnion<'a' | 'b'> // true
26
+ * type R = IsUnion<boolean> // true
27
+ * type R = IsUnion<number> // false
28
+ * ```
29
+ */
30
+ export type IsUnion<T, Then = true, Else = false> = UnionType.Device<T, Then, Else>
31
+
32
+ export namespace UnionType {
33
+ export type Device<T, Then, Else, U = T> =
34
+ (T extends unknown ? (U extends T ? 1 : 2) : never) extends 1
35
+ ? Else
36
+ : Then
37
+ }
@@ -53,3 +53,16 @@ export type NotUnknownType<T, Then = T, Else = never> = UnknownType<T, Else, The
53
53
  * ```
54
54
  */
55
55
  export type IsNotUnknown<T, Then = true, Else = false> = UnknownType<T, Else, Then>
56
+
57
+ /**
58
+ * 🌪️ *filter*
59
+ *
60
+ * Returns `T` if `T` is not `unknown`, otherwise `Else`.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * type R = NotUnknownOr<number, string> // number
65
+ * type R = NotUnknownOr<unknown, number> // number
66
+ * ```
67
+ */
68
+ export type NotUnknownOr<T, Else> = UnknownType<T, Else, T>
@@ -0,0 +1,10 @@
1
+
2
+ /**
3
+ * 🦴 *utilities*
4
+ * ㊙️ *internal*
5
+ *
6
+ * Merge the input Options `I` with the default Options `D`.
7
+ */
8
+ export type MergeOptions<I, D> = {
9
+ [k in keyof D]: k extends keyof I ? I[k] : D[k]
10
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.concat.d.ts","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.concat.js","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import type { TupleType } from '../tuple/tuple_type.js';
2
- /**
3
- * Returns the first type in the array or tuple that matches the `Criteria`.
4
- *
5
- * If the `Criteria` is not met, it will return `never'.
6
- *
7
- * For `Array<T>`, it will return `T | undefined` if `T` satisfies `Criteria`.
8
- *
9
- * @example
10
- * ```ts
11
- * ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
12
- *
13
- * ArrayPlus.Find<[true, 1, 'x', 3], string> // 'x'
14
- * ```
15
- */
16
- export type FindFirst<A extends unknown[], Criteria> = TupleType<A, A['length'] extends 0 ? never : A extends [infer Head, ...infer Tail] ? Head extends Criteria ? Head : FindFirst<Tail, Criteria> : never, A extends Array<infer T> ? (T extends Criteria ? T | undefined : never) : never>;
17
- /**
18
- * @deprecated use FindFirst
19
- */
20
- export type First<A extends any[], Criteria> = FindFirst<A, Criteria>;
21
- //# sourceMappingURL=array.find.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.find.d.ts","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,SAAS,CAC/D,CAAC,EACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAClB,KAAK,GACL,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,IAAI,SAAS,QAAQ,GACpB,IAAI,GACJ,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,GAC1B,KAAK,EACR,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,KAAK,CAC/E,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.find.js","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import type { Tail } from './tail.js';
2
- /**
3
- * Gets the common property keys of the elements in `A`.
4
- */
5
- export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0 ? never : A['length'] extends 1 ? keyof A[0] : A['length'] extends 2 ? keyof A[0] & keyof A[1] : keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>;
6
- /**
7
- * Gets the common property keys of the elements in `A`.
8
- * @deprecated Please use CommonPropKeys instead.
9
- */
10
- export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>;
11
- //# sourceMappingURL=common_prop_keys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common_prop_keys.d.ts","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACpF,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GACV,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GACvB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common_prop_keys.js","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- import type { IsEqual } from '../equal/equal.js';
2
- import type { NonNull, NonUndefined } from '../utils/index.js';
3
- export type DropFirst<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [any, ...infer Tail] ? Tail : never;
4
- export type DropLast<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [...infer Heads, any] ? Heads : never;
5
- type ExcludeUnionOfEmptyTuple<A> = IsEqual<A, []> extends true ? A : Exclude<A, []>;
6
- /**
7
- * drops entries matching `Criteria` in array or tuple `A`.
8
- */
9
- export type DropMatch<A extends Readonly<Array<any>>, Criteria> = number extends A['length'] ? A[0] extends Criteria ? never[] : undefined extends Criteria ? null extends Criteria ? Array<NonNullable<A[0]>> : Array<NonUndefined<A[0]>> : null extends Criteria ? Array<NonNull<A[0]>> : Criteria extends A[0] ? Array<Exclude<A[0], Criteria>> : A[0] extends Criteria ? A : Array<Exclude<A[0], Criteria>> : DropMatchTuple<A, Criteria>;
10
- type DropMatchTuple<A extends Readonly<Array<any>>, Criteria> = A['length'] extends 0 ? A : A extends readonly [infer Head, ...infer Tail] ? Tail['length'] extends 0 ? undefined extends Criteria ? ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : Exclude<Head, Criteria> extends never ? DropMatch<Tail, Criteria> : [Exclude<Head, Criteria>, ...DropMatch<Tail, Criteria>] : never[];
11
- export type DropNull<A extends Array<any>> = DropMatch<A, null>;
12
- export type DropNullable<A extends Array<any>> = DropMatch<A, null | undefined>;
13
- export type DropUndefined<A extends Array<any>> = DropMatch<A, undefined>;
14
- /**
15
- * drop a particular value from an array
16
- */
17
- export declare function drop<A extends Readonly<Array<any>>, C>(array: A, value: C): DropMatch<A, C>;
18
- export {};
19
- //# sourceMappingURL=drop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../ts/array/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAChE,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,GAC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CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAE3F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop.js","sourceRoot":"","sources":["../../ts/array/drop.ts"],"names":[],"mappings":";;;AAiEA;;GAEG;AACH,SAAgB,IAAI,CAAoC,KAAQ,EAAE,KAAQ;IACzE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAoB,CAAA;AACzD,CAAC;AAFD,oBAEC"}
@@ -1,17 +0,0 @@
1
- export * from './common_prop_keys.js';
2
- export * from './drop.js';
3
- export * from './filter.js';
4
- export * from './array.find.js';
5
- export * from './array.find_last.js';
6
- export * from './head.js';
7
- export * from './intersect_of_props.js';
8
- export * from './last.js';
9
- export * from './literal_array.js';
10
- export * from './pad_start.js';
11
- export * from './reduce_while.js';
12
- export * from './reverse.js';
13
- export * from './array.some.js';
14
- export * from './tail.js';
15
- export * from './union_of_props.js';
16
- export * from './union_of_values.js';
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./common_prop_keys.js"), exports);
18
- __exportStar(require("./drop.js"), exports);
19
- __exportStar(require("./filter.js"), exports);
20
- __exportStar(require("./array.find.js"), exports);
21
- __exportStar(require("./array.find_last.js"), exports);
22
- __exportStar(require("./head.js"), exports);
23
- __exportStar(require("./intersect_of_props.js"), exports);
24
- __exportStar(require("./last.js"), exports);
25
- __exportStar(require("./literal_array.js"), exports);
26
- __exportStar(require("./pad_start.js"), exports);
27
- __exportStar(require("./reduce_while.js"), exports);
28
- __exportStar(require("./reverse.js"), exports);
29
- __exportStar(require("./array.some.js"), exports);
30
- __exportStar(require("./tail.js"), exports);
31
- __exportStar(require("./union_of_props.js"), exports);
32
- __exportStar(require("./union_of_values.js"), exports);
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,4CAAyB;AACzB,8CAA2B;AAC3B,kDAA+B;AAC/B,uDAAoC;AACpC,4CAAyB;AACzB,0DAAuC;AACvC,4CAAyB;AACzB,qDAAkC;AAClC,iDAA8B;AAC9B,oDAAiC;AACjC,+CAA4B;AAC5B,kDAA+B;AAC/B,4CAAyB;AACzB,sDAAmC;AACnC,uDAAoC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.concat.d.ts","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=array.concat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.concat.js","sourceRoot":"","sources":["../../ts/array/array.concat.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import type { TupleType } from '../tuple/tuple_type.js';
2
- /**
3
- * Returns the first type in the array or tuple that matches the `Criteria`.
4
- *
5
- * If the `Criteria` is not met, it will return `never'.
6
- *
7
- * For `Array<T>`, it will return `T | undefined` if `T` satisfies `Criteria`.
8
- *
9
- * @example
10
- * ```ts
11
- * ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
12
- *
13
- * ArrayPlus.Find<[true, 1, 'x', 3], string> // 'x'
14
- * ```
15
- */
16
- export type FindFirst<A extends unknown[], Criteria> = TupleType<A, A['length'] extends 0 ? never : A extends [infer Head, ...infer Tail] ? Head extends Criteria ? Head : FindFirst<Tail, Criteria> : never, A extends Array<infer T> ? (T extends Criteria ? T | undefined : never) : never>;
17
- /**
18
- * @deprecated use FindFirst
19
- */
20
- export type First<A extends any[], Criteria> = FindFirst<A, Criteria>;
21
- //# sourceMappingURL=array.find.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.find.d.ts","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,QAAQ,IAAI,SAAS,CAC/D,CAAC,EACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAClB,KAAK,GACL,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACrC,IAAI,SAAS,QAAQ,GACpB,IAAI,GACJ,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,GAC1B,KAAK,EACR,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,KAAK,CAC/E,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=array.find.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.find.js","sourceRoot":"","sources":["../../ts/array/array.find.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import type { Tail } from './tail.js';
2
- /**
3
- * Gets the common property keys of the elements in `A`.
4
- */
5
- export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0 ? never : A['length'] extends 1 ? keyof A[0] : A['length'] extends 2 ? keyof A[0] & keyof A[1] : keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>;
6
- /**
7
- * Gets the common property keys of the elements in `A`.
8
- * @deprecated Please use CommonPropKeys instead.
9
- */
10
- export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>;
11
- //# sourceMappingURL=common_prop_keys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common_prop_keys.d.ts","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACpF,KAAK,GACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GACV,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GACvB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1D;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common_prop_keys.js","sourceRoot":"","sources":["../../ts/array/common_prop_keys.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- import type { IsEqual } from '../equal/equal.js';
2
- import type { NonNull, NonUndefined } from '../utils/index.js';
3
- export type DropFirst<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [any, ...infer Tail] ? Tail : never;
4
- export type DropLast<A extends any[]> = number extends A['length'] ? A : A['length'] extends 0 ? never[] : A['length'] extends 1 ? never[] : A extends [...infer Heads, any] ? Heads : never;
5
- type ExcludeUnionOfEmptyTuple<A> = IsEqual<A, []> extends true ? A : Exclude<A, []>;
6
- /**
7
- * drops entries matching `Criteria` in array or tuple `A`.
8
- */
9
- export type DropMatch<A extends Readonly<Array<any>>, Criteria> = number extends A['length'] ? A[0] extends Criteria ? never[] : undefined extends Criteria ? null extends Criteria ? Array<NonNullable<A[0]>> : Array<NonUndefined<A[0]>> : null extends Criteria ? Array<NonNull<A[0]>> : Criteria extends A[0] ? Array<Exclude<A[0], Criteria>> : A[0] extends Criteria ? A : Array<Exclude<A[0], Criteria>> : DropMatchTuple<A, Criteria>;
10
- type DropMatchTuple<A extends Readonly<Array<any>>, Criteria> = A['length'] extends 0 ? A : A extends readonly [infer Head, ...infer Tail] ? Tail['length'] extends 0 ? undefined extends Criteria ? ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : ExcludeUnionOfEmptyTuple<Head extends Criteria ? [] : [Head]> : Exclude<Head, Criteria> extends never ? DropMatch<Tail, Criteria> : [Exclude<Head, Criteria>, ...DropMatch<Tail, Criteria>] : never[];
11
- export type DropNull<A extends Array<any>> = DropMatch<A, null>;
12
- export type DropNullable<A extends Array<any>> = DropMatch<A, null | undefined>;
13
- export type DropUndefined<A extends Array<any>> = DropMatch<A, undefined>;
14
- /**
15
- * drop a particular value from an array
16
- */
17
- export declare function drop<A extends Readonly<Array<any>>, C>(array: A, value: C): DropMatch<A, C>;
18
- export {};
19
- //# sourceMappingURL=drop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../ts/array/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GAChE,CAAC,GACD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GACrB,KAAK,EAAE,GACP,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,GAC9B,IAAI,GACJ,KAAK,CAAA;AAER,MAAM,MAAM,QAAQ,CAAC,C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,CAAC,CAAC,CAE3F"}
package/esm/array/drop.js DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * drop a particular value from an array
3
- */
4
- export function drop(array, value) {
5
- return array.filter(v => v !== value);
6
- }
7
- //# sourceMappingURL=drop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop.js","sourceRoot":"","sources":["../../ts/array/drop.ts"],"names":[],"mappings":"AAiEA;;GAEG;AACH,MAAM,UAAU,IAAI,CAAoC,KAAQ,EAAE,KAAQ;IACzE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAoB,CAAA;AACzD,CAAC"}
@@ -1,17 +0,0 @@
1
- export * from './common_prop_keys.js';
2
- export * from './drop.js';
3
- export * from './filter.js';
4
- export * from './array.find.js';
5
- export * from './array.find_last.js';
6
- export * from './head.js';
7
- export * from './intersect_of_props.js';
8
- export * from './last.js';
9
- export * from './literal_array.js';
10
- export * from './pad_start.js';
11
- export * from './reduce_while.js';
12
- export * from './reverse.js';
13
- export * from './array.some.js';
14
- export * from './tail.js';
15
- export * from './union_of_props.js';
16
- export * from './union_of_values.js';
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
@@ -1,17 +0,0 @@
1
- export * from './common_prop_keys.js';
2
- export * from './drop.js';
3
- export * from './filter.js';
4
- export * from './array.find.js';
5
- export * from './array.find_last.js';
6
- export * from './head.js';
7
- export * from './intersect_of_props.js';
8
- export * from './last.js';
9
- export * from './literal_array.js';
10
- export * from './pad_start.js';
11
- export * from './reduce_while.js';
12
- export * from './reverse.js';
13
- export * from './array.some.js';
14
- export * from './tail.js';
15
- export * from './union_of_props.js';
16
- export * from './union_of_values.js';
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,yBAAyB,CAAA;AACvC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
@@ -1,32 +0,0 @@
1
- import type { TupleType } from '../tuple/tuple_type.js'
2
-
3
- /**
4
- * Returns the first type in the array or tuple that matches the `Criteria`.
5
- *
6
- * If the `Criteria` is not met, it will return `never'.
7
- *
8
- * For `Array<T>`, it will return `T | undefined` if `T` satisfies `Criteria`.
9
- *
10
- * @example
11
- * ```ts
12
- * ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
13
- *
14
- * ArrayPlus.Find<[true, 1, 'x', 3], string> // 'x'
15
- * ```
16
- */
17
- export type FindFirst<A extends unknown[], Criteria> = TupleType<
18
- A,
19
- A['length'] extends 0
20
- ? never
21
- : A extends [infer Head, ...infer Tail]
22
- ? Head extends Criteria
23
- ? Head
24
- : FindFirst<Tail, Criteria>
25
- : never,
26
- A extends Array<infer T> ? (T extends Criteria ? T | undefined : never) : never
27
- >
28
-
29
- /**
30
- * @deprecated use FindFirst
31
- */
32
- export type First<A extends any[], Criteria> = FindFirst<A, Criteria>
@@ -1,18 +0,0 @@
1
- import type { Tail } from './tail.js'
2
-
3
- /**
4
- * Gets the common property keys of the elements in `A`.
5
- */
6
- export type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0
7
- ? never
8
- : A['length'] extends 1
9
- ? keyof A[0]
10
- : A['length'] extends 2
11
- ? keyof A[0] & keyof A[1]
12
- : keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>
13
-
14
- /**
15
- * Gets the common property keys of the elements in `A`.
16
- * @deprecated Please use CommonPropKeys instead.
17
- */
18
- export type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>