functionalscript 0.1.609 → 0.2.1

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/com/cpp/module.f.mjs +20 -25
  2. package/com/cpp/testlib.f.mjs +3 -4
  3. package/com/cs/module.f.mjs +18 -23
  4. package/com/cs/testlib.f.mjs +3 -5
  5. package/com/rust/module.f.mjs +25 -30
  6. package/com/rust/testlib.f.mjs +3 -5
  7. package/com/test/build.f.mjs +2 -2
  8. package/com/test/build.mjs +4 -4
  9. package/com/types/module.f.mjs +5 -12
  10. package/commonjs/build/module.f.mjs +23 -28
  11. package/commonjs/build/test.f.mjs +4 -4
  12. package/commonjs/module/function/module.f.mjs +0 -2
  13. package/commonjs/module/module.f.mjs +2 -9
  14. package/commonjs/module.f.mjs +0 -2
  15. package/commonjs/module.mjs +2 -7
  16. package/commonjs/package/dependencies/module.f.mjs +5 -10
  17. package/commonjs/package/dependencies/test.f.mjs +1 -1
  18. package/commonjs/package/module.f.mjs +6 -13
  19. package/commonjs/package/test.f.mjs +1 -1
  20. package/commonjs/path/module.f.mjs +12 -23
  21. package/commonjs/path/test.f.mjs +11 -11
  22. package/commonjs/test.mjs +1 -1
  23. package/dev/module.f.mjs +1 -4
  24. package/dev/module.mjs +1 -1
  25. package/dev/test/module.f.mjs +4 -6
  26. package/djs/module.f.mjs +12 -19
  27. package/djs/parser/module.f.mjs +18 -24
  28. package/djs/parser/test.f.mjs +9 -9
  29. package/djs/test.f.mjs +4 -4
  30. package/djs/tokenizer/module.f.mjs +18 -23
  31. package/djs/tokenizer/test.f.mjs +6 -6
  32. package/fsc/module.f.mjs +17 -24
  33. package/fsc/test.f.mjs +3 -3
  34. package/fsm/module.f.mjs +27 -38
  35. package/fsm/test.f.mjs +8 -8
  36. package/html/module.f.mjs +14 -23
  37. package/html/test.f.mjs +4 -4
  38. package/js/tokenizer/module.f.mjs +55 -62
  39. package/js/tokenizer/test.f.mjs +6 -6
  40. package/json/module.f.mjs +18 -31
  41. package/json/parser/module.f.mjs +9 -14
  42. package/json/parser/test.f.mjs +7 -7
  43. package/json/serializer/module.f.mjs +14 -29
  44. package/json/serializer/test.f.mjs +2 -2
  45. package/json/test.f.mjs +3 -3
  46. package/json/tokenizer/module.f.mjs +14 -19
  47. package/json/tokenizer/test.f.mjs +6 -6
  48. package/jsr.json +59 -59
  49. package/nodejs/version/main.mjs +1 -1
  50. package/nodejs/version/module.f.mjs +2 -7
  51. package/nodejs/version/test.f.mjs +3 -3
  52. package/out/com/cpp/module.f.d.mts +4 -0
  53. package/out/com/cpp/module.f.mjs +123 -0
  54. package/out/com/cpp/test.f.mjs +40 -0
  55. package/out/com/cpp/testlib.f.mjs +7 -0
  56. package/out/com/cs/module.f.d.mts +4 -0
  57. package/out/com/cs/module.f.mjs +95 -0
  58. package/out/com/cs/test.f.mjs +43 -0
  59. package/out/com/cs/testlib.f.mjs +7 -0
  60. package/{com → out/com}/rust/module.f.d.mts +3 -7
  61. package/out/com/rust/module.f.mjs +213 -0
  62. package/out/com/rust/test.f.mjs +123 -0
  63. package/out/com/rust/testlib.f.mjs +7 -0
  64. package/{com → out/com}/test/build.f.d.mts +2 -2
  65. package/out/com/test/build.f.mjs +98 -0
  66. package/out/com/test/build.mjs +40 -0
  67. package/{com → out/com}/types/module.f.d.mts +5 -10
  68. package/out/com/types/module.f.mjs +51 -0
  69. package/out/com/types/testlib.f.mjs +30 -0
  70. package/out/commonjs/build/module.f.d.mts +20 -0
  71. package/out/commonjs/build/module.f.mjs +107 -0
  72. package/out/commonjs/build/test.f.mjs +102 -0
  73. package/{commonjs → out/commonjs}/module/function/module.f.d.mts +0 -2
  74. package/out/commonjs/module/function/module.f.mjs +15 -0
  75. package/{commonjs → out/commonjs}/module/module.f.d.mts +16 -21
  76. package/out/commonjs/module/module.f.mjs +48 -0
  77. package/out/commonjs/module.d.mts +3 -0
  78. package/{commonjs → out/commonjs}/module.f.d.mts +0 -2
  79. package/out/commonjs/module.f.mjs +10 -0
  80. package/out/commonjs/module.mjs +26 -0
  81. package/out/commonjs/package/dependencies/module.f.d.mts +6 -0
  82. package/out/commonjs/package/dependencies/module.f.mjs +21 -0
  83. package/out/commonjs/package/dependencies/test.f.mjs +15 -0
  84. package/out/commonjs/package/module.f.d.mts +21 -0
  85. package/out/commonjs/package/module.f.mjs +40 -0
  86. package/out/commonjs/package/test.f.mjs +27 -0
  87. package/{commonjs → out/commonjs}/path/module.f.d.mts +25 -32
  88. package/out/commonjs/path/module.f.mjs +171 -0
  89. package/out/commonjs/path/test.f.mjs +231 -0
  90. package/out/commonjs/test.mjs +87 -0
  91. package/out/dev/index.mjs +2 -0
  92. package/out/dev/module.f.d.mts +1 -0
  93. package/out/dev/module.f.mjs +2 -0
  94. package/out/dev/module.mjs +167 -0
  95. package/{dev → out/dev}/test/module.f.d.mts +2 -3
  96. package/out/dev/test/module.f.mjs +134 -0
  97. package/out/dev/test.f.mjs +58 -0
  98. package/out/dev/test.mjs +52 -0
  99. package/{djs → out/djs}/module.f.d.mts +13 -18
  100. package/out/djs/module.f.mjs +75 -0
  101. package/{djs → out/djs}/parser/module.f.d.mts +11 -15
  102. package/out/djs/parser/module.f.mjs +432 -0
  103. package/out/djs/parser/test.f.mjs +535 -0
  104. package/out/djs/test.f.mjs +84 -0
  105. package/out/djs/tokenizer/module.f.d.mts +13 -0
  106. package/out/djs/tokenizer/module.f.mjs +87 -0
  107. package/out/djs/tokenizer/test.f.mjs +480 -0
  108. package/out/fsc/module.f.d.mts +7 -0
  109. package/out/fsc/module.f.mjs +105 -0
  110. package/out/fsc/test.f.mjs +19 -0
  111. package/out/fsm/module.f.d.mts +14 -0
  112. package/out/fsm/module.f.mjs +80 -0
  113. package/out/fsm/test.f.mjs +138 -0
  114. package/out/html/module.f.d.mts +15 -0
  115. package/out/html/module.f.mjs +94 -0
  116. package/out/html/test.f.mjs +45 -0
  117. package/out/issues/test.f.mjs +66 -0
  118. package/{js → out/js}/tokenizer/module.f.d.mts +10 -15
  119. package/out/js/tokenizer/module.f.mjs +686 -0
  120. package/out/js/tokenizer/test.f.mjs +844 -0
  121. package/out/json/module.f.d.mts +33 -0
  122. package/out/json/module.f.mjs +89 -0
  123. package/{json → out/json}/parser/module.f.d.mts +9 -13
  124. package/out/json/parser/module.f.mjs +224 -0
  125. package/out/json/parser/test.f.mjs +321 -0
  126. package/out/json/serializer/module.f.d.mts +36 -0
  127. package/out/json/serializer/module.f.mjs +67 -0
  128. package/out/json/serializer/test.f.mjs +87 -0
  129. package/out/json/test.f.mjs +61 -0
  130. package/out/json/tokenizer/module.f.d.mts +13 -0
  131. package/out/json/tokenizer/module.f.mjs +78 -0
  132. package/out/json/tokenizer/test.f.mjs +420 -0
  133. package/out/nanvm-lib/tests/test.f.mjs +87 -0
  134. package/out/nodejs/version/main.mjs +3 -0
  135. package/{nodejs → out/nodejs}/version/module.f.d.mts +4 -9
  136. package/out/nodejs/version/module.f.mjs +34 -0
  137. package/out/nodejs/version/test.f.mjs +97 -0
  138. package/{prime_field → out/prime_field}/module.f.d.mts +20 -23
  139. package/out/prime_field/module.f.mjs +87 -0
  140. package/out/prime_field/test.f.mjs +145 -0
  141. package/{secp → out/secp}/module.f.d.mts +27 -28
  142. package/out/secp/module.f.mjs +113 -0
  143. package/out/secp/test.f.mjs +63 -0
  144. package/out/sha2/module.f.d.mts +15 -0
  145. package/out/sha2/module.f.mjs +172 -0
  146. package/out/sha2/test.f.mjs +86 -0
  147. package/out/text/ascii/module.f.d.mts +70 -0
  148. package/out/text/ascii/module.f.mjs +154 -0
  149. package/out/text/ascii/test.f.mjs +14 -0
  150. package/out/text/module.f.d.mts +13 -0
  151. package/out/text/module.f.mjs +19 -0
  152. package/out/text/sgr/module.f.d.mts +12 -0
  153. package/out/text/sgr/module.f.mjs +17 -0
  154. package/out/text/test.f.mjs +19 -0
  155. package/out/text/utf16/module.f.d.mts +12 -0
  156. package/out/text/utf16/module.f.mjs +86 -0
  157. package/out/text/utf16/test.f.mjs +145 -0
  158. package/out/text/utf8/module.f.d.mts +10 -0
  159. package/out/text/utf8/module.f.mjs +126 -0
  160. package/out/text/utf8/test.f.mjs +175 -0
  161. package/{types → out/types}/array/module.f.d.mts +14 -24
  162. package/out/types/array/module.f.mjs +95 -0
  163. package/out/types/array/test.f.mjs +116 -0
  164. package/out/types/bigfloat/module.f.d.mts +6 -0
  165. package/out/types/bigfloat/module.f.mjs +77 -0
  166. package/out/types/bigfloat/test.f.mjs +349 -0
  167. package/out/types/bigint/module.f.d.mts +29 -0
  168. package/{types/bigint/module.f.d.mts → out/types/bigint/module.f.mjs} +64 -27
  169. package/out/types/bigint/test.f.mjs +192 -0
  170. package/{types → out/types}/btree/find/module.f.d.mts +20 -26
  171. package/out/types/btree/find/module.f.mjs +137 -0
  172. package/out/types/btree/find/test.f.mjs +156 -0
  173. package/out/types/btree/module.f.d.mts +5 -0
  174. package/out/types/btree/module.f.mjs +34 -0
  175. package/{types → out/types}/btree/remove/module.f.d.mts +7 -12
  176. package/out/types/btree/remove/module.f.mjs +209 -0
  177. package/out/types/btree/remove/test.f.mjs +638 -0
  178. package/{types → out/types}/btree/set/module.f.d.mts +3 -7
  179. package/out/types/btree/set/module.f.mjs +114 -0
  180. package/out/types/btree/set/test.f.mjs +390 -0
  181. package/out/types/btree/test.f.mjs +83 -0
  182. package/{types → out/types}/btree/types/module.f.d.mts +0 -2
  183. package/out/types/btree/types/module.f.mjs +50 -0
  184. package/out/types/byte_set/module.f.d.mts +25 -0
  185. package/out/types/byte_set/module.f.mjs +42 -0
  186. package/out/types/byte_set/test.f.mjs +123 -0
  187. package/{types → out/types}/function/compare/module.f.d.mts +9 -15
  188. package/out/types/function/compare/module.f.mjs +22 -0
  189. package/out/types/function/compare/test.f.mjs +8 -0
  190. package/{types → out/types}/function/module.f.d.mts +20 -27
  191. package/out/types/function/module.f.mjs +44 -0
  192. package/{types → out/types}/function/operator/module.f.d.mts +28 -43
  193. package/out/types/function/operator/module.f.mjs +60 -0
  194. package/out/types/function/test.f.mjs +15 -0
  195. package/out/types/list/module.f.d.mts +82 -0
  196. package/out/types/list/module.f.mjs +269 -0
  197. package/out/types/list/test.f.mjs +401 -0
  198. package/out/types/map/module.f.d.mts +21 -0
  199. package/out/types/map/module.f.mjs +54 -0
  200. package/out/types/map/test.f.mjs +115 -0
  201. package/out/types/nibble_set/module.f.d.mts +16 -0
  202. package/out/types/nibble_set/module.f.mjs +19 -0
  203. package/out/types/nibble_set/test.f.mjs +90 -0
  204. package/out/types/nullable/module.f.d.mts +9 -0
  205. package/out/types/nullable/module.f.mjs +9 -0
  206. package/out/types/nullable/test.f.mjs +12 -0
  207. package/out/types/number/module.f.d.mts +7 -0
  208. package/out/types/number/module.f.mjs +12 -0
  209. package/out/types/number/test.f.mjs +126 -0
  210. package/out/types/object/module.f.d.mts +22 -0
  211. package/out/types/object/module.f.mjs +27 -0
  212. package/out/types/object/test.f.mjs +17 -0
  213. package/out/types/range/module.f.d.mts +6 -0
  214. package/out/types/range/module.f.mjs +6 -0
  215. package/out/types/range/test.f.mjs +18 -0
  216. package/{types → out/types}/range_map/module.f.d.mts +9 -15
  217. package/out/types/range_map/module.f.mjs +84 -0
  218. package/out/types/range_map/test.f.mjs +201 -0
  219. package/out/types/result/module.d.mts +7 -0
  220. package/{types → out/types}/result/module.f.d.mts +6 -12
  221. package/out/types/result/module.f.mjs +25 -0
  222. package/out/types/result/module.mjs +16 -0
  223. package/{types → out/types}/sorted_list/module.f.d.mts +22 -28
  224. package/out/types/sorted_list/module.f.mjs +102 -0
  225. package/out/types/sorted_list/test.f.mjs +66 -0
  226. package/{types → out/types}/sorted_set/module.f.d.mts +6 -12
  227. package/out/types/sorted_set/module.f.mjs +29 -0
  228. package/out/types/sorted_set/test.f.mjs +80 -0
  229. package/out/types/string/module.f.d.mts +9 -0
  230. package/out/types/string/module.f.mjs +17 -0
  231. package/out/types/string/test.f.mjs +58 -0
  232. package/out/types/string_set/module.f.d.mts +13 -0
  233. package/out/types/string_set/module.f.mjs +29 -0
  234. package/out/types/string_set/test.f.mjs +65 -0
  235. package/package.json +5 -4
  236. package/prime_field/module.f.mjs +9 -12
  237. package/prime_field/test.f.mjs +1 -1
  238. package/secp/module.f.mjs +38 -39
  239. package/secp/test.f.mjs +4 -4
  240. package/sha2/module.f.mjs +7 -20
  241. package/sha2/test.f.mjs +4 -4
  242. package/text/ascii/module.f.mjs +5 -10
  243. package/text/ascii/test.f.mjs +3 -3
  244. package/text/module.f.mjs +7 -14
  245. package/text/sgr/module.f.mjs +2 -4
  246. package/text/test.f.mjs +3 -3
  247. package/text/utf16/module.f.mjs +17 -28
  248. package/text/utf16/test.f.mjs +5 -5
  249. package/text/utf8/module.f.mjs +9 -16
  250. package/text/utf8/test.f.mjs +4 -4
  251. package/tsconfig.json +2 -2
  252. package/types/array/module.f.mjs +8 -25
  253. package/types/array/test.f.mjs +3 -3
  254. package/types/bigfloat/module.f.mjs +3 -10
  255. package/types/bigfloat/test.f.mjs +1 -1
  256. package/types/bigint/module.f.mjs +11 -30
  257. package/types/bigint/test.f.mjs +1 -1
  258. package/types/btree/find/module.f.mjs +8 -17
  259. package/types/btree/find/test.f.mjs +7 -7
  260. package/types/btree/module.f.mjs +6 -11
  261. package/types/btree/remove/module.f.mjs +10 -17
  262. package/types/btree/remove/test.f.mjs +5 -5
  263. package/types/btree/set/module.f.mjs +4 -9
  264. package/types/btree/set/test.f.mjs +4 -4
  265. package/types/btree/test.f.mjs +9 -9
  266. package/types/btree/types/module.f.mjs +0 -2
  267. package/types/byte_set/module.f.mjs +14 -39
  268. package/types/byte_set/test.f.mjs +5 -5
  269. package/types/function/compare/module.f.mjs +3 -12
  270. package/types/function/compare/test.f.mjs +1 -1
  271. package/types/function/module.f.mjs +4 -15
  272. package/types/function/operator/module.f.mjs +14 -41
  273. package/types/function/test.f.mjs +1 -1
  274. package/types/list/module.f.mjs +45 -114
  275. package/types/list/test.f.mjs +10 -10
  276. package/types/map/module.f.mjs +15 -30
  277. package/types/map/test.f.mjs +2 -2
  278. package/types/nibble_set/module.f.mjs +7 -24
  279. package/types/nibble_set/test.f.mjs +2 -2
  280. package/types/nullable/module.f.mjs +2 -9
  281. package/types/nullable/test.f.mjs +1 -1
  282. package/types/number/module.f.mjs +8 -19
  283. package/types/number/test.f.mjs +1 -1
  284. package/types/object/module.f.mjs +9 -20
  285. package/types/object/test.f.mjs +1 -1
  286. package/types/range/module.f.mjs +2 -9
  287. package/types/range/test.f.mjs +1 -1
  288. package/types/range_map/module.f.mjs +9 -18
  289. package/types/range_map/test.f.mjs +32 -32
  290. package/types/result/module.f.mjs +3 -12
  291. package/types/result/module.mjs +2 -2
  292. package/types/sorted_list/module.f.mjs +10 -19
  293. package/types/sorted_list/test.f.mjs +7 -7
  294. package/types/sorted_set/module.f.mjs +7 -16
  295. package/types/sorted_set/test.f.mjs +7 -7
  296. package/types/string/module.f.mjs +10 -21
  297. package/types/string/test.f.mjs +2 -2
  298. package/types/string_set/module.f.mjs +12 -27
  299. package/types/string_set/test.f.mjs +1 -1
  300. package/com/cpp/module.f.d.mts +0 -8
  301. package/com/cs/module.f.d.mts +0 -8
  302. package/commonjs/build/module.f.d.mts +0 -24
  303. package/commonjs/module.d.mts +0 -7
  304. package/commonjs/package/dependencies/module.f.d.mts +0 -10
  305. package/commonjs/package/module.f.d.mts +0 -27
  306. package/dev/module.f.d.mts +0 -4
  307. package/djs/tokenizer/module.f.d.mts +0 -17
  308. package/fsc/module.f.d.mts +0 -12
  309. package/fsm/module.f.d.mts +0 -21
  310. package/html/module.f.d.mts +0 -20
  311. package/json/module.f.d.mts +0 -41
  312. package/json/serializer/module.f.d.mts +0 -45
  313. package/json/tokenizer/module.f.d.mts +0 -17
  314. package/sha2/module.f.d.mts +0 -23
  315. package/text/ascii/module.f.d.mts +0 -73
  316. package/text/module.f.d.mts +0 -18
  317. package/text/sgr/module.f.d.mts +0 -14
  318. package/text/utf16/module.f.d.mts +0 -19
  319. package/text/utf8/module.f.d.mts +0 -15
  320. package/types/bigfloat/module.f.d.mts +0 -11
  321. package/types/btree/module.f.d.mts +0 -9
  322. package/types/byte_set/module.f.d.mts +0 -38
  323. package/types/list/module.f.d.mts +0 -117
  324. package/types/map/module.f.d.mts +0 -30
  325. package/types/nibble_set/module.f.d.mts +0 -26
  326. package/types/nullable/module.f.d.mts +0 -14
  327. package/types/number/module.f.d.mts +0 -13
  328. package/types/object/module.f.d.mts +0 -29
  329. package/types/range/module.f.d.mts +0 -11
  330. package/types/result/module.d.mts +0 -7
  331. package/types/string/module.f.d.mts +0 -15
  332. package/types/string_set/module.f.d.mts +0 -21
  333. /package/{com → out/com}/cpp/test.f.d.mts +0 -0
  334. /package/{com → out/com}/cpp/testlib.f.d.mts +0 -0
  335. /package/{com → out/com}/cs/test.f.d.mts +0 -0
  336. /package/{com → out/com}/cs/testlib.f.d.mts +0 -0
  337. /package/{com → out/com}/rust/test.f.d.mts +0 -0
  338. /package/{com → out/com}/rust/testlib.f.d.mts +0 -0
  339. /package/{com → out/com}/test/build.d.mts +0 -0
  340. /package/{com → out/com}/types/testlib.f.d.mts +0 -0
  341. /package/{commonjs → out/commonjs}/build/test.f.d.mts +0 -0
  342. /package/{commonjs → out/commonjs}/package/dependencies/test.f.d.mts +0 -0
  343. /package/{commonjs → out/commonjs}/package/test.f.d.mts +0 -0
  344. /package/{commonjs → out/commonjs}/path/test.f.d.mts +0 -0
  345. /package/{commonjs → out/commonjs}/test.d.mts +0 -0
  346. /package/{dev → out/dev}/index.d.mts +0 -0
  347. /package/{dev → out/dev}/module.d.mts +0 -0
  348. /package/{dev → out/dev}/test.d.mts +0 -0
  349. /package/{dev → out/dev}/test.f.d.mts +0 -0
  350. /package/{djs → out/djs}/parser/test.f.d.mts +0 -0
  351. /package/{djs → out/djs}/test.f.d.mts +0 -0
  352. /package/{djs → out/djs}/tokenizer/test.f.d.mts +0 -0
  353. /package/{fsc → out/fsc}/test.f.d.mts +0 -0
  354. /package/{fsm → out/fsm}/test.f.d.mts +0 -0
  355. /package/{html → out/html}/test.f.d.mts +0 -0
  356. /package/{issues → out/issues}/test.f.d.mts +0 -0
  357. /package/{js → out/js}/tokenizer/test.f.d.mts +0 -0
  358. /package/{json → out/json}/parser/test.f.d.mts +0 -0
  359. /package/{json → out/json}/serializer/test.f.d.mts +0 -0
  360. /package/{json → out/json}/test.f.d.mts +0 -0
  361. /package/{json → out/json}/tokenizer/test.f.d.mts +0 -0
  362. /package/{nanvm-lib → out/nanvm-lib}/tests/test.f.d.mts +0 -0
  363. /package/{nodejs → out/nodejs}/version/main.d.mts +0 -0
  364. /package/{nodejs → out/nodejs}/version/test.f.d.mts +0 -0
  365. /package/{prime_field → out/prime_field}/test.f.d.mts +0 -0
  366. /package/{secp → out/secp}/test.f.d.mts +0 -0
  367. /package/{sha2 → out/sha2}/test.f.d.mts +0 -0
  368. /package/{text → out/text}/ascii/test.f.d.mts +0 -0
  369. /package/{text → out/text}/test.f.d.mts +0 -0
  370. /package/{text → out/text}/utf16/test.f.d.mts +0 -0
  371. /package/{text → out/text}/utf8/test.f.d.mts +0 -0
  372. /package/{types → out/types}/array/test.f.d.mts +0 -0
  373. /package/{types → out/types}/bigfloat/test.f.d.mts +0 -0
  374. /package/{types → out/types}/bigint/test.f.d.mts +0 -0
  375. /package/{types → out/types}/btree/find/test.f.d.mts +0 -0
  376. /package/{types → out/types}/btree/remove/test.f.d.mts +0 -0
  377. /package/{types → out/types}/btree/set/test.f.d.mts +0 -0
  378. /package/{types → out/types}/btree/test.f.d.mts +0 -0
  379. /package/{types → out/types}/byte_set/test.f.d.mts +0 -0
  380. /package/{types → out/types}/function/compare/test.f.d.mts +0 -0
  381. /package/{types → out/types}/function/test.f.d.mts +0 -0
  382. /package/{types → out/types}/list/test.f.d.mts +0 -0
  383. /package/{types → out/types}/map/test.f.d.mts +0 -0
  384. /package/{types → out/types}/nibble_set/test.f.d.mts +0 -0
  385. /package/{types → out/types}/nullable/test.f.d.mts +0 -0
  386. /package/{types → out/types}/number/test.f.d.mts +0 -0
  387. /package/{types → out/types}/object/test.f.d.mts +0 -0
  388. /package/{types → out/types}/range/test.f.d.mts +0 -0
  389. /package/{types → out/types}/range_map/test.f.d.mts +0 -0
  390. /package/{types → out/types}/sorted_list/test.f.d.mts +0 -0
  391. /package/{types → out/types}/sorted_set/test.f.d.mts +0 -0
  392. /package/{types → out/types}/string/test.f.d.mts +0 -0
  393. /package/{types → out/types}/string_set/test.f.d.mts +0 -0
