ts-data-forge 14.6.1 → 14.6.2

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 (393) hide show
  1. package/dist/array/impl/array-utils-creation.mjs +126 -26
  2. package/dist/array/impl/array-utils-creation.mjs.map +1 -1
  3. package/dist/array/impl/array-utils-element-access.mjs +63 -30
  4. package/dist/array/impl/array-utils-element-access.mjs.map +1 -1
  5. package/dist/array/impl/array-utils-iterators.mjs +69 -53
  6. package/dist/array/impl/array-utils-iterators.mjs.map +1 -1
  7. package/dist/array/impl/array-utils-length-bounded-array-cast.mjs +109 -73
  8. package/dist/array/impl/array-utils-length-bounded-array-cast.mjs.map +1 -1
  9. package/dist/array/impl/array-utils-length-bounded-array-guard.mjs +71 -33
  10. package/dist/array/impl/array-utils-length-bounded-array-guard.mjs.map +1 -1
  11. package/dist/array/impl/array-utils-length-bounded-tuple-cast.mjs +102 -73
  12. package/dist/array/impl/array-utils-length-bounded-tuple-cast.mjs.map +1 -1
  13. package/dist/array/impl/array-utils-length-bounded-tuple-guard.mjs +77 -33
  14. package/dist/array/impl/array-utils-length-bounded-tuple-guard.mjs.map +1 -1
  15. package/dist/array/impl/array-utils-modification.mjs +75 -122
  16. package/dist/array/impl/array-utils-modification.mjs.map +1 -1
  17. package/dist/array/impl/array-utils-reducing-value.mjs +100 -150
  18. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  19. package/dist/array/impl/array-utils-search.mjs +110 -134
  20. package/dist/array/impl/array-utils-search.mjs.map +1 -1
  21. package/dist/array/impl/array-utils-set-op.mjs +146 -38
  22. package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
  23. package/dist/array/impl/array-utils-size.mjs +10 -8
  24. package/dist/array/impl/array-utils-size.mjs.map +1 -1
  25. package/dist/array/impl/array-utils-slice-clamped.mjs +13 -50
  26. package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
  27. package/dist/array/impl/array-utils-slicing.mjs +94 -78
  28. package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
  29. package/dist/array/impl/array-utils-transformation.mjs +291 -199
  30. package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
  31. package/dist/array/impl/array-utils-validation.mjs +54 -56
  32. package/dist/array/impl/array-utils-validation.mjs.map +1 -1
  33. package/dist/array/impl/index.mjs +17 -17
  34. package/dist/array/impl/index.mjs.map +1 -1
  35. package/dist/array/index.mjs +2 -3
  36. package/dist/array/index.mjs.map +1 -1
  37. package/dist/collections/imap-mapped.mjs +335 -292
  38. package/dist/collections/imap-mapped.mjs.map +1 -1
  39. package/dist/collections/imap.mjs +280 -239
  40. package/dist/collections/imap.mjs.map +1 -1
  41. package/dist/collections/index.mjs +7 -7
  42. package/dist/collections/index.mjs.map +1 -1
  43. package/dist/collections/iset-mapped.mjs +448 -265
  44. package/dist/collections/iset-mapped.mjs.map +1 -1
  45. package/dist/collections/iset.mjs +328 -201
  46. package/dist/collections/iset.mjs.map +1 -1
  47. package/dist/collections/queue.mjs +183 -151
  48. package/dist/collections/queue.mjs.map +1 -1
  49. package/dist/collections/stack.mjs +169 -140
  50. package/dist/collections/stack.mjs.map +1 -1
  51. package/dist/entry-point.mjs +4 -77
  52. package/dist/entry-point.mjs.map +1 -1
  53. package/dist/expect-type.mjs +70 -4
  54. package/dist/expect-type.mjs.map +1 -1
  55. package/dist/functional/async-result/async-result.mjs +2 -3
  56. package/dist/functional/async-result/async-result.mjs.map +1 -1
  57. package/dist/functional/async-result/impl/async-result-flat-map.mjs +19 -21
  58. package/dist/functional/async-result/impl/async-result-flat-map.mjs.map +1 -1
  59. package/dist/functional/async-result/impl/async-result-from-promise.mjs +9 -10
  60. package/dist/functional/async-result/impl/async-result-from-promise.mjs.map +1 -1
  61. package/dist/functional/async-result/impl/async-result-from-throwable.mjs +12 -14
  62. package/dist/functional/async-result/impl/async-result-from-throwable.mjs.map +1 -1
  63. package/dist/functional/async-result/impl/async-result-map-err.mjs +16 -19
  64. package/dist/functional/async-result/impl/async-result-map-err.mjs.map +1 -1
  65. package/dist/functional/async-result/impl/async-result-map.mjs +16 -19
  66. package/dist/functional/async-result/impl/async-result-map.mjs.map +1 -1
  67. package/dist/functional/async-result/impl/async-result-unwrap-or.mjs +36 -9
  68. package/dist/functional/async-result/impl/async-result-unwrap-or.mjs.map +1 -1
  69. package/dist/functional/async-result/impl/index.mjs +8 -7
  70. package/dist/functional/async-result/impl/index.mjs.map +1 -1
  71. package/dist/functional/async-result/impl/types.mjs +2 -2
  72. package/dist/functional/async-result/impl/types.mjs.map +1 -1
  73. package/dist/functional/async-result/index.mjs +2 -3
  74. package/dist/functional/async-result/index.mjs.map +1 -1
  75. package/dist/functional/index.mjs +7 -11
  76. package/dist/functional/index.mjs.map +1 -1
  77. package/dist/functional/match.mjs +27 -13
  78. package/dist/functional/match.mjs.map +1 -1
  79. package/dist/functional/optional/impl/index.mjs +19 -18
  80. package/dist/functional/optional/impl/index.mjs.map +1 -1
  81. package/dist/functional/optional/impl/optional-expect-to-be.mjs +16 -18
  82. package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
  83. package/dist/functional/optional/impl/optional-filter.mjs +17 -19
  84. package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
  85. package/dist/functional/optional/impl/optional-flat-map.mjs +13 -15
  86. package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
  87. package/dist/functional/optional/impl/optional-from-nullable.mjs +26 -5
  88. package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
  89. package/dist/functional/optional/impl/optional-is-none.mjs +21 -5
  90. package/dist/functional/optional/impl/optional-is-none.mjs.map +1 -1
  91. package/dist/functional/optional/impl/optional-is-optional.mjs +26 -8
  92. package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
  93. package/dist/functional/optional/impl/optional-is-some.mjs +22 -5
  94. package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
  95. package/dist/functional/optional/impl/optional-map.mjs +16 -18
  96. package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
  97. package/dist/functional/optional/impl/optional-match.mjs +16 -18
  98. package/dist/functional/optional/impl/optional-match.mjs.map +1 -1
  99. package/dist/functional/optional/impl/optional-none.mjs +18 -5
  100. package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
  101. package/dist/functional/optional/impl/optional-or-else.mjs +13 -15
  102. package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
  103. package/dist/functional/optional/impl/optional-some.mjs +23 -7
  104. package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
  105. package/dist/functional/optional/impl/optional-to-nullable.mjs +28 -5
  106. package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
  107. package/dist/functional/optional/impl/optional-unwrap-or.mjs +12 -14
  108. package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
  109. package/dist/functional/optional/impl/optional-unwrap-throw.mjs +34 -9
  110. package/dist/functional/optional/impl/optional-unwrap-throw.mjs.map +1 -1
  111. package/dist/functional/optional/impl/optional-unwrap.mjs +6 -9
  112. package/dist/functional/optional/impl/optional-unwrap.mjs.map +1 -1
  113. package/dist/functional/optional/impl/optional-zip.mjs +36 -5
  114. package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
  115. package/dist/functional/optional/impl/tag.mjs +4 -5
  116. package/dist/functional/optional/impl/tag.mjs.map +1 -1
  117. package/dist/functional/optional/impl/types.mjs +2 -2
  118. package/dist/functional/optional/impl/types.mjs.map +1 -1
  119. package/dist/functional/optional/index.mjs +2 -3
  120. package/dist/functional/optional/index.mjs.map +1 -1
  121. package/dist/functional/optional/optional.mjs +2 -3
  122. package/dist/functional/optional/optional.mjs.map +1 -1
  123. package/dist/functional/pipe.mjs +42 -14
  124. package/dist/functional/pipe.mjs.map +1 -1
  125. package/dist/functional/result/impl/index.mjs +28 -27
  126. package/dist/functional/result/impl/index.mjs.map +1 -1
  127. package/dist/functional/result/impl/result-err.mjs +29 -7
  128. package/dist/functional/result/impl/result-err.mjs.map +1 -1
  129. package/dist/functional/result/impl/result-expect-to-be.mjs +17 -18
  130. package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
  131. package/dist/functional/result/impl/result-flat-map.mjs +18 -21
  132. package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
  133. package/dist/functional/result/impl/result-fold.mjs +18 -21
  134. package/dist/functional/result/impl/result-fold.mjs.map +1 -1
  135. package/dist/functional/result/impl/result-from-optional.mjs +17 -20
  136. package/dist/functional/result/impl/result-from-optional.mjs.map +1 -1
  137. package/dist/functional/result/impl/result-from-promise.mjs +37 -8
  138. package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
  139. package/dist/functional/result/impl/result-from-throwable.mjs +41 -14
  140. package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
  141. package/dist/functional/result/impl/result-is-err.mjs +21 -5
  142. package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
  143. package/dist/functional/result/impl/result-is-ok.mjs +21 -5
  144. package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
  145. package/dist/functional/result/impl/result-is-result.mjs +25 -7
  146. package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
  147. package/dist/functional/result/impl/result-map-err.mjs +18 -21
  148. package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
  149. package/dist/functional/result/impl/result-map.mjs +18 -21
  150. package/dist/functional/result/impl/result-map.mjs.map +1 -1
  151. package/dist/functional/result/impl/result-match.mjs +17 -21
  152. package/dist/functional/result/impl/result-match.mjs.map +1 -1
  153. package/dist/functional/result/impl/result-ok.mjs +29 -7
  154. package/dist/functional/result/impl/result-ok.mjs.map +1 -1
  155. package/dist/functional/result/impl/result-or-else.mjs +14 -15
  156. package/dist/functional/result/impl/result-or-else.mjs.map +1 -1
  157. package/dist/functional/result/impl/result-safe-try.mjs +32 -21
  158. package/dist/functional/result/impl/result-safe-try.mjs.map +1 -1
  159. package/dist/functional/result/impl/result-safe-unwrap.mjs +40 -12
  160. package/dist/functional/result/impl/result-safe-unwrap.mjs.map +1 -1
  161. package/dist/functional/result/impl/result-swap.mjs +23 -8
  162. package/dist/functional/result/impl/result-swap.mjs.map +1 -1
  163. package/dist/functional/result/impl/result-to-optional.mjs +30 -7
  164. package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
  165. package/dist/functional/result/impl/result-unwrap-err-or.mjs +13 -14
  166. package/dist/functional/result/impl/result-unwrap-err-or.mjs.map +1 -1
  167. package/dist/functional/result/impl/result-unwrap-err-throw.mjs +43 -20
  168. package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
  169. package/dist/functional/result/impl/result-unwrap-err.mjs +33 -8
  170. package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
  171. package/dist/functional/result/impl/result-unwrap-ok-or.mjs +13 -14
  172. package/dist/functional/result/impl/result-unwrap-ok-or.mjs.map +1 -1
  173. package/dist/functional/result/impl/result-unwrap-ok.mjs +6 -9
  174. package/dist/functional/result/impl/result-unwrap-ok.mjs.map +1 -1
  175. package/dist/functional/result/impl/result-unwrap-throw.mjs +38 -11
  176. package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
  177. package/dist/functional/result/impl/result-zip.mjs +35 -5
  178. package/dist/functional/result/impl/result-zip.mjs.map +1 -1
  179. package/dist/functional/result/impl/tag.mjs +4 -5
  180. package/dist/functional/result/impl/tag.mjs.map +1 -1
  181. package/dist/functional/result/impl/types.mjs +2 -2
  182. package/dist/functional/result/impl/types.mjs.map +1 -1
  183. package/dist/functional/result/index.mjs +2 -3
  184. package/dist/functional/result/index.mjs.map +1 -1
  185. package/dist/functional/result/result.mjs +2 -3
  186. package/dist/functional/result/result.mjs.map +1 -1
  187. package/dist/functional/ternary-result/impl/index.mjs +29 -28
  188. package/dist/functional/ternary-result/impl/index.mjs.map +1 -1
  189. package/dist/functional/ternary-result/impl/tag.mjs +6 -6
  190. package/dist/functional/ternary-result/impl/tag.mjs.map +1 -1
  191. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +17 -7
  192. package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
  193. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs +15 -18
  194. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -1
  195. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs +28 -32
  196. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
  197. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs +24 -26
  198. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -1
  199. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +21 -8
  200. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -1
  201. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +28 -13
  202. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -1
  203. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs +19 -5
  204. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs.map +1 -1
  205. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +21 -5
  206. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -1
  207. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +28 -8
  208. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -1
  209. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +20 -5
  210. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -1
  211. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs +17 -18
  212. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -1
  213. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs +20 -23
  214. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -1
  215. package/dist/functional/ternary-result/impl/ternary-result-map.mjs +24 -26
  216. package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -1
  217. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs +18 -7
  218. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
  219. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs +11 -14
  220. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -1
  221. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +24 -10
  222. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -1
  223. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs +11 -14
  224. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -1
  225. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +30 -19
  226. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
  227. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +20 -8
  228. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -1
  229. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs +11 -14
  230. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -1
  231. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs +7 -9
  232. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -1
  233. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +30 -22
  234. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
  235. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs +11 -14
  236. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -1
  237. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +27 -17
  238. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
  239. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +20 -8
  240. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -1
  241. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs +21 -8
  242. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
  243. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +47 -19
  244. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -1
  245. package/dist/functional/ternary-result/impl/types.mjs +2 -2
  246. package/dist/functional/ternary-result/impl/types.mjs.map +1 -1
  247. package/dist/functional/ternary-result/impl/variant-name.mjs +12 -14
  248. package/dist/functional/ternary-result/impl/variant-name.mjs.map +1 -1
  249. package/dist/functional/ternary-result/index.mjs +2 -3
  250. package/dist/functional/ternary-result/index.mjs.map +1 -1
  251. package/dist/functional/ternary-result/ternary-result.mjs +2 -3
  252. package/dist/functional/ternary-result/ternary-result.mjs.map +1 -1
  253. package/dist/guard/has-key.mjs +43 -4
  254. package/dist/guard/has-key.mjs.map +1 -1
  255. package/dist/guard/index.mjs +8 -8
  256. package/dist/guard/index.mjs.map +1 -1
  257. package/dist/guard/is-non-empty-string.mjs +39 -4
  258. package/dist/guard/is-non-empty-string.mjs.map +1 -1
  259. package/dist/guard/is-non-null-object.mjs +36 -4
  260. package/dist/guard/is-non-null-object.mjs.map +1 -1
  261. package/dist/guard/is-primitive.mjs +46 -15
  262. package/dist/guard/is-primitive.mjs.map +1 -1
  263. package/dist/guard/is-record.mjs +89 -6
  264. package/dist/guard/is-record.mjs.map +1 -1
  265. package/dist/guard/is-type.mjs +404 -19
  266. package/dist/guard/is-type.mjs.map +1 -1
  267. package/dist/guard/key-is-in.mjs +42 -4
  268. package/dist/guard/key-is-in.mjs.map +1 -1
  269. package/dist/index.mjs +12 -65
  270. package/dist/index.mjs.map +1 -1
  271. package/dist/iterator/index.mjs +2 -2
  272. package/dist/iterator/index.mjs.map +1 -1
  273. package/dist/iterator/range.mjs +19 -57
  274. package/dist/iterator/range.mjs.map +1 -1
  275. package/dist/json/index.mjs +2 -2
  276. package/dist/json/index.mjs.map +1 -1
  277. package/dist/json/json.mjs +346 -105
  278. package/dist/json/json.mjs.map +1 -1
  279. package/dist/number/branded-types/finite-number.mjs +148 -137
  280. package/dist/number/branded-types/finite-number.mjs.map +1 -1
  281. package/dist/number/branded-types/index.mjs +33 -33
  282. package/dist/number/branded-types/index.mjs.map +1 -1
  283. package/dist/number/branded-types/int.mjs +245 -209
  284. package/dist/number/branded-types/int.mjs.map +1 -1
  285. package/dist/number/branded-types/int16.mjs +141 -131
  286. package/dist/number/branded-types/int16.mjs.map +1 -1
  287. package/dist/number/branded-types/int32.mjs +141 -131
  288. package/dist/number/branded-types/int32.mjs.map +1 -1
  289. package/dist/number/branded-types/negative-finite-number.mjs +155 -149
  290. package/dist/number/branded-types/negative-finite-number.mjs.map +1 -1
  291. package/dist/number/branded-types/negative-int.mjs +125 -110
  292. package/dist/number/branded-types/negative-int.mjs.map +1 -1
  293. package/dist/number/branded-types/negative-safe-int.mjs +126 -115
  294. package/dist/number/branded-types/negative-safe-int.mjs.map +1 -1
  295. package/dist/number/branded-types/non-negative-finite-number.mjs +164 -154
  296. package/dist/number/branded-types/non-negative-finite-number.mjs.map +1 -1
  297. package/dist/number/branded-types/non-negative-int16.mjs +137 -125
  298. package/dist/number/branded-types/non-negative-int16.mjs.map +1 -1
  299. package/dist/number/branded-types/non-negative-int32.mjs +137 -125
  300. package/dist/number/branded-types/non-negative-int32.mjs.map +1 -1
  301. package/dist/number/branded-types/non-positive-finite-number.mjs +143 -139
  302. package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -1
  303. package/dist/number/branded-types/non-positive-int.mjs +116 -99
  304. package/dist/number/branded-types/non-positive-int.mjs.map +1 -1
  305. package/dist/number/branded-types/non-positive-safe-int.mjs +118 -107
  306. package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -1
  307. package/dist/number/branded-types/non-zero-finite-number.mjs +144 -129
  308. package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
  309. package/dist/number/branded-types/non-zero-int.mjs +102 -82
  310. package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
  311. package/dist/number/branded-types/non-zero-int16.mjs +118 -105
  312. package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
  313. package/dist/number/branded-types/non-zero-int32.mjs +118 -105
  314. package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
  315. package/dist/number/branded-types/non-zero-safe-int.mjs +122 -108
  316. package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
  317. package/dist/number/branded-types/non-zero-uint16.mjs +118 -104
  318. package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
  319. package/dist/number/branded-types/non-zero-uint32.mjs +118 -104
  320. package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
  321. package/dist/number/branded-types/positive-finite-number.mjs +167 -160
  322. package/dist/number/branded-types/positive-finite-number.mjs.map +1 -1
  323. package/dist/number/branded-types/positive-int.mjs +260 -224
  324. package/dist/number/branded-types/positive-int.mjs.map +1 -1
  325. package/dist/number/branded-types/positive-int16.mjs +134 -122
  326. package/dist/number/branded-types/positive-int16.mjs.map +1 -1
  327. package/dist/number/branded-types/positive-int32.mjs +134 -122
  328. package/dist/number/branded-types/positive-int32.mjs.map +1 -1
  329. package/dist/number/branded-types/positive-safe-int.mjs +292 -258
  330. package/dist/number/branded-types/positive-safe-int.mjs.map +1 -1
  331. package/dist/number/branded-types/positive-uint16.mjs +134 -122
  332. package/dist/number/branded-types/positive-uint16.mjs.map +1 -1
  333. package/dist/number/branded-types/positive-uint32.mjs +134 -122
  334. package/dist/number/branded-types/positive-uint32.mjs.map +1 -1
  335. package/dist/number/branded-types/safe-int.mjs +284 -255
  336. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  337. package/dist/number/branded-types/safe-uint.mjs +135 -124
  338. package/dist/number/branded-types/safe-uint.mjs.map +1 -1
  339. package/dist/number/branded-types/uint.mjs +248 -211
  340. package/dist/number/branded-types/uint.mjs.map +1 -1
  341. package/dist/number/branded-types/uint16.mjs +132 -121
  342. package/dist/number/branded-types/uint16.mjs.map +1 -1
  343. package/dist/number/branded-types/uint32.mjs +132 -121
  344. package/dist/number/branded-types/uint32.mjs.map +1 -1
  345. package/dist/number/enum/index.mjs +3 -3
  346. package/dist/number/enum/index.mjs.map +1 -1
  347. package/dist/number/enum/int8.mjs +146 -131
  348. package/dist/number/enum/int8.mjs.map +1 -1
  349. package/dist/number/enum/uint8.mjs +133 -119
  350. package/dist/number/enum/uint8.mjs.map +1 -1
  351. package/dist/number/index.mjs +6 -37
  352. package/dist/number/index.mjs.map +1 -1
  353. package/dist/number/num-arithmetic-types.mjs +42 -1
  354. package/dist/number/num-arithmetic-types.mjs.map +1 -1
  355. package/dist/number/num.mjs +541 -83
  356. package/dist/number/num.mjs.map +1 -1
  357. package/dist/number/refined-number-utils.mjs +294 -133
  358. package/dist/number/refined-number-utils.mjs.map +1 -1
  359. package/dist/object/index.mjs +2 -2
  360. package/dist/object/index.mjs.map +1 -1
  361. package/dist/object/object.mjs +355 -202
  362. package/dist/object/object.mjs.map +1 -1
  363. package/dist/others/cast-mutable.mjs +38 -11
  364. package/dist/others/cast-mutable.mjs.map +1 -1
  365. package/dist/others/cast-readonly.mjs +37 -11
  366. package/dist/others/cast-readonly.mjs.map +1 -1
  367. package/dist/others/debounce-function.mjs +22 -11
  368. package/dist/others/debounce-function.mjs.map +1 -1
  369. package/dist/others/fast-deep-equal.mjs +70 -51
  370. package/dist/others/fast-deep-equal.mjs.map +1 -1
  371. package/dist/others/if-then.mjs +32 -5
  372. package/dist/others/if-then.mjs.map +1 -1
  373. package/dist/others/index.mjs +10 -10
  374. package/dist/others/index.mjs.map +1 -1
  375. package/dist/others/map-nullable.mjs +11 -13
  376. package/dist/others/map-nullable.mjs.map +1 -1
  377. package/dist/others/memoize-function.mjs +14 -16
  378. package/dist/others/memoize-function.mjs.map +1 -1
  379. package/dist/others/tuple.mjs +52 -4
  380. package/dist/others/tuple.mjs.map +1 -1
  381. package/dist/others/unknown-to-string.mjs +91 -47
  382. package/dist/others/unknown-to-string.mjs.map +1 -1
  383. package/dist/promise/index.mjs +2 -2
  384. package/dist/promise/index.mjs.map +1 -1
  385. package/dist/promise/promise.mjs +51 -10
  386. package/dist/promise/promise.mjs.map +1 -1
  387. package/dist/string/index.mjs +2 -2
  388. package/dist/string/index.mjs.map +1 -1
  389. package/dist/string/str.mjs +250 -83
  390. package/dist/string/str.mjs.map +1 -1
  391. package/dist/types.mjs +3 -2
  392. package/dist/types.mjs.map +1 -1
  393. package/package.json +5 -6
