ts-data-forge 14.6.1 → 14.6.3

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 (420) 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 +68 -52
  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 +70 -32
  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 +99 -149
  18. package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
  19. package/dist/array/impl/array-utils-search.mjs +112 -136
  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 +92 -76
  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 +53 -55
  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 +181 -149
  48. package/dist/collections/queue.mjs.map +1 -1
  49. package/dist/collections/stack.mjs +167 -138
  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 +69 -3
  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 +18 -20
  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 +15 -18
  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 +15 -18
  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 +35 -8
  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 +15 -17
  82. package/dist/functional/optional/impl/optional-expect-to-be.mjs.map +1 -1
  83. package/dist/functional/optional/impl/optional-filter.mjs +16 -18
  84. package/dist/functional/optional/impl/optional-filter.mjs.map +1 -1
  85. package/dist/functional/optional/impl/optional-flat-map.mjs +12 -14
  86. package/dist/functional/optional/impl/optional-flat-map.mjs.map +1 -1
  87. package/dist/functional/optional/impl/optional-from-nullable.mjs +24 -3
  88. package/dist/functional/optional/impl/optional-from-nullable.mjs.map +1 -1
  89. package/dist/functional/optional/impl/optional-is-none.mjs +19 -3
  90. package/dist/functional/optional/impl/optional-is-none.mjs.map +1 -1
  91. package/dist/functional/optional/impl/optional-is-optional.mjs +24 -6
  92. package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
  93. package/dist/functional/optional/impl/optional-is-some.mjs +20 -3
  94. package/dist/functional/optional/impl/optional-is-some.mjs.map +1 -1
  95. package/dist/functional/optional/impl/optional-map.mjs +15 -17
  96. package/dist/functional/optional/impl/optional-map.mjs.map +1 -1
  97. package/dist/functional/optional/impl/optional-match.mjs +15 -17
  98. package/dist/functional/optional/impl/optional-match.mjs.map +1 -1
  99. package/dist/functional/optional/impl/optional-none.mjs +16 -3
  100. package/dist/functional/optional/impl/optional-none.mjs.map +1 -1
  101. package/dist/functional/optional/impl/optional-or-else.mjs +12 -14
  102. package/dist/functional/optional/impl/optional-or-else.mjs.map +1 -1
  103. package/dist/functional/optional/impl/optional-some.mjs +22 -6
  104. package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
  105. package/dist/functional/optional/impl/optional-to-nullable.mjs +26 -3
  106. package/dist/functional/optional/impl/optional-to-nullable.mjs.map +1 -1
  107. package/dist/functional/optional/impl/optional-unwrap-or.mjs +11 -13
  108. package/dist/functional/optional/impl/optional-unwrap-or.mjs.map +1 -1
  109. package/dist/functional/optional/impl/optional-unwrap-throw.mjs +33 -8
  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 +34 -3
  114. package/dist/functional/optional/impl/optional-zip.mjs.map +1 -1
  115. package/dist/functional/optional/impl/tag.mjs +3 -4
  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 +28 -6
  128. package/dist/functional/result/impl/result-err.mjs.map +1 -1
  129. package/dist/functional/result/impl/result-expect-to-be.mjs +16 -17
  130. package/dist/functional/result/impl/result-expect-to-be.mjs.map +1 -1
  131. package/dist/functional/result/impl/result-flat-map.mjs +17 -20
  132. package/dist/functional/result/impl/result-flat-map.mjs.map +1 -1
  133. package/dist/functional/result/impl/result-fold.mjs +17 -20
  134. package/dist/functional/result/impl/result-fold.mjs.map +1 -1
  135. package/dist/functional/result/impl/result-from-optional.mjs +16 -19
  136. package/dist/functional/result/impl/result-from-optional.mjs.map +1 -1
  137. package/dist/functional/result/impl/result-from-promise.mjs +35 -6
  138. package/dist/functional/result/impl/result-from-promise.mjs.map +1 -1
  139. package/dist/functional/result/impl/result-from-throwable.mjs +40 -13
  140. package/dist/functional/result/impl/result-from-throwable.mjs.map +1 -1
  141. package/dist/functional/result/impl/result-is-err.mjs +19 -3
  142. package/dist/functional/result/impl/result-is-err.mjs.map +1 -1
  143. package/dist/functional/result/impl/result-is-ok.mjs +19 -3
  144. package/dist/functional/result/impl/result-is-ok.mjs.map +1 -1
  145. package/dist/functional/result/impl/result-is-result.mjs +23 -5
  146. package/dist/functional/result/impl/result-is-result.mjs.map +1 -1
  147. package/dist/functional/result/impl/result-map-err.mjs +17 -20
  148. package/dist/functional/result/impl/result-map-err.mjs.map +1 -1
  149. package/dist/functional/result/impl/result-map.mjs +17 -20
  150. package/dist/functional/result/impl/result-map.mjs.map +1 -1
  151. package/dist/functional/result/impl/result-match.mjs +16 -20
  152. package/dist/functional/result/impl/result-match.mjs.map +1 -1
  153. package/dist/functional/result/impl/result-ok.mjs +28 -6
  154. package/dist/functional/result/impl/result-ok.mjs.map +1 -1
  155. package/dist/functional/result/impl/result-or-else.mjs +13 -14
  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 +39 -11
  160. package/dist/functional/result/impl/result-safe-unwrap.mjs.map +1 -1
  161. package/dist/functional/result/impl/result-swap.mjs +21 -6
  162. package/dist/functional/result/impl/result-swap.mjs.map +1 -1
  163. package/dist/functional/result/impl/result-to-optional.mjs +28 -5
  164. package/dist/functional/result/impl/result-to-optional.mjs.map +1 -1
  165. package/dist/functional/result/impl/result-unwrap-err-or.mjs +12 -13
  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 +42 -19
  168. package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
  169. package/dist/functional/result/impl/result-unwrap-err.mjs +31 -6
  170. package/dist/functional/result/impl/result-unwrap-err.mjs.map +1 -1
  171. package/dist/functional/result/impl/result-unwrap-ok-or.mjs +12 -13
  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 +37 -10
  176. package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
  177. package/dist/functional/result/impl/result-zip.mjs +33 -3
  178. package/dist/functional/result/impl/result-zip.mjs.map +1 -1
  179. package/dist/functional/result/impl/tag.mjs +3 -4
  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 +5 -5
  190. package/dist/functional/ternary-result/impl/tag.mjs.map +1 -1
  191. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +16 -6
  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 +29 -33
  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 +19 -6
  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 +27 -12
  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 +17 -3
  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 +19 -3
  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 +26 -6
  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 +18 -3
  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 +17 -6
  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 +22 -8
  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 +29 -18
  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 +18 -6
  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 +6 -8
  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 +31 -23
  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 +26 -16
  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 +18 -6
  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 +20 -7
  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 +46 -18
  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 +11 -13
  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 +42 -3
  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 +38 -3
  258. package/dist/guard/is-non-empty-string.mjs.map +1 -1
  259. package/dist/guard/is-non-null-object.mjs +35 -3
  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 +87 -4
  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 +41 -3
  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 +18 -56
  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 +121 -107
  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 +291 -257
  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 +283 -254
  336. package/dist/number/branded-types/safe-int.mjs.map +1 -1
  337. package/dist/number/branded-types/safe-uint.mjs +134 -123
  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 +549 -91
  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 +356 -203
  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 +31 -4
  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 +51 -3
  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 +49 -8
  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 +2 -1
  392. package/dist/types.mjs.map +1 -1
  393. package/package.json +6 -7
  394. package/src/guard/is-type.test.mts +2 -2
  395. package/src/number/branded-types/finite-number.test.mts +1 -1
  396. package/src/number/branded-types/int.test.mts +1 -1
  397. package/src/number/branded-types/int16.test.mts +1 -1
  398. package/src/number/branded-types/int32.test.mts +1 -1
  399. package/src/number/branded-types/non-negative-finite-number.test.mts +1 -1
  400. package/src/number/branded-types/non-negative-int16.test.mts +1 -1
  401. package/src/number/branded-types/non-negative-int32.test.mts +1 -1
  402. package/src/number/branded-types/non-zero-finite-number.test.mts +1 -1
  403. package/src/number/branded-types/non-zero-int.test.mts +1 -1
  404. package/src/number/branded-types/non-zero-int16.test.mts +1 -1
  405. package/src/number/branded-types/non-zero-int32.test.mts +1 -1
  406. package/src/number/branded-types/non-zero-safe-int.test.mts +1 -1
  407. package/src/number/branded-types/non-zero-uint16.test.mts +1 -1
  408. package/src/number/branded-types/non-zero-uint32.test.mts +1 -1
  409. package/src/number/branded-types/positive-finite-number.test.mts +1 -1
  410. package/src/number/branded-types/positive-int.test.mts +1 -1
  411. package/src/number/branded-types/positive-int16.test.mts +1 -1
  412. package/src/number/branded-types/positive-int32.test.mts +1 -1
  413. package/src/number/branded-types/positive-safe-int.test.mts +1 -1
  414. package/src/number/branded-types/positive-uint16.test.mts +1 -1
  415. package/src/number/branded-types/positive-uint32.test.mts +1 -1
  416. package/src/number/branded-types/safe-int.test.mts +1 -1
  417. package/src/number/branded-types/safe-uint.test.mts +1 -1
  418. package/src/number/branded-types/uint.test.mts +1 -1
  419. package/src/number/branded-types/uint16.test.mts +1 -1
  420. package/src/number/branded-types/uint32.test.mts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"iset-mapped.mjs","sources":["../../src/collections/iset-mapped.mts"],"sourcesContent":["/* eslint-disable unicorn/prefer-iterator-to-array-at-end */\nimport {\n type FixedLengthTuple,\n type ReadonlyRecord,\n type WidenLiteral,\n} from 'ts-type-forge';\nimport { asUint32 } from '../number/index.mjs';\nimport { unknownToString } from '../others/index.mjs';\nimport { type MapSetKeyType, type SizeType } from '../types.mjs';\n\n/**\n * Interface for an immutable set with custom element mapping and membership\n * testing.\n *\n * ISetMapped allows you to use complex objects as set elements by providing\n * transformation functions that convert between your custom element type `K`\n * and a primitive `MapSetKeyType` `KM` that can be efficiently stored in\n * JavaScript's native Set. This enables set operations on complex elements\n * while maintaining type safety and immutability.\n *\n * **Key Features:**\n *\n * - **Custom Element Types**: Use any type as set elements by providing\n * `toKey`/`fromKey` functions\n * - **Immutable**: All operations return new instances, preserving immutability\n * - **Set Operations**: Full support for union, intersection, difference,\n * subset/superset checks\n * - **Type Safe**: Full TypeScript support with generic element types\n *\n * **Performance Characteristics:**\n *\n * - has: O(1) average case (plus element transformation overhead)\n * - add/delete: O(n) due to copying for immutability (plus element\n * transformation overhead)\n * - set operations (union, intersection, difference): O(n)\n * - map/filter operations: O(n)\n * - iteration: O(n) (plus element transformation overhead)\n *\n * @template K The type of the custom elements in the set.\n * @template KM The type of the mapped primitive keys (string, number, etc.).\n */\ntype ISetMappedInterface<K, KM extends MapSetKeyType> = Readonly<{\n /**\n * Creates a new ISetMapped instance.\n *\n * @param iterable An iterable of elements.\n * @param toKey A function that converts an element of type `K` to `KM`.\n * @param fromKey A function that converts a mapped key of type `KM` back to\n * `K`.\n */\n new (iterable: Iterable<K>, toKey: (a: K) => KM, fromKey: (k: KM) => K): void;\n\n // Getting information\n\n /**\n * The number of elements in the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const points: readonly Point[] = [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ] as const;\n *\n * const set = ISetMapped.create<Point, string>(points, toKey, fromKey);\n *\n * assert.isTrue(set.size === 2);\n * ```\n */\n size: SizeType.Arr;\n\n /**\n * Checks if the set is empty.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const empty = ISetMapped.create<Point, string>([], toKey, fromKey);\n *\n * const points = ISetMapped.create<Point, string>(\n * [{ x: 1, tag: 'a' }],\n * toKey,\n * fromKey,\n * );\n *\n * assert.isTrue(empty.isEmpty);\n *\n * assert.isFalse(points.isEmpty);\n * ```\n */\n isEmpty: boolean;\n\n /**\n * Checks if an element exists in the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [{ x: 1, tag: 'a' }],\n * toKey,\n * fromKey,\n * );\n *\n * assert.isTrue(set.has({ x: 1, tag: 'a' }));\n *\n * assert.isFalse(set.has({ x: 2, tag: 'b' }));\n * ```\n *\n * @param key The element to check.\n * @returns `true` if the element exists, `false` otherwise.\n */\n has: (key: K | (WidenLiteral<K> & {})) => boolean;\n\n // Reducing a value\n\n /**\n * Checks if all elements in the set satisfy a type predicate. Narrows the\n * type of elements in the set if the predicate returns true for all\n * elements.\n *\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 2, tag: 'even' },\n * { x: 4, tag: 'even' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const allEven = set.every((point) => point.x % 2 === 0);\n *\n * const narrowed = set.every(\n * (point): point is Readonly<{ x: 2 | 4; tag: 'even' }> =>\n * point.x % 2 === 0,\n * );\n *\n * assert.isTrue(allEven);\n *\n * assert.isTrue(narrowed);\n * ```\n *\n * @template L The narrowed type of the elements.\n * @param predicate A function to test each element.\n * @returns `true` if all elements satisfy the predicate, `false` otherwise.\n */\n every: ((predicate: (key: K) => boolean) => boolean) &\n (<L extends K>(\n predicate: (key: K) => key is L,\n ) => this is ISetMapped<L, KM>);\n\n /**\n * Checks if at least one element in the set satisfies a predicate.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 5, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * assert.isTrue(set.some((point) => point.x > 4));\n *\n * assert.isFalse(set.some((point) => point.x > 10));\n * ```\n *\n * @param predicate A function to test each element.\n * @returns `true` if at least one element satisfies the predicate, `false`\n * otherwise.\n */\n some: (predicate: (key: K) => boolean) => boolean;\n\n // Mutation\n\n /**\n * Adds an element to the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const base = ISetMapped.create<Point, string>(\n * [{ x: 1, tag: 'a' }],\n * toKey,\n * fromKey,\n * );\n *\n * const withNew = base.add({ x: 2, tag: 'b' });\n *\n * const unchanged = base.add({ x: 1, tag: 'a' });\n *\n * assert.deepStrictEqual(Array.from(withNew), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n *\n * assert.isTrue(unchanged === base);\n * ```\n *\n * @param key The element to add.\n * @returns A new ISetMapped instance with the element added.\n */\n add: (key: K) => ISetMapped<K, KM>;\n\n /**\n * Deletes an element from the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const base = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const withoutSecond = base.delete({ x: 2, tag: 'b' });\n *\n * const unchanged = base.delete({ x: 3, tag: 'c' });\n *\n * assert.deepStrictEqual(Array.from(withoutSecond), [{ x: 1, tag: 'a' }]);\n *\n * assert.isTrue(unchanged === base);\n * ```\n *\n * @param key The element to delete.\n * @returns A new ISetMapped instance without the specified element.\n */\n delete: (key: K) => ISetMapped<K, KM>;\n\n /**\n * Applies a series of mutations to the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const base = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const actions: readonly Readonly<\n * { type: 'add'; key: Point } | { type: 'delete'; key: Point }\n * >[] = [\n * { type: 'add', key: { x: 3, tag: 'c' } },\n * { type: 'delete', key: { x: 1, tag: 'a' } },\n * ] as const;\n *\n * const mutated = base.withMutations(actions);\n *\n * assert.deepStrictEqual(Array.from(mutated), [\n * { x: 2, tag: 'b' },\n * { x: 3, tag: 'c' },\n * ]);\n *\n * assert.deepStrictEqual(Array.from(base), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @param actions An array of mutation actions (add or delete).\n * @returns A new ISetMapped instance with all mutations applied.\n */\n withMutations: (\n actions: readonly Readonly<\n { type: 'add'; key: K } | { type: 'delete'; key: K }\n >[],\n ) => ISetMapped<K, KM>;\n\n // Sequence algorithms\n\n /**\n * Maps the elements of the set to new elements. Note: The element type `K`\n * cannot be changed because `toKey` and `fromKey` would become unusable if\n * the mapped type `KM` changes.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const shifted = set.map((point) => ({\n * x: point.x + 10,\n * tag: point.tag.toUpperCase(),\n * }));\n *\n * assert.deepStrictEqual(Array.from(shifted), [\n * { x: 11, tag: 'A' },\n * { x: 12, tag: 'B' },\n * ]);\n * ```\n *\n * @param mapFn A function that maps an element to a new element of the same\n * type `K`.\n * @returns A new ISetMapped instance with mapped elements.\n */\n map: (mapFn: (key: K) => K) => ISetMapped<K, KM>;\n\n /**\n * Filters the elements of the set based on a predicate.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * { x: 3, tag: 'c' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const evenPoints = set.filter((point) => point.x % 2 === 0);\n *\n * assert.deepStrictEqual(Array.from(evenPoints), [{ x: 2, tag: 'b' }]);\n * ```\n *\n * @param predicate A function to test each element.\n * @returns A new ISetMapped instance with elements that satisfy the\n * predicate.\n */\n filter: (predicate: (value: K) => boolean) => ISetMapped<K, KM>;\n\n /**\n * Filters the elements of the set by excluding elements for which the\n * predicate returns true.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const withoutEven = set.filterNot((point) => point.x % 2 === 0);\n *\n * assert.deepStrictEqual(Array.from(withoutEven), [{ x: 1, tag: 'a' }]);\n * ```\n *\n * @param predicate A function to test each element.\n * @returns A new ISetMapped instance with elements for which the predicate\n * returned `false`.\n */\n filterNot: (predicate: (key: K) => boolean) => ISetMapped<K, KM>;\n\n // Side effects\n\n /**\n * Executes a callback function for each element in the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const mut_collected: Point[] = [];\n *\n * set.forEach((point) => {\n * mut_collected.push(point);\n * });\n *\n * assert.deepStrictEqual(mut_collected, [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @param callbackfn A function to execute for each element.\n */\n forEach: (callbackfn: (key: K) => void) => void;\n\n // Comparison\n\n /**\n * Checks if this set is a subset of another set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const subset = ISetMapped.create<Point, string>(\n * [{ x: 1, tag: 'a' }],\n * toKey,\n * fromKey,\n * );\n *\n * const superset = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * assert.isTrue(subset.isSubsetOf(superset));\n *\n * assert.isFalse(superset.isSubsetOf(subset));\n * ```\n *\n * @param set The other set.\n * @returns `true` if this set is a subset of the other set, `false`\n * otherwise.\n */\n isSubsetOf: (set: ISetMapped<K, KM>) => boolean;\n\n /**\n * Checks if this set is a superset of another set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const superset = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const subset = ISetMapped.create<Point, string>(\n * [{ x: 2, tag: 'b' }],\n * toKey,\n * fromKey,\n * );\n *\n * assert.isTrue(superset.isSupersetOf(subset));\n *\n * assert.isFalse(subset.isSupersetOf(superset));\n * ```\n *\n * @param set The other set.\n * @returns `true` if this set is a superset of the other set, `false`\n * otherwise.\n */\n isSupersetOf: (set: ISetMapped<K, KM>) => boolean;\n\n /**\n * Returns a new set with elements that are in this set but not in another\n * set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const left = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * { x: 3, tag: 'c' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const right = ISetMapped.create<Point, string>(\n * [{ x: 2, tag: 'b' }],\n * toKey,\n * fromKey,\n * );\n *\n * const difference = left.subtract(right);\n *\n * assert.deepStrictEqual(Array.from(difference), [\n * { x: 1, tag: 'a' },\n * { x: 3, tag: 'c' },\n * ]);\n * ```\n *\n * @param set The other set.\n * @returns A new ISetMapped instance representing the set difference.\n */\n subtract: (set: ISetMapped<K, KM>) => ISetMapped<K, KM>;\n\n /**\n * Returns a new set with elements that are common to both this set and\n * another set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const left = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const right = ISetMapped.create<Point, string>(\n * [{ x: 2, tag: 'b' }],\n * toKey,\n * fromKey,\n * );\n *\n * const intersection = left.intersect(right);\n *\n * assert.deepStrictEqual(Array.from(intersection), [{ x: 2, tag: 'b' }]);\n * ```\n *\n * @param set The other set.\n * @returns A new ISetMapped instance representing the set intersection.\n */\n intersect: (set: ISetMapped<K, KM>) => ISetMapped<K, KM>;\n\n /**\n * Returns a new set with all elements from both this set and another set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const left = ISetMapped.create<Point, string>(\n * [{ x: 1, tag: 'a' }],\n * toKey,\n * fromKey,\n * );\n *\n * const right = ISetMapped.create<Point, string>(\n * [{ x: 2, tag: 'b' }],\n * toKey,\n * fromKey,\n * );\n *\n * const combined = left.union(right);\n *\n * assert.deepStrictEqual(Array.from(combined), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @param set The other set.\n * @returns A new ISetMapped instance representing the set union.\n */\n union: (set: ISetMapped<K, KM>) => ISetMapped<K, KM>;\n\n // Iterators\n\n /**\n * Returns an iterator for the elements in the set (alias for values).\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * assert.deepStrictEqual(Array.from(set.keys()), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @returns An iterable iterator of elements.\n */\n keys: () => IterableIterator<K>;\n\n /**\n * Returns an iterator for the elements in the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * assert.deepStrictEqual(Array.from(set.values()), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @returns An iterable iterator of elements.\n */\n values: () => IterableIterator<K>;\n\n /**\n * Returns an iterator for the entries (element-element pairs) in the set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * assert.deepStrictEqual(Array.from(set.entries()), [\n * [\n * { x: 1, tag: 'a' },\n * { x: 1, tag: 'a' },\n * ],\n * [\n * { x: 2, tag: 'b' },\n * { x: 2, tag: 'b' },\n * ],\n * ]);\n * ```\n *\n * @returns An iterable iterator of entries.\n */\n entries: () => IterableIterator<FixedLengthTuple<2, K>>;\n\n // Conversion\n\n /**\n * Converts the elements of the set to an array.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * assert.deepStrictEqual(set.toArray(), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @returns A readonly array of elements.\n */\n toArray: () => readonly K[];\n\n /**\n * Returns the underlying readonly JavaScript Set of mapped keys.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [{ x: 1, tag: 'a' }],\n * toKey,\n * fromKey,\n * );\n *\n * const raw = set.toRawSet();\n *\n * assert.isTrue(isSet(raw));\n *\n * assert.isTrue(raw.has(toKey({ x: 1, tag: 'a' })));\n * ```\n *\n * @returns The raw ReadonlySet instance.\n */\n toRawSet: () => ReadonlySet<KM>;\n}>;\n\n/**\n * Represents an immutable set with custom element transformation and\n * high-performance operations.\n *\n * ISetMapped is a specialized persistent data structure that enables using\n * complex objects as set elements while maintaining the performance benefits of\n * JavaScript's native Set. It achieves this by requiring bidirectional\n * transformation functions that convert between your custom element type and a\n * primitive type that can be efficiently stored and compared for uniqueness.\n *\n * **Key Features:**\n *\n * - **Complex Elements**: Use objects, arrays, or any custom type as set elements\n * - **Immutable**: All mutation operations return new instances\n * - **Type Safe**: Full TypeScript support with compile-time element type\n * checking\n * - **Bidirectional**: Maintains ability to reconstruct original elements from\n * mapped keys\n * - **Set Algebra**: Complete support for mathematical set operations\n *\n * **Use Cases:**\n *\n * - Sets of entities with complex identifiers\n * - Deduplication of objects based on specific properties\n * - Performance-critical sets with non-primitive elements\n * - Mathematical set operations on complex data structures\n *\n * @template K The type of the custom elements in the set.\n * @template KM The type of the mapped primitive keys (string, number, etc.).\n */\nexport type ISetMapped<K, KM extends MapSetKeyType> = Iterable<K> &\n Readonly<ISetMappedInterface<K, KM>>;\n\n/** Provides utility functions for ISetMapped. */\nexport namespace ISetMapped {\n /**\n * Creates a new ISetMapped instance with custom element transformation\n * functions.\n *\n * This factory function creates an immutable set that can use complex objects\n * as elements by providing bidirectional transformation functions. The\n * `toKey` function converts your custom element type to a primitive type that\n * can be efficiently stored, while `fromKey` reconstructs the original\n * element type for iteration and access.\n *\n * **Performance:** O(n) where n is the number of elements in the iterable.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * assert.deepStrictEqual(Array.from(set), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @template K The type of the custom elements.\n * @template KM The type of the mapped primitive keys.\n * @param iterable An iterable of elements using the custom element type.\n * @param toKey A function that converts a custom element `K` to a primitive\n * key `KM`. This function must be deterministic and produce unique values\n * for unique elements.\n * @param fromKey A function that converts a primitive key `KM` back to the\n * custom element `K`. This should be the inverse of `toKey`.\n * @returns A new ISetMapped instance containing all unique elements from the\n * iterable.\n */\n export const create = <K, KM extends MapSetKeyType>(\n iterable: Iterable<K>,\n toKey: (a: K) => KM,\n fromKey: (k: KM) => K,\n ): ISetMapped<K, KM> => new ISetMappedClass<K, KM>(iterable, toKey, fromKey);\n\n /**\n * Checks if two ISetMapped instances are structurally equal.\n *\n * Two ISetMapped instances are considered equal if they have the same size\n * and contain exactly the same elements. The comparison is performed on the\n * underlying mapped keys, so the transformation functions themselves don't\n * need to be identical. Elements are compared based on their mapped key\n * representations.\n *\n * **Performance:** O(n) where n is the size of the smaller set.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const first = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const second = ISetMapped.create<Point, string>(\n * [\n * { x: 2, tag: 'b' },\n * { x: 1, tag: 'a' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const third = ISetMapped.create<Point, string>(\n * [{ x: 3, tag: 'c' }],\n * toKey,\n * fromKey,\n * );\n *\n * assert.isTrue(ISetMapped.equal(first, second));\n *\n * assert.isFalse(ISetMapped.equal(first, third));\n * ```\n *\n * @template K The type of the custom elements.\n * @template KM The type of the mapped primitive keys.\n * @param a The first ISetMapped instance to compare.\n * @param b The second ISetMapped instance to compare.\n * @returns `true` if the sets contain exactly the same elements, `false`\n * otherwise.\n */\n export const equal = <K, KM extends MapSetKeyType>(\n a: ISetMapped<K, KM>,\n b: ISetMapped<K, KM>,\n ): boolean => a.size === b.size && a.every((e) => b.has(e));\n\n /**\n * Computes the difference between two ISetMapped instances.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const previous = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const current = ISetMapped.create<Point, string>(\n * [\n * { x: 2, tag: 'b' },\n * { x: 3, tag: 'c' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const { added, deleted } = ISetMapped.diff(previous, current);\n *\n * assert.deepStrictEqual(Array.from(added), [{ x: 3, tag: 'c' }]);\n *\n * assert.deepStrictEqual(Array.from(deleted), [{ x: 1, tag: 'a' }]);\n * ```\n *\n * @template K The type of the elements.\n * @template KM The type of the mapped keys.\n * @param oldSet The original set.\n * @param newSet The new set.\n * @returns An object containing sets of added and deleted elements.\n */\n export const diff = <K, KM extends MapSetKeyType>(\n oldSet: ISetMapped<K, KM>,\n newSet: ISetMapped<K, KM>,\n ): ReadonlyRecord<'added' | 'deleted', ISetMapped<K, KM>> =>\n ({\n deleted: oldSet.subtract(newSet),\n added: newSet.subtract(oldSet),\n }) as const;\n\n /**\n * Computes the intersection of two ISetMapped instances.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const left = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const right = ISetMapped.create<Point, string>(\n * [{ x: 2, tag: 'b' }],\n * toKey,\n * fromKey,\n * );\n *\n * const overlap = ISetMapped.intersection(left, right);\n *\n * assert.deepStrictEqual(Array.from(overlap), [{ x: 2, tag: 'b' }]);\n * ```\n *\n * @template K The type of the elements.\n * @template KM The type of the mapped keys.\n * @param a The first set.\n * @param b The second set.\n * @returns A new ISetMapped instance representing the intersection.\n */\n export const intersection = <K, KM extends MapSetKeyType>(\n a: ISetMapped<K, KM>,\n b: ISetMapped<K, KM>,\n ): ISetMapped<K, KM> => a.intersect(b);\n\n /**\n * Computes the union of two ISetMapped instances.\n *\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const left = ISetMapped.create<Point, string>(\n * [{ x: 1, tag: 'a' }],\n * toKey,\n * fromKey,\n * );\n *\n * const right = ISetMapped.create<Point, string>(\n * [{ x: 2, tag: 'b' }],\n * toKey,\n * fromKey,\n * );\n *\n * const combined = ISetMapped.union(left, right);\n *\n * assert.deepStrictEqual(Array.from(combined), [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @template K The type of the elements.\n * @template KM The type of the mapped keys.\n * @param a The first set.\n * @param b The second set.\n * @returns A new ISetMapped instance representing the union.\n */\n export const union = <K, KM extends MapSetKeyType>(\n a: ISetMapped<K, KM>,\n b: ISetMapped<K, KM>,\n ): ISetMapped<K, KM> => a.union(b);\n}\n\n/**\n * Internal class implementation for ISetMapped providing immutable set\n * operations with element transformation.\n *\n * This class implements the ISetMapped interface by maintaining a JavaScript\n * Set with primitive keys internally while exposing an API that works with\n * custom element types. The transformation between custom and primitive\n * elements is handled transparently through the provided `toKey` and `fromKey`\n * functions.\n *\n * **Implementation Details:**\n *\n * - Uses ReadonlySet<KM> internally where KM is the primitive key type\n * - Stores transformation functions for bidirectional element conversion\n * - Implements copy-on-write semantics for efficiency\n * - Provides optional debug messaging for development\n *\n * @template K The type of the custom elements.\n * @template KM The type of the mapped primitive keys.\n * @implements ISetMapped\n * @implements Iterable\n * @internal This class should not be used directly. Use ISetMapped.create() instead.\n */\nclass ISetMappedClass<K, KM extends MapSetKeyType>\n implements ISetMapped<K, KM>, Iterable<K>\n{\n readonly #set: ReadonlySet<KM>;\n readonly #toKey: (a: K) => KM;\n readonly #fromKey: (k: KM) => K;\n readonly #showNotFoundMessage: boolean;\n\n /**\n * Constructs an ISetMappedClass instance with custom element transformation.\n *\n * @param iterable An iterable of elements using the custom element type K.\n * @param toKey A function that converts a custom element K to a primitive key\n * KM. Must be deterministic and produce unique values for unique elements.\n * @param fromKey A function that converts a primitive key KM back to the\n * custom element K. Should be the inverse of the toKey function.\n * @param showNotFoundMessage Whether to log warning messages when operations\n * are performed on non-existent elements. Useful for debugging. Defaults to\n * false for production use.\n * @internal Use ISetMapped.create() instead of calling this constructor directly.\n */\n constructor(\n iterable: Iterable<K>,\n toKey: (a: K) => KM,\n fromKey: (k: KM) => K,\n showNotFoundMessage: boolean = false,\n ) {\n this.#set = new Set(Array.from(iterable, toKey));\n\n this.#toKey = toKey;\n\n this.#fromKey = fromKey;\n\n this.#showNotFoundMessage = showNotFoundMessage;\n }\n\n /** @inheritdoc */\n get size(): SizeType.Arr {\n return asUint32(this.#set.size);\n }\n\n /** @inheritdoc */\n get isEmpty(): boolean {\n return this.size === 0;\n }\n\n /** @inheritdoc */\n has(key: K | (WidenLiteral<K> & {})): boolean {\n // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n return this.#set.has(this.#toKey(key as K));\n }\n\n /** @inheritdoc */\n every<L extends K>(\n predicate: (key: K) => key is L,\n ): this is ISetMapped<L, KM>;\n\n /** @inheritdoc */\n every(predicate: (key: K) => boolean): boolean;\n\n /** @inheritdoc */\n every(predicate: (key: K) => boolean): boolean {\n for (const key of this.values()) {\n if (!predicate(key)) return false;\n }\n\n return true;\n }\n\n /** @inheritdoc */\n some(predicate: (key: K) => boolean): boolean {\n for (const key of this.values()) {\n if (predicate(key)) return true;\n }\n\n return false;\n }\n\n /** @inheritdoc */\n add(key: K): ISetMapped<K, KM> {\n if (this.has(key)) return this;\n\n return ISetMapped.create(\n [...this.#set, this.#toKey(key)].map(this.#fromKey),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n delete(key: K): ISetMapped<K, KM> {\n if (!this.has(key)) {\n if (this.#showNotFoundMessage) {\n console.warn(\n `ISetMapped.delete: key not found: ${unknownToString(this.#toKey(key))}`,\n );\n }\n\n return this;\n }\n\n const keyMapped = this.#toKey(key);\n\n return ISetMapped.create(\n Array.from(this.#set)\n .filter((k) => !Object.is(k, keyMapped))\n .map(this.#fromKey),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n withMutations(\n actions: readonly Readonly<\n { type: 'add'; key: K } | { type: 'delete'; key: K }\n >[],\n ): ISetMapped<K, KM> {\n const mut_result = new Set<KM>(this.#set);\n\n const updateFn = (\n action: Readonly<{ type: 'add'; key: K } | { type: 'delete'; key: K }>,\n ): void => {\n const key = this.#toKey(action.key);\n\n switch (action.type) {\n case 'delete':\n mut_result.delete(key);\n\n break;\n\n case 'add':\n mut_result.add(key);\n\n break;\n }\n };\n\n for (const action of actions) {\n updateFn(action);\n }\n\n return ISetMapped.create<K, KM>(\n Array.from(mut_result, this.#fromKey),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n map(mapFn: (key: K) => K): ISetMapped<K, KM> {\n return ISetMapped.create(\n this.toArray().map(mapFn),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n filter(predicate: (key: K) => boolean): ISetMapped<K, KM> {\n return ISetMapped.create(\n this.toArray().filter(predicate),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n filterNot(predicate: (key: K) => boolean): ISetMapped<K, KM> {\n return ISetMapped.create(\n this.toArray().filter((k) => !predicate(k)),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n forEach(callbackfn: (key: K) => void): void {\n for (const km of this.#set) {\n callbackfn(this.#fromKey(km));\n }\n }\n\n /** @inheritdoc */\n isSubsetOf(set: ISetMapped<K, KM>): boolean {\n return this.every((k) => set.has(k));\n }\n\n /** @inheritdoc */\n isSupersetOf(set: ISetMapped<K, KM>): boolean {\n return set.every((k) => this.has(k));\n }\n\n /** @inheritdoc */\n subtract(set: ISetMapped<K, KM>): ISetMapped<K, KM> {\n return ISetMapped.create(\n this.toArray().filter((k) => !set.has(k)),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n intersect(set: ISetMapped<K, KM>): ISetMapped<K, KM> {\n return ISetMapped.create(\n this.toArray().filter((k) => set.has(k)),\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /** @inheritdoc */\n union(set: ISetMapped<K, KM>): ISetMapped<K, KM> {\n return ISetMapped.create(\n [...this.values(), ...set.values()],\n this.#toKey,\n this.#fromKey,\n );\n }\n\n /**\n * @example\n *\n * ```ts\n * type Point = Readonly<{ x: number; tag: string }>;\n *\n * const toKey = (point: Point) => JSON.stringify(point);\n *\n * // eslint-disable-next-line total-functions/no-unsafe-type-assertion\n * const fromKey = (key: string) => JSON.parse(key) as Point;\n *\n * const set = ISetMapped.create<Point, string>(\n * [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ],\n * toKey,\n * fromKey,\n * );\n *\n * const collected = Array.from(set);\n *\n * assert.deepStrictEqual(collected, [\n * { x: 1, tag: 'a' },\n * { x: 2, tag: 'b' },\n * ]);\n * ```\n *\n * @inheritdoc\n */\n *[Symbol.iterator](): Iterator<K> {\n for (const k of this.keys()) {\n yield k;\n }\n }\n\n /** @inheritdoc */\n *keys(): IterableIterator<K> {\n for (const km of this.#set) {\n yield this.#fromKey(km);\n }\n }\n\n /** @inheritdoc */\n *values(): IterableIterator<K> {\n for (const km of this.#set) {\n // JavaScript Set's values() is an alias for keys()\n yield this.#fromKey(km);\n }\n }\n\n /** @inheritdoc */\n *entries(): IterableIterator<FixedLengthTuple<2, K>> {\n for (const km of this.#set) {\n // JavaScript Set's entries() yields [value, value]\n const a = this.#fromKey(km);\n\n yield [a, a];\n }\n }\n\n /** @inheritdoc */\n toArray(): readonly K[] {\n return Array.from(this.values());\n }\n\n /** @inheritdoc */\n toRawSet(): ReadonlySet<KM> {\n return this.#set;\n }\n}\n"],"names":["ISetMapped"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAg4BO,IAAU;AAAA,CAAV,CAAUA,WAAAA,KAAV;AAkDE,EAAMA,WAAAA,CAAA,MAAA,GAAS,CACpB,QAAA,EACA,KAAA,EACA,YACsB,IAAI,eAAA,CAAuB,QAAA,EAAU,KAAA,EAAO,OAAO,CAAA;AA2DpE,EAAMA,YAAA,KAAA,GAAQ,CACnB,CAAA,EACA,CAAA,KACY,EAAE,IAAA,KAAS,CAAA,CAAE,IAAA,IAAQ,CAAA,CAAE,MAAM,CAAC,CAAA,KAAM,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA;AA8CnD,EAAMA,WAAAA,CAAA,IAAA,GAAO,CAClB,MAAA,EACA,MAAA,MAEC;AAAA,IACC,OAAA,EAAS,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA;AAAA,IAC/B,KAAA,EAAO,MAAA,CAAO,QAAA,CAAS,MAAM;AAAA,GAC/B,CAAA;AAyCK,EAAMA,YAAA,YAAA,GAAe,CAC1B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,CAAC;CACF"}
@@ -1,204 +1,331 @@
1
- import '../number/branded-types/finite-number.mjs';
2
- import '../number/branded-types/int.mjs';
3
- import '../number/branded-types/int16.mjs';
4
- import '../number/branded-types/int32.mjs';
5
- import '../number/branded-types/negative-finite-number.mjs';
6
- import '../number/branded-types/negative-int.mjs';
7
- import '../number/branded-types/negative-safe-int.mjs';
8
- import '../number/branded-types/non-negative-finite-number.mjs';
9
- import '../number/branded-types/non-negative-int16.mjs';
10
- import '../number/branded-types/non-negative-int32.mjs';
11
- import '../number/branded-types/non-positive-finite-number.mjs';
12
- import '../number/branded-types/non-positive-int.mjs';
13
- import '../number/branded-types/non-positive-safe-int.mjs';
14
- import '../number/branded-types/non-zero-finite-number.mjs';
15
- import '../number/branded-types/non-zero-int.mjs';
16
- import '../number/branded-types/non-zero-int16.mjs';
17
- import '../number/branded-types/non-zero-int32.mjs';
18
- import '../number/branded-types/non-zero-safe-int.mjs';
19
- import '../number/branded-types/non-zero-uint16.mjs';
20
- import '../number/branded-types/non-zero-uint32.mjs';
21
- import '../number/branded-types/positive-finite-number.mjs';
22
- import '../number/branded-types/positive-int.mjs';
23
- import '../number/branded-types/positive-int16.mjs';
24
- import '../number/branded-types/positive-int32.mjs';
25
- import '../number/branded-types/positive-safe-int.mjs';
26
- import '../number/branded-types/positive-uint16.mjs';
27
- import '../number/branded-types/positive-uint32.mjs';
28
- import '../number/branded-types/safe-int.mjs';
29
- import '../number/branded-types/safe-uint.mjs';
30
- import '../number/branded-types/uint.mjs';
31
- import '../number/branded-types/uint16.mjs';
32
- import { asUint32 } from '../number/branded-types/uint32.mjs';
33
- import '../number/enum/int8.mjs';
34
- import '../number/enum/uint8.mjs';
35
- import '../number/num.mjs';
36
- import '../number/refined-number-utils.mjs';
37
- import '@sindresorhus/is';
38
- import { unknownToString } from '../others/unknown-to-string.mjs';
39
-
40
- var ISet;
41
- ((ISet2) => {
42
- ISet2.create = (iterable) => new ISetClass(iterable);
43
- ISet2.equal = (a, b) => a.size === b.size && a.every((e) => b.has(e));
44
- ISet2.diff = (oldSet, newSet) => ({
45
- deleted: oldSet.subtract(newSet),
46
- added: newSet.subtract(oldSet)
47
- });
48
- ISet2.intersection = (a, b) => a.intersect(b);
49
- ISet2.union = (a, b) => a.union(b);
1
+ import { asUint32 } from '../number/index.mjs';
2
+ import { unknownToString } from '../others/index.mjs';
3
+
4
+ export var ISet;
5
+ (function (ISet) {
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ ISet.create = (iterable) => new ISetClass(iterable);
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ ISet.equal = (a, b) => a.size === b.size && a.every((e) => b.has(e));
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+ ISet.diff = (oldSet, newSet) => ({
94
+ deleted: oldSet.subtract(newSet),
95
+ added: newSet.subtract(oldSet),
96
+ });
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ ISet.intersection = (a, b) => a.intersect(b);
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+ ISet.union = (a, b) => a.union(b);
50
154
  })(ISet || (ISet = {}));
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
51
174
  class ISetClass {
52
- #set;
53
- #showNotFoundMessage;
54
- /**
55
- * Constructs an ISetClass instance with the given elements.
56
- *
57
- * @param iterable An iterable of elements to populate the set.
58
- * @param showNotFoundMessage Whether to log warning messages when operations
59
- * are performed on non-existent elements. Useful for debugging. Defaults to
60
- * false for production use.
61
- * @internal Use ISet.create() instead of calling this constructor directly.
62
- */
63
- constructor(iterable, showNotFoundMessage = false) {
64
- this.#set = new Set(iterable);
65
- this.#showNotFoundMessage = showNotFoundMessage;
66
- }
67
- /** @inheritdoc */
68
- get size() {
69
- return asUint32(this.#set.size);
70
- }
71
- /** @inheritdoc */
72
- get isEmpty() {
73
- return this.size === 0;
74
- }
75
- /** @inheritdoc */
76
- has(key) {
77
- return this.#set.has(key);
78
- }
79
- /** @inheritdoc */
80
- every(predicate) {
81
- for (const key of this.values()) {
82
- if (!predicate(key)) return false;
83
- }
84
- return true;
85
- }
86
- /** @inheritdoc */
87
- some(predicate) {
88
- for (const key of this.values()) {
89
- if (predicate(key)) return true;
90
- }
91
- return false;
92
- }
93
- /** @inheritdoc */
94
- add(key) {
95
- if (this.has(key)) return this;
96
- return ISet.create([...this.#set, key]);
97
- }
98
- /** @inheritdoc */
99
- delete(key) {
100
- if (!this.has(key)) {
101
- if (this.#showNotFoundMessage) {
102
- const keyStr = unknownToString(key);
103
- console.warn(`ISet.delete: key not found: ${keyStr}`);
104
- }
105
- return this;
106
- }
107
- return ISet.create(Array.from(this.#set).filter((k) => !Object.is(k, key)));
108
- }
109
- /** @inheritdoc */
110
- withMutations(actions) {
111
- const mut_result = new Set(this.#set);
112
- const updateFn = (action) => {
113
- switch (action.type) {
114
- case "delete":
115
- mut_result.delete(action.key);
116
- break;
117
- case "add":
118
- mut_result.add(action.key);
119
- break;
120
- }
121
- };
122
- for (const action of actions) {
123
- updateFn(action);
124
- }
125
- return ISet.create(mut_result);
126
- }
127
- /** @inheritdoc */
128
- map(mapFn) {
129
- return ISet.create(this.toArray().map(mapFn));
130
- }
131
- /** @inheritdoc */
132
- filter(predicate) {
133
- return ISet.create(this.toArray().filter(predicate));
134
- }
135
- /** @inheritdoc */
136
- filterNot(predicate) {
137
- return ISet.create(this.toArray().filter((e) => !predicate(e)));
138
- }
139
- /** @inheritdoc */
140
- forEach(callbackfn) {
141
- for (const v of this.#set) {
142
- callbackfn(v);
143
- }
144
- }
145
- /** @inheritdoc */
146
- isSubsetOf(set) {
147
- return this.every((k) => set.has(k));
148
- }
149
- /** @inheritdoc */
150
- isSupersetOf(set) {
151
- return set.every((k) => this.has(k));
152
- }
153
- /** @inheritdoc */
154
- subtract(set) {
155
- return ISet.create(this.toArray().filter((k) => !set.has(k)));
156
- }
157
- /** @inheritdoc */
158
- intersect(set) {
159
- return ISet.create(this.toArray().filter((k) => set.has(k)));
160
- }
161
- /** @inheritdoc */
162
- union(set) {
163
- return ISet.create([...this, ...set]);
164
- }
165
- /**
166
- * @example
167
- *
168
- * ```ts
169
- * const set = ISet.create(['first', 'second']);
170
- *
171
- * const collected = Array.from(set);
172
- *
173
- * assert.deepStrictEqual(collected, ['first', 'second']);
174
- * ```
175
- *
176
- * @inheritdoc
177
- */
178
- [Symbol.iterator]() {
179
- return this.#set[Symbol.iterator]();
180
- }
181
- /** @inheritdoc */
182
- keys() {
183
- return this.#set.keys();
184
- }
185
- /** @inheritdoc */
186
- values() {
187
- return this.#set.values();
188
- }
189
- /** @inheritdoc */
190
- entries() {
191
- return this.#set.entries();
192
- }
193
- /** @inheritdoc */
194
- toArray() {
195
- return Array.from(this.values());
196
- }
197
- /** @inheritdoc */
198
- toRawSet() {
199
- return this.#set;
200
- }
201
- }
175
+ #set;
176
+ #showNotFoundMessage;
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ constructor(iterable, showNotFoundMessage = false) {
187
+ this.#set = new Set(iterable);
188
+ this.#showNotFoundMessage = showNotFoundMessage;
189
+ }
190
+
191
+ get size() {
192
+ return asUint32(this.#set.size);
193
+ }
194
+
195
+ get isEmpty() {
196
+ return this.size === 0;
197
+ }
198
+
199
+ has(key) {
200
+
201
+ return this.#set.has(key);
202
+ }
203
+
204
+ every(predicate) {
205
+ for (const key of this.values()) {
206
+ if (!predicate(key))
207
+ return false;
208
+ }
209
+ return true;
210
+ }
211
+
212
+ some(predicate) {
213
+ for (const key of this.values()) {
214
+ if (predicate(key))
215
+ return true;
216
+ }
217
+ return false;
218
+ }
219
+
220
+ add(key) {
221
+ if (this.has(key))
222
+ return this;
223
+ return ISet.create([...this.#set, key]);
224
+ }
225
+
226
+ delete(key) {
227
+ if (!this.has(key)) {
228
+ if (this.#showNotFoundMessage) {
229
+ const keyStr = unknownToString(key);
230
+ console.warn(`ISet.delete: key not found: ${keyStr}`);
231
+ }
232
+ return this;
233
+ }
234
+ return ISet.create(Array.from(this.#set).filter((k) => !Object.is(k, key)));
235
+ }
236
+
237
+ withMutations(actions) {
238
+ const mut_result = new Set(this.#set);
239
+ const updateFn = (action) => {
240
+ switch (action.type) {
241
+ case 'delete':
242
+ mut_result.delete(action.key);
243
+ break;
244
+ case 'add':
245
+ mut_result.add(action.key);
246
+ break;
247
+ }
248
+ };
249
+ for (const action of actions) {
250
+ updateFn(action);
251
+ }
252
+ return ISet.create(mut_result);
253
+ }
254
+
255
+ map(mapFn) {
256
+ return ISet.create(this.toArray().map(mapFn));
257
+ }
258
+
259
+ filter(predicate) {
260
+ return ISet.create(this.toArray().filter(predicate));
261
+ }
262
+
263
+ filterNot(predicate) {
264
+ return ISet.create(this.toArray().filter((e) => !predicate(e)));
265
+ }
266
+
267
+ forEach(callbackfn) {
268
+ for (const v of this.#set) {
269
+ callbackfn(v);
270
+ }
271
+ }
272
+
273
+ isSubsetOf(set) {
274
+
275
+ return this.every((k) => set.has(k));
276
+ }
277
+
278
+ isSupersetOf(set) {
279
+
280
+ return set.every((k) => this.has(k));
281
+ }
282
+
283
+ subtract(set) {
284
+ return ISet.create(this.toArray().filter((k) => !set.has(k)));
285
+ }
286
+
287
+ intersect(set) {
288
+ return ISet.create(this.toArray().filter((k) => set.has(k)));
289
+ }
290
+
291
+ union(set) {
292
+ return ISet.create([...this, ...set]);
293
+ }
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
202
304
 
203
- export { ISet };
204
- //# sourceMappingURL=iset.mjs.map
305
+
306
+
307
+ [Symbol.iterator]() {
308
+ return this.#set[Symbol.iterator]();
309
+ }
310
+
311
+ keys() {
312
+ return this.#set.keys();
313
+ }
314
+
315
+ values() {
316
+ return this.#set.values();
317
+ }
318
+
319
+ entries() {
320
+ return this.#set.entries();
321
+ }
322
+
323
+ toArray() {
324
+ return Array.from(this.values());
325
+ }
326
+
327
+ toRawSet() {
328
+ return this.#set;
329
+ }
330
+ }
331
+ //# sourceMappingURL=iset.mjs.map