@@ -0,0 +1,192 @@
1
+ import * as _ from './module.f.mjs';
2
+ const { sum, abs, serialize, log2, bitLength } = _;
3
+ export default {
4
+ sum: () => {
5
+ const result = sum([2n, 3n, 4n, 5n]);
6
+ if (result !== 14n) {
7
+ throw result;
8
+ }
9
+ },
10
+ abs: [
11
+ () => {
12
+ const result = abs(10n);
13
+ if (result !== 10n) {
14
+ throw result;
15
+ }
16
+ },
17
+ () => {
18
+ const result = abs(-10n);
19
+ if (result !== 10n) {
20
+ throw result;
21
+ }
22
+ }
23
+ ],
24
+ serialize: [
25
+ () => {
26
+ const result = serialize(0n);
27
+ if (result !== '0n') {
28
+ throw result;
29
+ }
30
+ },
31
+ () => {
32
+ const result = serialize(123456789012345678901234567890n);
33
+ if (result !== '123456789012345678901234567890n') {
34
+ throw result;
35
+ }
36
+ },
37
+ () => {
38
+ const result = serialize(-55555n);
39
+ if (result !== '-55555n') {
40
+ throw result;
41
+ }
42
+ },
43
+ ],
44
+ log2: [
45
+ () => {
46
+ const result = log2(-3n);
47
+ if (result !== -1n) {
48
+ throw result;
49
+ }
50
+ },
51
+ () => {
52
+ const result = log2(0n);
53
+ if (result !== -1n) {
54
+ throw result;
55
+ }
56
+ },
57
+ () => {
58
+ const result = log2(1n);
59
+ if (result !== 0n) {
60
+ throw result;
61
+ }
62
+ },
63
+ () => {
64
+ const result = log2(2n);
65
+ if (result !== 1n) {
66
+ throw result;
67
+ }
68
+ },
69
+ () => {
70
+ const result = log2(3n);
71
+ if (result !== 1n) {
72
+ throw result;
73
+ }
74
+ },
75
+ () => {
76
+ const result = log2(4n);
77
+ if (result !== 2n) {
78
+ throw result;
79
+ }
80
+ },
81
+ () => {
82
+ const result = log2(7n);
83
+ if (result !== 2n) {
84
+ throw result;
85
+ }
86
+ },
87
+ () => {
88
+ const result = log2(8n);
89
+ if (result !== 3n) {
90
+ throw result;
91
+ }
92
+ },
93
+ () => {
94
+ const result = log2(15n);
95
+ if (result !== 3n) {
96
+ throw result;
97
+ }
98
+ },
99
+ () => {
100
+ const result = log2(16n);
101
+ if (result !== 4n) {
102
+ throw result;
103
+ }
104
+ },
105
+ () => {
106
+ // max for Bun (131_072 Bytes)
107
+ const v = 1048575n;
108
+ const result = log2(1n << v);
109
+ if (result !== v) {
110
+ throw result;
111
+ }
112
+ },
113
+ ],
114
+ toString2: () => {
115
+ // max for Bun (131_072 Bytes)
116
+ const v = 1048575n;
117
+ const result = (1n << v).toString(2).length - 1;
118
+ if (result !== 1_048_575) {
119
+ throw result;
120
+ }
121
+ },
122
+ minus: () => {
123
+ let i = 0n;
124
+ while (i < 1048575n) {
125
+ const s = -i;
126
+ if (i !== -s) {
127
+ throw [i, s];
128
+ }
129
+ i += 1n;
130
+ }
131
+ },
132
+ not: () => {
133
+ let i = 0n;
134
+ while (i < 1048575n) {
135
+ const s = ~i;
136
+ if (i !== ~s) {
137
+ throw [i, s];
138
+ }
139
+ i += 1n;
140
+ }
141
+ },
142
+ bitLen: {
143
+ 0: () => {
144
+ const s = bitLength(0n);
145
+ if (s !== 0n) {
146
+ throw s;
147
+ }
148
+ },
149
+ m: () => {
150
+ let i = 0n;
151
+ while (i < 10000n) {
152
+ const s = bitLength(1n << i);
153
+ if (s !== i + 1n) {
154
+ throw [s, i];
155
+ }
156
+ i += 1n;
157
+ }
158
+ },
159
+ big: () => {
160
+ const s = bitLength(1n << 1000000n);
161
+ if (s !== 1000001n) {
162
+ throw s;
163
+ }
164
+ },
165
+ neg: [
166
+ () => {
167
+ const s = bitLength(-1n);
168
+ if (s !== 1n) {
169
+ throw s;
170
+ }
171
+ },
172
+ () => {
173
+ const s = bitLength(-2n);
174
+ if (s !== 2n) {
175
+ throw s;
176
+ }
177
+ },
178
+ () => {
179
+ const s = bitLength(-3n);
180
+ if (s !== 2n) {
181
+ throw s;
182
+ }
183
+ },
184
+ () => {
185
+ const s = bitLength(-4n);
186
+ if (s !== 3n) {
187
+ throw s;
188
+ }
189
+ },
190
+ ]
191
+ }
192
+ };
@@ -1,12 +1,23 @@
1
- declare namespace _default {
2
- export { find };
3
- export { value };
4
- export { isFound };
5
- }
6
- export default _default;
7
- export type FirstLeaf1<T> = readonly [cmpT.Index3, _.Leaf1<T>];
1
+ /**
2
+ * @template T
3
+ * @typedef {List.List<PathItem<T>>} Path
4
+ */
5
+ /**
6
+ * @template T
7
+ * @typedef {{
8
+ * readonly first: First<T>,
9
+ * readonly tail: Path<T>
10
+ * }} Result<T>
11
+ */
12
+ /** @type {<T>(c: cmp.Compare<T>) => (node: _.Node<T>) => Result<T>} */
13
+ export const find: <T>(c: cmp.Compare<T>) => (node: _.Node<T>) => Result<T>;
14
+ /** @type {<T>(first: First<T>) => boolean} */
15
+ export const isFound: <T>(first: First<T>) => boolean;
16
+ /** @type {<T>(first: First<T>) => T | null} */
17
+ export const value: <T>(first: First<T>) => T | null;
18
+ export type FirstLeaf1<T> = readonly [cmp.Index3, _.Leaf1<T>];
8
19
  export type FirstBranch3<T> = readonly [1, _.Branch3<T>];