@@ -1,20 +1,30 @@
1
- import '@sindresorhus/is';
2
- import { unknownToString } from '../../../others/unknown-to-string.mjs';
1
+ import { unknownToString } from '../../../others/index.mjs';
3
2
  import { isWarn } from './ternary-result-is-warn.mjs';
4
3
  import { variantName } from './variant-name.mjs';
5
-
6
- const unwrapWarnThrow = (result, toStr = unknownToString) => {
7
- if (isWarn(result)) {
8
- return result.warning;
9
- }
10
- const variant = variantName(result.$$tag);
11
- throw new Error(
12
- `Expected Warn but got ${variant}: ${toStr(
13
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
14
- result.value
15
- )}`
16
- );
4
+ /**
5
+ * Returns the Warn value or throws if the result is not Warn.
6
+ *
7
+ * @example
8
+ *
9
+ * ```ts
10
+ * const warnValue = TernaryResult.warn('pending', 'check logs');
11
+ *
12
+ * assert.strictEqual(TernaryResult.unwrapWarnThrow(warnValue), 'check logs');
13
+ *
14
+ * assert.throws(
15
+ * () => TernaryResult.unwrapWarnThrow(TernaryResult.err('err')),
16
+ * /Expected Warn/u,
17
+ * );
18
+ * ```
19
+ */
20
+ export const unwrapWarnThrow = (result, toStr = unknownToString) => {
21
+ if (isWarn(result)) {
22
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
23
+ return result.warning;
24
+ }
25
+ const variant = variantName(result.$$tag);
26
+ throw new Error(`Expected Warn but got ${variant}: ${toStr(
27
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
28
+ result.value)}`);
17
29
  };
18
-
19
- export { unwrapWarnThrow };
20
- //# sourceMappingURL=ternary-result-unwrap-warn-throw.mjs.map
30
+ //# sourceMappingURL=ternary-result-unwrap-warn-throw.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-warn-throw.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts"],"sourcesContent":["import { unknownToString } from '../../../others/index.mjs';\nimport { type UnknownTernaryResult } from '../ternary-result.mjs';\nimport { isWarn } from './ternary-result-is-warn.mjs';\nimport { type UnwrapErr, type UnwrapOk, type UnwrapWarn } from './types.mjs';\nimport { variantName } from './variant-name.mjs';\n\n/**\n * Returns the Warn value or throws if the result is not Warn.\n *\n * @example\n *\n * ```ts\n * const warnValue = TernaryResult.warn('pending', 'check logs');\n *\n * assert.strictEqual(TernaryResult.unwrapWarnThrow(warnValue), 'check logs');\n *\n * assert.throws(\n * () => TernaryResult.unwrapWarnThrow(TernaryResult.err('err')),\n * /Expected Warn/u,\n * );\n * ```\n */\nexport const unwrapWarnThrow = <R extends UnknownTernaryResult>(\n result: R,\n toStr: (value: UnwrapOk<R> | UnwrapErr<R>) => string = unknownToString,\n): UnwrapWarn<R> => {\n if (isWarn(result)) {\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n return result.warning as UnwrapWarn<R>;\n }\n\n const variant = variantName(result.$$tag);\n\n throw new Error(\n `Expected Warn but got ${variant}: ${toStr(\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n result.value as UnwrapOk<R> | UnwrapErr<R>,\n )}`,\n );\n};\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,eAAA,GAAkB,CAC7B,MAAA,EACA,KAAA,GAAuD,eAAA,KACrC;AAClB,EAAA,IAAI,MAAA,CAAO,MAAM,CAAA,EAAG;AAElB,IAAA,OAAO,MAAA,CAAO,OAAA;AAAA,EAChB;AAEA,EAAA,MAAM,OAAA,GAAU,WAAA,CAAY,MAAA,CAAO,KAAK,CAAA;AAExC,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,CAAA,sBAAA,EAAyB,OAAO,CAAA,EAAA,EAAK,KAAA;AAAA;AAAA,MAEnC,MAAA,CAAO;AAAA,KACR,CAAA;AAAA,GACH;AACF;;;;"}
1
+ {"version":3,"file":"ternary-result-unwrap-warn-throw.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAS,EACT,KAAK,GAAkD,eAAe,EACvD,EAAE;IACjB,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,oEAAoE;QACpE,OAAO,MAAM,CAAC,OAAwB,CAAC;IACzC,CAAC;IAED,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,IAAI,KAAK,CACb,yBAAyB,OAAO,KAAK,KAAK;IACxC,oEAAoE;IACpE,MAAM,CAAC,KAAmC,CAC3C,EAAE,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,9 +1,21 @@
1
1
  import { isWarn } from './ternary-result-is-warn.mjs';
2
-
3
- const unwrapWarn = (result) => (
4
- // eslint-disable-next-line total-functions/no-unsafe-type-assertion
5
- isWarn(result) ? result.warning : void 0
6
- );
7
-
8
- export { unwrapWarn };
9
- //# sourceMappingURL=ternary-result-unwrap-warn.mjs.map
2
+ /**
3
+ * Safely unwraps the Warn value.
4
+ *
5
+ * @example
6
+ *
7
+ * ```ts
8
+ * const warnValue = TernaryResult.warn('ok', 'careful');
9
+ *
10
+ * const okValue = TernaryResult.ok('ok');
11
+ *
12
+ * assert.strictEqual(TernaryResult.unwrapWarn(warnValue), 'careful');
13
+ *
14
+ * // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
15
+ * assert.strictEqual(TernaryResult.unwrapWarn(okValue), undefined);
16
+ * ```
17
+ */
18
+ export const unwrapWarn = (result) =>
19
+ // eslint-disable-next-line total-functions/no-unsafe-type-assertion
20
+ isWarn(result) ? result.warning : undefined;
21
+ //# sourceMappingURL=ternary-result-unwrap-warn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-unwrap-warn.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts"],"sourcesContent":["import { type UnknownTernaryResult } from '../ternary-result.mjs';\nimport { isWarn } from './ternary-result-is-warn.mjs';\nimport { type UnwrapWarn } from './types.mjs';\n\n/**\n * Safely unwraps the Warn value.\n *\n * @example\n *\n * ```ts\n * const warnValue = TernaryResult.warn('ok', 'careful');\n *\n * const okValue = TernaryResult.ok('ok');\n *\n * assert.strictEqual(TernaryResult.unwrapWarn(warnValue), 'careful');\n *\n * // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n * assert.strictEqual(TernaryResult.unwrapWarn(okValue), undefined);\n * ```\n */\nexport const unwrapWarn = <R extends UnknownTernaryResult>(\n result: R,\n): UnwrapWarn<R> | undefined =>\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n isWarn(result) ? (result.warning as UnwrapWarn<R>) : undefined;\n"],"names":[],"mappings":";;AAoBO,MAAM,aAAa,CACxB,MAAA;AAAA;AAAA,EAGA,MAAA,CAAO,MAAM,CAAA,GAAK,MAAA,CAAO,OAAA,GAA4B;AAAA;;;;"}
1
+ {"version":3,"file":"ternary-result-unwrap-warn.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,MAAS,EACkB,EAAE;AAC7B,oEAAoE;AACpE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAAM,CAAC,OAAyB,CAAC,CAAC,CAAC,SAAS,CAAC"}
@@ -1,10 +1,23 @@
1
1
  import { WarnTypeTagName } from './tag.mjs';
2
-
3
- const warn = (value, warning) => ({
4
- $$tag: WarnTypeTagName,
5
- value,
6
- warning
2
+ /**
3
+ * Creates a `TernaryResult.Warn` containing the provided success value and
4
+ * warning.
5
+ *
6
+ * @example
7
+ *
8
+ * ```ts
9
+ * const caution = TernaryResult.warn({ id: 1 }, 'Needs review');
10
+ *
11
+ * assert.deepStrictEqual(caution, {
12
+ * $$tag: 'ts-data-forge::Result.warn',
13
+ * value: { id: 1 },
14
+ * warning: 'Needs review',
15
+ * });
16
+ * ```
17
+ */
18
+ export const warn = (value, warning) => ({
19
+ $$tag: WarnTypeTagName,
20
+ value,
21
+ warning,
7
22
  });
8
-
9
- export { warn };
10
- //# sourceMappingURL=ternary-result-warn.mjs.map
23
+ //# sourceMappingURL=ternary-result-warn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-warn.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-warn.mts"],"sourcesContent":["import { type TernaryWarn } from '../ternary-result.mjs';\nimport { WarnTypeTagName } from './tag.mjs';\n\n/**\n * Creates a `TernaryResult.Warn` containing the provided success value and\n * warning.\n *\n * @example\n *\n * ```ts\n * const caution = TernaryResult.warn({ id: 1 }, 'Needs review');\n *\n * assert.deepStrictEqual(caution, {\n * $$tag: 'ts-data-forge::Result.warn',\n * value: { id: 1 },\n * warning: 'Needs review',\n * });\n * ```\n */\nexport const warn = <const S, const W>(\n value: S,\n warning: W,\n): TernaryWarn<S, W> =>\n ({\n $$tag: WarnTypeTagName,\n value,\n warning,\n }) as const;\n"],"names":[],"mappings":";;AAmBO,MAAM,IAAA,GAAO,CAClB,KAAA,EACA,OAAA,MAEC;AAAA,EACC,KAAA,EAAO,eAAA;AAAA,EACP,KAAA;AAAA,EACA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"ternary-result-warn.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-warn.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,KAAQ,EACR,OAAU,EACS,EAAE,CACrB,CAAC;IACC,KAAK,EAAE,eAAe;IACtB,KAAK;IACL,OAAO;CACR,CAAU,CAAC"}
@@ -2,23 +2,51 @@ import { isErr } from './ternary-result-is-err.mjs';
2
2
  import { isWarn } from './ternary-result-is-warn.mjs';
3
3
  import { ok } from './ternary-result-ok.mjs';
4
4
  import { warn } from './ternary-result-warn.mjs';
5
-
6
- const zip = (resultA, resultB) => {
7
- if (isErr(resultA)) {
8
- return resultA;
9
- }
10
- if (isErr(resultB)) {
11
- return resultB;
12
- }
13
- const pair = [resultA.value, resultB.value];
14
- if (isWarn(resultA)) {
15
- return warn(pair, resultA.warning);
16
- }
17
- if (isWarn(resultB)) {
18
- return warn(pair, resultB.warning);
19
- }
20
- return ok(pair);
5
+ /**
6
+ * Combines two `TernaryResult`s, prioritising Err over Warn over Ok.
7
+ *
8
+ * @example
9
+ *
10
+ * ```ts
11
+ * const okPair = TernaryResult.zip(
12
+ * TernaryResult.ok('left'),
13
+ * TernaryResult.ok(1),
14
+ * );
15
+ *
16
+ * const warnPair = TernaryResult.zip(
17
+ * TernaryResult.warn('left', 'warn'),
18
+ * TernaryResult.ok(1),
19
+ * );
20
+ *
21
+ * const errPair = TernaryResult.zip(
22
+ * TernaryResult.ok('left'),
23
+ * TernaryResult.err('err'),
24
+ * );
25
+ *
26
+ * assert.deepStrictEqual(okPair, TernaryResult.ok(['left', 1] as const));
27
+ *
28
+ * assert.deepStrictEqual(
29
+ * warnPair,
30
+ * TernaryResult.warn(['left', 1] as const, 'warn'),
31
+ * );
32
+ *
33
+ * assert.deepStrictEqual(errPair, TernaryResult.err('err'));
34
+ * ```
35
+ */
36
+ export const zip = (resultA, resultB) => {
37
+ if (isErr(resultA)) {
38
+ return resultA;
39
+ }
40
+ if (isErr(resultB)) {
41
+ return resultB;
42
+ }
43
+ const pair = [resultA.value, resultB.value];
44
+ if (isWarn(resultA)) {
45
+ return warn(pair, resultA.warning);
46
+ }
47
+ if (isWarn(resultB)) {
48
+ return warn(pair, resultB.warning);
49
+ }
50
+ return ok(pair);
21
51
  };
22
-
23
- export { zip };
24
- //# sourceMappingURL=ternary-result-zip.mjs.map
52
+ //# sourceMappingURL=ternary-result-zip.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result-zip.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-zip.mts"],"sourcesContent":["import { type TernaryResult } from '../ternary-result.mjs';\nimport { isErr } from './ternary-result-is-err.mjs';\nimport { isWarn } from './ternary-result-is-warn.mjs';\nimport { ok } from './ternary-result-ok.mjs';\nimport { warn } from './ternary-result-warn.mjs';\n\n/**\n * Combines two `TernaryResult`s, prioritising Err over Warn over Ok.\n *\n * @example\n *\n * ```ts\n * const okPair = TernaryResult.zip(\n * TernaryResult.ok('left'),\n * TernaryResult.ok(1),\n * );\n *\n * const warnPair = TernaryResult.zip(\n * TernaryResult.warn('left', 'warn'),\n * TernaryResult.ok(1),\n * );\n *\n * const errPair = TernaryResult.zip(\n * TernaryResult.ok('left'),\n * TernaryResult.err('err'),\n * );\n *\n * assert.deepStrictEqual(okPair, TernaryResult.ok(['left', 1] as const));\n *\n * assert.deepStrictEqual(\n * warnPair,\n * TernaryResult.warn(['left', 1] as const, 'warn'),\n * );\n *\n * assert.deepStrictEqual(errPair, TernaryResult.err('err'));\n * ```\n */\nexport const zip = <S1, W1, E1, S2, W2, E2>(\n resultA: TernaryResult<S1, E1, W1>,\n resultB: TernaryResult<S2, E2, W2>,\n): TernaryResult<readonly [S1, S2], E1 | E2, W1 | W2> => {\n if (isErr(resultA)) {\n return resultA;\n }\n\n if (isErr(resultB)) {\n return resultB;\n }\n\n const pair = [resultA.value, resultB.value] as const;\n\n if (isWarn(resultA)) {\n return warn(pair, resultA.warning);\n }\n\n if (isWarn(resultB)) {\n return warn(pair, resultB.warning);\n }\n\n return ok(pair);\n};\n"],"names":[],"mappings":";;;;;AAqCO,MAAM,GAAA,GAAM,CACjB,OAAA,EACA,OAAA,KACuD;AACvD,EAAA,IAAI,KAAA,CAAM,OAAO,CAAA,EAAG;AAClB,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,IAAI,KAAA,CAAM,OAAO,CAAA,EAAG;AAClB,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,MAAM,IAAA,GAAO,CAAC,OAAA,CAAQ,KAAA,EAAO,QAAQ,KAAK,CAAA;AAE1C,EAAA,IAAI,MAAA,CAAO,OAAO,CAAA,EAAG;AACnB,IAAA,OAAO,IAAA,CAAK,IAAA,EAAM,OAAA,CAAQ,OAAO,CAAA;AAAA,EACnC;AAEA,EAAA,IAAI,MAAA,CAAO,OAAO,CAAA,EAAG;AACnB,IAAA,OAAO,IAAA,CAAK,IAAA,EAAM,OAAA,CAAQ,OAAO,CAAA;AAAA,EACnC;AAEA,EAAA,OAAO,GAAG,IAAI,CAAA;AAChB;;;;"}
1
+ {"version":3,"file":"ternary-result-zip.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-zip.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,OAAkC,EAClC,OAAkC,EACkB,EAAE;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACnB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACnB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAU,CAAC;IAErD,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;AAClB,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
-
2
- //# sourceMappingURL=types.mjs.map
1
+ export {};
2
+ //# sourceMappingURL=types.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/types.mts"],"names":[],"mappings":""}
@@ -1,15 +1,13 @@
1
- import { ErrTypeTagName, WarnTypeTagName, OkTypeTagName } from './tag.mjs';
2
-
3
- const variantName = (tag) => {
4
- switch (tag) {
5
- case OkTypeTagName:
6
- return "Ok";
7
- case WarnTypeTagName:
8
- return "Warn";
9
- case ErrTypeTagName:
10
- return "Err";
11
- }
1
+ import { ErrTypeTagName, OkTypeTagName, WarnTypeTagName } from './tag.mjs';
2
+ /** @internal Returns the human readable variant label for the given tag. */
3
+ export const variantName = (tag) => {
4
+ switch (tag) {
5
+ case OkTypeTagName:
6
+ return 'Ok';
7
+ case WarnTypeTagName:
8
+ return 'Warn';
9
+ case ErrTypeTagName:
10
+ return 'Err';
11
+ }
12
12
  };
13
-
14
- export { variantName };
15
- //# sourceMappingURL=variant-name.mjs.map
13
+ //# sourceMappingURL=variant-name.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"variant-name.mjs","sources":["../../../../src/functional/ternary-result/impl/variant-name.mts"],"sourcesContent":["import { type UnknownTernaryResult } from '../ternary-result.mjs';\nimport { ErrTypeTagName, OkTypeTagName, WarnTypeTagName } from './tag.mjs';\n\n/** @internal Returns the human readable variant label for the given tag. */\nexport const variantName = (\n tag: UnknownTernaryResult['$$tag'],\n): 'Ok' | 'Warn' | 'Err' => {\n switch (tag) {\n case OkTypeTagName:\n return 'Ok';\n\n case WarnTypeTagName:\n return 'Warn';\n\n case ErrTypeTagName:\n return 'Err';\n }\n};\n"],"names":[],"mappings":";;AAIO,MAAM,WAAA,GAAc,CACzB,GAAA,KAC0B;AAC1B,EAAA,QAAQ,GAAA;AAAK,IACX,KAAK,aAAA;AACH,MAAA,OAAO,IAAA;AAAA,IAET,KAAK,eAAA;AACH,MAAA,OAAO,MAAA;AAAA,IAET,KAAK,cAAA;AACH,MAAA,OAAO,KAAA;AAAA;AAEb;;;;"}
1
+ {"version":3,"file":"variant-name.mjs","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/variant-name.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,GAAkC,EACX,EAAE;IACzB,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,aAAa;YAChB,OAAO,IAAI,CAAC;QAEd,KAAK,eAAe;YAClB,OAAO,MAAM,CAAC;QAEhB,KAAK,cAAc;YACjB,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC,CAAC"}
@@ -1,3 +1,2 @@
1
- import * as index from './impl/index.mjs';
2
- export { index as TernaryResult };
3
- //# sourceMappingURL=index.mjs.map
1
+ export * from './ternary-result.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/functional/ternary-result/index.mts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1,3 +1,2 @@
1
- import * as index from './impl/index.mjs';
2
- export { index as TernaryResult };
3
- //# sourceMappingURL=ternary-result.mjs.map
1
+ export * as TernaryResult from './impl/index.mjs';
2
+ //# sourceMappingURL=ternary-result.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ternary-result.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"ternary-result.mjs","sourceRoot":"","sources":["../../../src/functional/ternary-result/ternary-result.mts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC"}
@@ -1,4 +1,43 @@
1
- const hasKey = (obj, key) => Object.hasOwn(obj, key);
2
-
3
- export { hasKey };
4
- //# sourceMappingURL=has-key.mjs.map
1
+ /**
2
+ * Type guard function that checks if an object has a specific key as its own
3
+ * property.
4
+ *
5
+ * This function uses `Object.hasOwn()` to check if the given object has the
6
+ * specified key as its own property (not inherited). It acts as a type guard
7
+ * that narrows the type of the object to guarantee the key exists, enabling
8
+ * type-safe property access.
9
+ *
10
+ * **Type Narrowing Behavior:**
11
+ *
12
+ * - When the guard returns `true`, TypeScript narrows the object type to include
13
+ * the checked key
14
+ * - For union types, only union members that contain the key are preserved
15
+ * - The key's value type is preserved from the original object type when possible
16
+ *
17
+ * @example
18
+ *
19
+ * ```ts
20
+ * const maybeUser: Readonly<{ id?: number; name?: string }> = {
21
+ * id: 42,
22
+ * } as const;
23
+ *
24
+ * if (hasKey(maybeUser, 'id')) {
25
+ * // `maybeUser` is now known to have an `id` property.
26
+ * assert.isTrue(maybeUser.id === 42);
27
+ * } else {
28
+ * assert.fail();
29
+ * }
30
+ * ```
31
+ *
32
+ * @template R - The type of the input object, must extend UnknownRecord
33
+ * @template K - The type of the key to check for, must extend PropertyKey
34
+ * (string | number | symbol)
35
+ * @param obj - The object to check for the presence of the key
36
+ * @param key - The key to check for in the object
37
+ * @returns `true` if the object has the specified key as its own property,
38
+ * `false` otherwise. When `true`, TypeScript narrows the object type to
39
+ * guarantee the key exists.
40
+ * @see {@link keyIsIn} - Similar function that narrows the key type instead of the object type
41
+ */
42
+ export const hasKey = (obj, key) => Object.hasOwn(obj, key);
43
+ //# sourceMappingURL=has-key.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"has-key.mjs","sources":["../../src/guard/has-key.mts"],"sourcesContent":["import { type ReadonlyRecord, type UnknownRecord } from 'ts-type-forge';\n\n/**\n * Type guard function that checks if an object has a specific key as its own\n * property.\n *\n * This function uses `Object.hasOwn()` to check if the given object has the\n * specified key as its own property (not inherited). It acts as a type guard\n * that narrows the type of the object to guarantee the key exists, enabling\n * type-safe property access.\n *\n * **Type Narrowing Behavior:**\n *\n * - When the guard returns `true`, TypeScript narrows the object type to include\n * the checked key\n * - For union types, only union members that contain the key are preserved\n * - The key's value type is preserved from the original object type when possible\n *\n * @example\n *\n * ```ts\n * const maybeUser: Readonly<{ id?: number; name?: string }> = {\n * id: 42,\n * } as const;\n *\n * if (hasKey(maybeUser, 'id')) {\n * // `maybeUser` is now known to have an `id` property.\n * assert.isTrue(maybeUser.id === 42);\n * } else {\n * assert.fail();\n * }\n * ```\n *\n * @template R - The type of the input object, must extend UnknownRecord\n * @template K - The type of the key to check for, must extend PropertyKey\n * (string | number | symbol)\n * @param obj - The object to check for the presence of the key\n * @param key - The key to check for in the object\n * @returns `true` if the object has the specified key as its own property,\n * `false` otherwise. When `true`, TypeScript narrows the object type to\n * guarantee the key exists.\n * @see {@link keyIsIn} - Similar function that narrows the key type instead of the object type\n */\nexport const hasKey = <\n const R extends UnknownRecord,\n const K extends PropertyKey,\n>(\n obj: R,\n key: K,\n): obj is HasKeyReturnType<R, K> => Object.hasOwn(obj, key);\n\n/**\n * @internal\n * When R is a union type (including the case with only one element), if any element in the union\n * contains K as a key, returns a type that narrows the union to only those elements that contain K as a key.\n * If none of the elements in the union contain K as a key, returns `ReadonlyRecord<K, unknown>`.\n * The result is made readonly.\n */\nexport type HasKeyReturnType<\n R extends UnknownRecord,\n K extends PropertyKey,\n> = R extends R // union distribution\n ? K extends keyof R\n ? string extends keyof R\n ? ReadonlyRecord<K, R[keyof R]> & R\n : number extends keyof R\n ? ReadonlyRecord<K, R[keyof R]> & R\n : symbol extends keyof R\n ? ReadonlyRecord<K, R[keyof R]> & R\n : R\n : never // omit union member that does not have key K\n : never; // dummy case for union distribution\n"],"names":[],"mappings":"AA2CO,MAAM,SAAS,CAIpB,GAAA,EACA,QACkC,MAAA,CAAO,MAAA,CAAO,KAAK,GAAG;;;;"}
1
+ {"version":3,"file":"has-key.mjs","sourceRoot":"","sources":["../../src/guard/has-key.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAIpB,GAAM,EACN,GAAM,EACyB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
@@ -1,8 +1,8 @@
1
- export { hasKey } from './has-key.mjs';
2
- export { isNonEmptyString } from './is-non-empty-string.mjs';
3
- export { isNonNullObject } from './is-non-null-object.mjs';
4
- export { isPrimitive } from './is-primitive.mjs';
5
- export { isMutableRecord, isRecord } from './is-record.mjs';
6
- export { isBigint, isBoolean, isNonNullish, isNotBigint, isNotBoolean, isNotNull, isNotNumber, isNotString, isNotSymbol, isNotUndefined, isNull, isNullish, isNumber, isString, isSymbol, isUndefined } from './is-type.mjs';
7
- export { keyIsIn } from './key-is-in.mjs';
8
- //# sourceMappingURL=index.mjs.map
1
+ export * from './has-key.mjs';
2
+ export * from './is-non-empty-string.mjs';
3
+ export * from './is-non-null-object.mjs';
4
+ export * from './is-primitive.mjs';
5
+ export * from './is-record.mjs';
6
+ export * from './is-type.mjs';
7
+ export * from './key-is-in.mjs';
8
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/guard/index.mts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
@@ -1,4 +1,39 @@
1
- const isNonEmptyString = (s) => typeof s === "string" && s.length > 0;
2
-
3
- export { isNonEmptyString };
4
- //# sourceMappingURL=is-non-empty-string.mjs.map
1
+ /**
2
+ * Type guard that checks if a value is a non-empty string.
3
+ *
4
+ * This function performs both a type check (ensuring the value is a string) and
5
+ * a length check (ensuring the string is not empty). It acts as a type guard
6
+ * that narrows the input type to exclude `null`, `undefined`, and empty
7
+ * strings.
8
+ *
9
+ * **Type Narrowing Behavior:**
10
+ *
11
+ * - Eliminates `null` and `undefined` from the type
12
+ * - Excludes empty string (`""`) from the type
13
+ * - Preserves literal string types when possible
14
+ * - Whitespace-only strings are considered non-empty
15
+ *
16
+ * @example
17
+ *
18
+ * ```ts
19
+ * const words: readonly (string | undefined)[] = [
20
+ * 'Ada',
21
+ * undefined,
22
+ * '',
23
+ * 'Lovelace',
24
+ * ] as const;
25
+ *
26
+ * const nonEmpty = words.filter(isNonEmptyString);
27
+ *
28
+ * assert.deepStrictEqual(nonEmpty, ['Ada', 'Lovelace']);
29
+ * ```
30
+ *
31
+ * @template S - The input type, which can include `string`, `null`, or
32
+ * `undefined`
33
+ * @param s - The value to check
34
+ * @returns `true` if `s` is a string with length > 0, `false` otherwise. When
35
+ * `true`, TypeScript narrows the type to exclude empty strings and nullish
36
+ * values.
37
+ */
38
+ export const isNonEmptyString = (s) => typeof s === 'string' && s.length > 0;
39
+ //# sourceMappingURL=is-non-empty-string.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-non-empty-string.mjs","sources":["../../src/guard/is-non-empty-string.mts"],"sourcesContent":["import { type NonEmptyString, type RelaxedExclude } from 'ts-type-forge';\n\n/**\n * Type guard that checks if a value is a non-empty string.\n *\n * This function performs both a type check (ensuring the value is a string) and\n * a length check (ensuring the string is not empty). It acts as a type guard\n * that narrows the input type to exclude `null`, `undefined`, and empty\n * strings.\n *\n * **Type Narrowing Behavior:**\n *\n * - Eliminates `null` and `undefined` from the type\n * - Excludes empty string (`\"\"`) from the type\n * - Preserves literal string types when possible\n * - Whitespace-only strings are considered non-empty\n *\n * @example\n *\n * ```ts\n * const words: readonly (string | undefined)[] = [\n * 'Ada',\n * undefined,\n * '',\n * 'Lovelace',\n * ] as const;\n *\n * const nonEmpty = words.filter(isNonEmptyString);\n *\n * assert.deepStrictEqual(nonEmpty, ['Ada', 'Lovelace']);\n * ```\n *\n * @template S - The input type, which can include `string`, `null`, or\n * `undefined`\n * @param s - The value to check\n * @returns `true` if `s` is a string with length > 0, `false` otherwise. When\n * `true`, TypeScript narrows the type to exclude empty strings and nullish\n * values.\n */\nexport const isNonEmptyString = <S extends string | null | undefined>(\n s: S,\n): s is NonEmptyString & RelaxedExclude<NonNullable<S>, ''> =>\n typeof s === 'string' && s.length > 0;\n"],"names":[],"mappings":"AAuCO,MAAM,mBAAmB,CAC9B,CAAA,KAEA,OAAO,CAAA,KAAM,QAAA,IAAY,EAAE,MAAA,GAAS;;;;"}
1
+ {"version":3,"file":"is-non-empty-string.mjs","sourceRoot":"","sources":["../../src/guard/is-non-empty-string.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,CAAI,EACsD,EAAE,CAC5D,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC"}
@@ -1,4 +1,36 @@
1
- const isNonNullObject = (u) => typeof u === "object" && u !== null;
2
-
3
- export { isNonNullObject };
4
- //# sourceMappingURL=is-non-null-object.mjs.map
1
+ /**
2
+ * Type guard that checks if a value is a non-null object.
3
+ *
4
+ * This function checks if a value has type `"object"` according to the `typeof`
5
+ * operator and is not `null`. This includes all object types such as plain
6
+ * objects, arrays, dates, regular expressions, and other object instances, but
7
+ * excludes functions.
8
+ *
9
+ * **Type Narrowing Behavior:**
10
+ *
11
+ * - Narrows `unknown` to `object`
12
+ * - Excludes `null`, `undefined`, and all primitive types
13
+ * - Excludes functions (they have `typeof` === `"function"`, not `"object"`)
14
+ * - Includes arrays, dates, regex, and other object instances
15
+ *
16
+ * **Note:** This function returns `true` for arrays. If you need
17
+ * record-oriented narrowing that excludes arrays, use `isRecord()` instead.
18
+ *
19
+ * @example
20
+ *
21
+ * ```ts
22
+ * const mixed: readonly unknown[] = [{ id: 1 }, null, 'Ada'] as const;
23
+ *
24
+ * const objects = mixed.filter(isNonNullObject);
25
+ *
26
+ * assert.deepStrictEqual(objects, [{ id: 1 }]);
27
+ * ```
28
+ *
29
+ * @param u - The value to check
30
+ * @returns `true` if `u` is an object and not `null`, `false` otherwise. When
31
+ * `true`, TypeScript narrows the type to `object`.
32
+ * @see {@link isRecord} - For record-oriented type narrowing (excludes arrays)
33
+ */
34
+ // eslint-disable-next-line @typescript-eslint/no-restricted-types
35
+ export const isNonNullObject = (u) => typeof u === 'object' && u !== null;
36
+ //# sourceMappingURL=is-non-null-object.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-non-null-object.mjs","sources":["../../src/guard/is-non-null-object.mts"],"sourcesContent":["/**\n * Type guard that checks if a value is a non-null object.\n *\n * This function checks if a value has type `\"object\"` according to the `typeof`\n * operator and is not `null`. This includes all object types such as plain\n * objects, arrays, dates, regular expressions, and other object instances, but\n * excludes functions.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows `unknown` to `object`\n * - Excludes `null`, `undefined`, and all primitive types\n * - Excludes functions (they have `typeof` === `\"function\"`, not `\"object\"`)\n * - Includes arrays, dates, regex, and other object instances\n *\n * **Note:** This function returns `true` for arrays. If you need\n * record-oriented narrowing that excludes arrays, use `isRecord()` instead.\n *\n * @example\n *\n * ```ts\n * const mixed: readonly unknown[] = [{ id: 1 }, null, 'Ada'] as const;\n *\n * const objects = mixed.filter(isNonNullObject);\n *\n * assert.deepStrictEqual(objects, [{ id: 1 }]);\n * ```\n *\n * @param u - The value to check\n * @returns `true` if `u` is an object and not `null`, `false` otherwise. When\n * `true`, TypeScript narrows the type to `object`.\n * @see {@link isRecord} - For record-oriented type narrowing (excludes arrays)\n */\n// eslint-disable-next-line @typescript-eslint/no-restricted-types\nexport const isNonNullObject = (u: unknown): u is object =>\n typeof u === 'object' && u !== null;\n"],"names":[],"mappings":"AAkCO,MAAM,kBAAkB,CAAC,CAAA,KAC9B,OAAO,CAAA,KAAM,YAAY,CAAA,KAAM;;;;"}
1
+ {"version":3,"file":"is-non-null-object.mjs","sourceRoot":"","sources":["../../src/guard/is-non-null-object.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,kEAAkE;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAU,EAAe,EAAE,CACzD,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC"}
@@ -1,17 +1,48 @@
1
- const isPrimitive = (u) => {
2
- switch (typeof u) {
3
- case "string":
4
- case "number":
5
- case "boolean":
6
- case "undefined":
7
- case "symbol":
8
- case "bigint":
9
- return true;
10
- case "function":
11
- case "object":
12
- return u === null;
13
- }
1
+
2
+ /**
3
+ * Type guard that checks if a value is a primitive type.
4
+ *
5
+ * This function identifies JavaScript primitive types, which are immutable data
6
+ * types that are not objects. The primitive types are: `string`, `number`,
7
+ * `boolean`, `undefined`, `symbol`, `bigint`, and `null`.
8
+ *
9
+ * **Important Note:** Although `null` has `typeof null === "object"` due to a
10
+ * historical JavaScript quirk, this function correctly identifies `null` as a
11
+ * primitive value.
12
+ *
13
+ * **Type Narrowing Behavior:**
14
+ *
15
+ * - Narrows the input type to `Primitive` (union of all primitive types)
16
+ * - Excludes object types, arrays, functions, and other non-primitive values
17
+ * - Includes `null` despite its misleading `typeof` result
18
+ *
19
+ * @example
20
+ *
21
+ * ```ts
22
+ * const values: readonly unknown[] = [42, 'Ada', null, { id: 1 }] as const;
23
+ *
24
+ * const primitives = values.filter(isPrimitive);
25
+ *
26
+ * assert.deepStrictEqual(primitives, [42, 'Ada', null]);
27
+ * ```
28
+ *
29
+ * @param u - The value to check
30
+ * @returns `true` if `u` is a primitive type, `false` otherwise. When `true`,
31
+ * TypeScript narrows the type to `Primitive`.
32
+ */
33
+ export const isPrimitive = (u) => {
34
+ switch (typeof u) {
35
+ case 'string':
36
+ case 'number':
37
+ case 'boolean':
38
+ case 'undefined':
39
+ case 'symbol':
40
+ case 'bigint':
41
+ return true;
42
+ case 'function':
43
+ case 'object':
44
+ return u === null;
45
+ }
14
46
  };
15
47
 
16
- export { isPrimitive };
17
- //# sourceMappingURL=is-primitive.mjs.map
48
+ //# sourceMappingURL=is-primitive.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-primitive.mjs","sources":["../../src/guard/is-primitive.mts"],"sourcesContent":["import { type Primitive } from 'ts-type-forge';\nimport { expectType } from '../expect-type.mjs';\n\n/**\n * Type guard that checks if a value is a primitive type.\n *\n * This function identifies JavaScript primitive types, which are immutable data\n * types that are not objects. The primitive types are: `string`, `number`,\n * `boolean`, `undefined`, `symbol`, `bigint`, and `null`.\n *\n * **Important Note:** Although `null` has `typeof null === \"object\"` due to a\n * historical JavaScript quirk, this function correctly identifies `null` as a\n * primitive value.\n *\n * **Type Narrowing Behavior:**\n *\n * - Narrows the input type to `Primitive` (union of all primitive types)\n * - Excludes object types, arrays, functions, and other non-primitive values\n * - Includes `null` despite its misleading `typeof` result\n *\n * @example\n *\n * ```ts\n * const values: readonly unknown[] = [42, 'Ada', null, { id: 1 }] as const;\n *\n * const primitives = values.filter(isPrimitive);\n *\n * assert.deepStrictEqual(primitives, [42, 'Ada', null]);\n * ```\n *\n * @param u - The value to check\n * @returns `true` if `u` is a primitive type, `false` otherwise. When `true`,\n * TypeScript narrows the type to `Primitive`.\n */\nexport const isPrimitive = (u: unknown): u is Primitive => {\n switch (typeof u) {\n case 'string':\n case 'number':\n case 'boolean':\n case 'undefined':\n case 'symbol':\n case 'bigint':\n return true;\n case 'function':\n case 'object':\n return u === null;\n }\n};\n\nexpectType<\n bigint | boolean | number | string | symbol | undefined | null,\n Primitive\n>('=');\n"],"names":[],"mappings":"AAkCO,MAAM,WAAA,GAAc,CAAC,CAAA,KAA+B;AACzD,EAAA,QAAQ,OAAO,CAAA;AAAG,IAChB,KAAK,QAAA;AAAA,IACL,KAAK,QAAA;AAAA,IACL,KAAK,SAAA;AAAA,IACL,KAAK,WAAA;AAAA,IACL,KAAK,QAAA;AAAA,IACL,KAAK,QAAA;AACH,MAAA,OAAO,IAAA;AAAA,IACT,KAAK,UAAA;AAAA,IACL,KAAK,QAAA;AACH,MAAA,OAAO,CAAA,KAAM,IAAA;AAAA;AAEnB;;;;"}
1
+ {"version":3,"file":"is-primitive.mjs","sourceRoot":"","sources":["../../src/guard/is-primitive.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAU,EAAkB,EAAE;IACxD,QAAQ,OAAO,CAAC,EAAE,CAAC;QACjB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,WAAW,CAAC;QACjB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ;YACX,OAAO,CAAC,KAAK,IAAI,CAAC;IACtB,CAAC;AACH,CAAC,CAAC;AAEF,UAAU,CAGR,GAAG,CAAC,CAAC"}