9
- export type FirstLeaf2<T> = readonly [cmpT.Index5, _.Leaf2<T>];
20
+ export type FirstLeaf2<T> = readonly [cmp.Index5, _.Leaf2<T>];
10
21
  export type FirstBranch5<T> = readonly [1 | 3, _.Branch5<T>];
11
22
  export type First<T> = FirstLeaf1<T> | FirstBranch3<T> | FirstLeaf2<T> | FirstBranch5<T>;
12
23
  export type PathItem3<T> = readonly [0 | 2, _.Branch3<T>];
@@ -20,23 +31,6 @@ export type Result<T> = {
20
31
  readonly first: First<T>;
21
32
  readonly tail: Path<T>;
22
33
  };
23
- /**
24
- * @template T
25
- * @typedef {List.List<PathItem<T>>} Path
26
- */
27
- /**
28
- * @template T
29
- * @typedef {{
30
- * readonly first: First<T>,
31
- * readonly tail: Path<T>
32
- * }} Result<T>
33
- */
34
- /** @type {<T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => Result<T>} */
35
- declare const find: <T>(c: cmpT.Compare<T>) => (node: _.Node<T>) => Result<T>;
36
- /** @type {<T>(first: First<T>) => T | null} */
37
- declare const value: <T>(first: First<T>) => T | null;
38
- /** @type {<T>(first: First<T>) => boolean} */
39
- declare const isFound: <T>(first: First<T>) => boolean;
40
- import * as cmpT from '../../function/compare/module.f.mjs';
34
+ import * as cmp from '../../function/compare/module.f.mjs';
41
35
  import * as _ from '../types/module.f.mjs';
42
36
  import * as List from '../../list/module.f.mjs';
@@ -0,0 +1,137 @@
1
+ // @ts-self-types="./module.f.d.mts"
2
+ import * as _ from '../types/module.f.mjs';
3
+ import * as List from '../../list/module.f.mjs';
4
+ import * as cmp from '../../function/compare/module.f.mjs';
5
+ const { index3, index5 } = cmp;
6
+ import * as Array from '../../array/module.f.mjs';
7
+ /**
8
+ * @template T
9
+ * @typedef {readonly[cmp.Index3, _.Leaf1<T>]} FirstLeaf1
10
+ */
11
+ /**
12
+ * @template T
13
+ * @typedef {readonly[1, _.Branch3<T>]} FirstBranch3
14
+ */
15
+ /**
16
+ * @template T
17
+ * @typedef {readonly[cmp.Index5, _.Leaf2<T>]} FirstLeaf2
18
+ */
19
+ /**
20
+ * @template T
21
+ * @typedef {readonly[1|3, _.Branch5<T>]} FirstBranch5
22
+ */
23
+ /**
24
+ * @template T
25
+ * @typedef {FirstLeaf1<T> | FirstBranch3<T> | FirstLeaf2<T> | FirstBranch5<T>} First
26
+ */
27
+ /**
28
+ * @template T
29
+ * @typedef {readonly[0|2, _.Branch3<T>]} PathItem3
30
+ */
31
+ /**
32
+ * @template T
33
+ * @typedef {readonly[0|2|4, _.Branch5<T>]} PathItem5
34
+ */
35
+ /**
36
+ * @template T
37
+ * @typedef {PathItem3<T> | PathItem5<T>} PathItem
38
+ */
39
+ /** @type {<T>(item: PathItem<T>) => _.Node<T>} */
40
+ const child = item =>
41
+ /** @type {typeof item extends PathItem<infer T> ? _.Node<T> : never} */ (item[1][item[0]]);
42
+ /**
43
+ * @template T
44
+ * @typedef {List.List<PathItem<T>>} Path
45
+ */
46
+ /**
47
+ * @template T
48
+ * @typedef {{
49
+ * readonly first: First<T>,
50
+ * readonly tail: Path<T>
51
+ * }} Result<T>
52
+ */
53
+ /** @type {<T>(c: cmp.Compare<T>) => (node: _.Node<T>) => Result<T>} */
54
+ export const find = c => {
55
+ const i3 = index3(c);
56
+ const i5 = index5(c);
57
+ /** @typedef {typeof c extends cmp.Compare<infer T> ? T : never} T */
58
+ /** @type {(prior: Path<T>) => (node: _.Node<T>) => Result<T>} */
59
+ const f = tail => node => {
60
+ /** @type {(index: Array.KeyOf<typeof node>) => Result<T>} */
61
+ const append = index => {
62
+ const first = /** @type {PathItem<T>} */ ([index, node]);
63
+ return f({ first, tail })(child(first));
64
+ };
65
+ /** @type {(index: Array.KeyOf<typeof node>) => Result<T>} */
66
+ const done = index => ({ first: /** @type {First<T>} */ ([index, node]), tail });
67
+ switch (node.length) {
68
+ case 1: {
69
+ return done(i3(node[0]));
70
+ }
71
+ case 2: {
72
+ return done(i5(node));
73
+ }
74
+ case 3: {
75
+ const i = i3(node[1]);
76
+ switch (i) {
77
+ case 0:
78
+ case 2: {
79
+ return append(i);
80
+ }
81
+ case 1: {
82
+ return done(i);
83
+ }
84
+ }
85
+ }
86
+ case 5: {
87
+ const i = i5([node[1], node[3]]);
88
+ switch (i) {
89
+ case 0:
90
+ case 2:
91
+ case 4: {
92
+ return append(i);
93
+ }
94
+ case 1:
95
+ case 3: {
96
+ return done(i);
97
+ }
98
+ }
99
+ }
100
+ }
101
+ };
102
+ return f(null);
103
+ };
104
+ /** @type {<T>(first: First<T>) => boolean} */
105
+ export const isFound = ([i]) => {
106
+ switch (i) {
107
+ case 1:
108
+ case 3: {
109
+ return true;
110
+ }
111
+ default: {
112
+ return false;
113
+ }
114
+ }
115
+ };
116
+ /** @type {<T>(first: First<T>) => T | null} */
117
+ export const value = ([i, r]) => {
118
+ switch (i) {
119
+ case 1: {
120
+ switch (r.length) {
121
+ case 1:
122
+ case 2: {
123
+ return r[0];
124
+ }
125
+ default: {
126
+ return r[1];
127
+ }
128
+ }
129
+ }
130
+ case 3: {
131
+ return r.length === 2 ? r[1] : r[3];
132
+ }
133
+ default: {
134
+ return null;
135
+ }
136
+ }
137
+ };
@@ -0,0 +1,156 @@
1
+ import * as _ from './module.f.mjs';
2
+ import * as list from '../../list/module.f.mjs';
3
+ import * as json from '../../../json/module.f.mjs';
4
+ import * as o from '../../object/module.f.mjs';
5
+ const { sort } = o;
6
+ import * as btree from '../types/module.f.mjs';
7
+ import * as string from '../../string/module.f.mjs';
8
+ const { cmp } = string;
9
+ import * as s from '../set/module.f.mjs';
10
+ const jsonStr = json.stringify(sort);
11
+ /** @type {(node: btree.Node<string>) => (value: string) => btree.Node<string>} */
12
+ const set = node => value => s.set(cmp(value))(() => value)(node);
13
+ /** @type {(r: _.Result<json.Unknown>) => string} */
14
+ const str = r => jsonStr(list.toArray(list.map(x => x[0])(r)));
15
+ /** @type {(i: string) => (m: btree.Node<string>) => string} */
16
+ const find = i => m => str(_.find(cmp(i))(m));
17
+ const test = () => {
18
+ /** @type {btree.Node<string>} */
19
+ let _map = ['1'];
20
+ for (let i = 2; i <= 10; i++)
21
+ _map = set(_map)((i * i).toString());
22
+ {
23
+ const s = jsonStr(_map);
24
+ if (s !== '[[["1","100"],"16",["25","36"]],"4",[["49"],"64",["81","9"]]]') {
25
+ throw s;
26
+ }
27
+ }
28
+ //
29
+ {
30
+ const r = find("0")(_map);
31
+ if (r !== '[0,0,0]') {
32
+ throw r;
33
+ }
34
+ }
35
+ {
36
+ const r = find("1")(_map);
37
+ if (r !== '[1,0,0]') {
38
+ throw r;
39
+ }
40
+ }
41
+ {
42
+ const r = find("10")(_map);
43
+ if (r !== '[2,0,0]') {
44
+ throw r;
45
+ }
46
+ }
47
+ {
48
+ const r = find("100")(_map);
49
+ if (r !== '[3,0,0]') {
50
+ throw r;
51
+ }
52
+ }
53
+ {
54
+ const r = find("12")(_map);
55
+ if (r !== '[4,0,0]') {
56
+ throw r;
57
+ }
58
+ }
59
+ {
60
+ const r = find("16")(_map);
61
+ if (r !== '[1,0]') {
62
+ throw r;
63
+ }
64
+ }
65
+ {
66
+ const r = find("17")(_map);
67
+ if (r !== '[0,2,0]') {
68
+ throw r;
69
+ }
70
+ }
71
+ {
72
+ const r = find("25")(_map);
73
+ if (r !== '[1,2,0]') {
74
+ throw r;
75
+ }
76
+ }
77
+ {
78
+ const r = find("26")(_map);
79
+ if (r !== '[2,2,0]') {
80
+ throw r;
81
+ }
82
+ }
83
+ {
84
+ const r = find("36")(_map);
85
+ if (r !== '[3,2,0]') {
86
+ throw r;
87
+ }
88
+ }
89
+ {
90
+ const r = find("37")(_map);
91
+ if (r !== '[4,2,0]') {
92
+ throw r;
93
+ }
94
+ }
95
+ {
96
+ const r = find("4")(_map);
97
+ if (r !== '[1]') {
98
+ throw r;
99
+ }
100
+ }
101
+ {
102
+ const r = find("41")(_map);
103
+ if (r !== '[0,0,2]') {
104
+ throw r;
105
+ }
106
+ }
107
+ {
108
+ const r = find("49")(_map);
109
+ if (r !== '[1,0,2]') {
110
+ throw r;
111
+ }
112
+ }
113
+ {
114
+ const r = find("5")(_map);
115
+ if (r !== '[2,0,2]') {
116
+ throw r;
117
+ }
118
+ }
119
+ {
120
+ const r = find("64")(_map);
121
+ if (r !== '[1,2]') {
122
+ throw r;
123
+ }
124
+ }
125
+ {
126
+ const r = find("65")(_map);
127
+ if (r !== '[0,2,2]') {
128
+ throw r;
129
+ }
130
+ }
131
+ {
132
+ const r = find("81")(_map);
133
+ if (r !== '[1,2,2]') {
134
+ throw r;
135
+ }
136
+ }
137
+ {
138
+ const r = find("85")(_map);
139
+ if (r !== '[2,2,2]') {
140
+ throw r;
141
+ }
142
+ }
143
+ {
144
+ const r = find("9")(_map);
145
+ if (r !== '[3,2,2]') {
146
+ throw r;
147
+ }
148
+ }
149
+ {
150
+ const r = find("91")(_map);
151
+ if (r !== '[4,2,2]') {
152
+ throw r;
153
+ }
154
+ }
155
+ };
156
+ export default test;
@@ -0,0 +1,5 @@
1
+ export const empty: null;
2
+ /** @type {<T>(tree: _.Tree<T>) => list.List<T>} */
3
+ export const values: <T>(tree: _.Tree<T>) => list.List<T>;
4
+ import * as _ from './types/module.f.mjs';
5
+ import * as list from '../list/module.f.mjs';
@@ -0,0 +1,34 @@
1
+ // @ts-self-types="./module.f.d.mts"
2
+ import * as list from '../list/module.f.mjs';
3
+ const { flat } = list;
4
+ import * as n from '../nullable/module.f.mjs';
5
+ const { map } = n;
6
+ import * as _ from './types/module.f.mjs';
7
+ /** @type {<T>(node: _.Node<T>) => list.Thunk<T>} */
8
+ const nodeValues = node => () => {
9
+ switch (node.length) {
10
+ case 1:
11
+ case 2: {
12
+ return node;
13
+ }
14
+ case 3: {
15
+ return flat([
16
+ nodeValues(node[0]),
17
+ [node[1]],
18
+ nodeValues(node[2])
19
+ ]);
20
+ }
21
+ default: {
22
+ return flat([
23
+ nodeValues(node[0]),
24
+ [node[1]],
25
+ nodeValues(node[2]),
26
+ [node[3]],
27
+ nodeValues(node[4])
28
+ ]);
29
+ }
30
+ }
31
+ };
32
+ export const empty = null;
33
+ /** @type {<T>(tree: _.Tree<T>) => list.List<T>} */
34
+ export const values = map(nodeValues);
@@ -1,19 +1,14 @@
1
- declare namespace _default {
2
- export { nodeRemove };
3
- export { remove };
4
- }
5
- export default _default;
1
+ /** @type {<T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
2
+ export const nodeRemove: <T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>;
3
+ /** @type {<T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
4
+ export const remove: <T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>;
6
5
  export type Leaf01<T> = null | _.Leaf1<T>;
7
6
  export type RemovePath<T> = {
8
7
  readonly first: Leaf01<T>;
9
- readonly tail: Find.Path<T>;
8
+ readonly tail: find.Path<T>;
10
9
  };
11
10
  export type Branch<T> = _.Branch1<T> | _.Branch3<T> | _.Branch5<T>;
12
11
  export type Merge<A, T> = (a: A) => (n: _.Branch3<T>) => _.Branch1<T> | _.Branch3<T>;
13
- /** @type {<T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>} */
14
- declare const nodeRemove: <T>(c: Cmp.Compare<T>) => (node: _.Node<T>) => _.Tree<T>;
15
- /** @type {<T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>} */
16
- declare const remove: <T>(c: Cmp.Compare<T>) => (tree: _.Tree<T>) => _.Tree<T>;
17
- import * as _ from '../types/module.f.mjs';
18
- import * as Find from '../find/module.f.mjs';
19
12
  import * as Cmp from '../../function/compare/module.f.mjs';
13
+ import * as _ from '../types/module.f.mjs';
14
+ import * as find from '../find/module.f.mjs';