functionalscript 0.2.6 → 0.3.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 (428) hide show
  1. package/.github/workflows/ci.yml +20 -4
  2. package/CHANGELOG.md +5 -0
  3. package/com/cpp/{module.f.mjs → module.f.ts} +65 -44
  4. package/com/cpp/{test.f.mjs → test.f.ts} +1 -1
  5. package/com/cpp/testlib.f.ts +8 -0
  6. package/com/cs/{module.f.mjs → module.f.ts} +47 -38
  7. package/com/cs/{test.f.mjs → test.f.ts} +2 -2
  8. package/com/cs/testlib.f.ts +8 -0
  9. package/com/rust/module.f.ts +287 -0
  10. package/com/rust/{test.f.mjs → test.f.ts} +1 -1
  11. package/com/rust/testlib.f.ts +8 -0
  12. package/com/test/{build.f.mjs → build.f.ts} +47 -45
  13. package/com/test/{build.mjs → build.ts} +7 -6
  14. package/com/types/module.f.ts +62 -0
  15. package/com/types/{testlib.f.mjs → testlib.f.ts} +2 -3
  16. package/commonjs/build/module.f.ts +100 -0
  17. package/commonjs/build/{test.f.mjs → test.f.ts} +21 -17
  18. package/commonjs/module/function/module.f.ts +13 -0
  19. package/commonjs/module/module.f.ts +41 -0
  20. package/commonjs/module.f.ts +7 -0
  21. package/commonjs/{module.mjs → module.ts} +12 -9
  22. package/commonjs/package/dependencies/module.f.ts +22 -0
  23. package/commonjs/package/dependencies/{test.f.mjs → test.f.ts} +1 -1
  24. package/commonjs/package/module.f.ts +31 -0
  25. package/commonjs/package/{test.f.mjs → test.f.ts} +1 -1
  26. package/commonjs/path/{module.f.mjs → module.f.ts} +72 -67
  27. package/commonjs/path/{test.f.mjs → test.f.ts} +25 -19
  28. package/commonjs/{test.mjs → test.ts} +5 -4
  29. package/crypto/prime_field/{module.f.mjs → module.f.ts} +40 -37
  30. package/crypto/prime_field/{test.f.mjs → test.f.ts} +7 -5
  31. package/crypto/secp/{module.f.mjs → module.f.ts} +44 -44
  32. package/crypto/secp/{test.f.mjs → test.f.ts} +16 -11
  33. package/crypto/sha2/{module.f.mjs → module.f.ts} +61 -46
  34. package/crypto/sha2/{test.f.mjs → test.f.ts} +12 -9
  35. package/deno.json +71 -0
  36. package/dev/README.md +8 -0
  37. package/dev/index.ts +3 -0
  38. package/dev/{module.f.mjs → module.f.ts} +0 -2
  39. package/dev/{module.mjs → module.ts} +66 -61
  40. package/dev/test/{module.f.mjs → module.f.ts} +57 -70
  41. package/dev/{test.f.mjs → test.f.ts} +7 -5
  42. package/dev/test.ts +53 -0
  43. package/djs/{module.f.mjs → module.f.ts} +31 -31
  44. package/djs/parser/{module.f.mjs → module.f.ts} +190 -182
  45. package/djs/parser/{test.f.mjs → test.f.ts} +173 -150
  46. package/djs/serializer/module.f.ts +90 -0
  47. package/djs/{test.f.mjs → test.f.ts} +4 -4
  48. package/djs/tokenizer/{module.f.mjs → module.f.ts} +35 -42
  49. package/djs/tokenizer/{test.f.mjs → test.f.ts} +9 -8
  50. package/fsc/{module.f.mjs → module.f.ts} +41 -44
  51. package/fsc/{test.f.mjs → test.f.ts} +8 -6
  52. package/fsm/module.f.ts +107 -0
  53. package/fsm/{test.f.mjs → test.f.ts} +10 -9
  54. package/html/module.f.ts +108 -0
  55. package/html/{test.f.mjs → test.f.ts} +10 -7
  56. package/issues/lang/3110-function.md +25 -1
  57. package/issues/{test.f.mjs → test.f.ts} +3 -2
  58. package/js/tokenizer/module.f.ts +882 -0
  59. package/js/tokenizer/{test.f.mjs → test.f.ts} +11 -10
  60. package/json/module.f.ts +94 -0
  61. package/json/parser/{module.f.mjs → module.f.ts} +113 -109
  62. package/json/parser/{test.f.mjs → test.f.ts} +10 -9
  63. package/json/serializer/module.f.ts +70 -0
  64. package/json/serializer/{test.f.mjs → test.f.ts} +3 -3
  65. package/json/{test.f.mjs → test.f.ts} +3 -3
  66. package/json/tokenizer/{module.f.mjs → module.f.ts} +29 -36
  67. package/json/tokenizer/{test.f.mjs → test.f.ts} +9 -8
  68. package/nanvm-lib/src/extension.rs +15 -4
  69. package/nanvm-lib/src/interface.rs +7 -10
  70. package/nanvm-lib/src/lib.rs +3 -3
  71. package/nanvm-lib/src/naive.rs +10 -3
  72. package/nanvm-lib/src/nanenum.rs +5 -1
  73. package/nanvm-lib/tests/{test.f.mjs → test.f.ts} +7 -6
  74. package/nodejs/version/{main.mjs → main.ts} +1 -1
  75. package/nodejs/version/module.f.ts +42 -0
  76. package/nodejs/version/{test.f.mjs → test.f.ts} +11 -12
  77. package/package.json +9 -9
  78. package/text/ascii/{module.f.mjs → module.f.ts} +10 -8
  79. package/text/ascii/{test.f.mjs → test.f.ts} +4 -4
  80. package/text/module.f.ts +30 -0
  81. package/text/sgr/{module.f.mjs → module.f.ts} +3 -5
  82. package/text/{test.f.mjs → test.f.ts} +5 -4
  83. package/text/utf16/module.f.ts +108 -0
  84. package/text/utf16/{test.f.mjs → test.f.ts} +7 -6
  85. package/text/utf8/{module.f.mjs → module.f.ts} +29 -23
  86. package/text/utf8/{test.f.mjs → test.f.ts} +4 -4
  87. package/tsconfig.json +4 -1
  88. package/types/array/module.f.ts +89 -0
  89. package/types/array/{test.f.mjs → test.f.ts} +3 -3
  90. package/types/bigfloat/{module.f.mjs → module.f.ts} +25 -20
  91. package/types/bigfloat/{test.f.mjs → test.f.ts} +1 -1
  92. package/types/bigint/{module.f.mjs → module.f.ts} +29 -28
  93. package/types/bigint/{test.f.mjs → test.f.ts} +2 -2
  94. package/types/bit_vec/{module.f.mjs → module.f.ts} +16 -37
  95. package/types/bit_vec/{test.f.mjs → test.f.ts} +1 -1
  96. package/types/btree/find/module.f.ts +92 -0
  97. package/types/btree/find/{test.f.mjs → test.f.ts} +20 -16
  98. package/types/btree/{module.f.mjs → module.f.ts} +9 -9
  99. package/types/btree/remove/{module.f.mjs → module.f.ts} +43 -53
  100. package/types/btree/remove/{test.f.mjs → test.f.ts} +19 -15
  101. package/types/btree/set/{module.f.mjs → module.f.ts} +17 -20
  102. package/types/btree/set/{test.f.mjs → test.f.ts} +96 -66
  103. package/types/btree/{test.f.mjs → test.f.ts} +34 -26
  104. package/types/btree/types/module.f.ts +27 -0
  105. package/types/byte_set/module.f.ts +70 -0
  106. package/types/byte_set/{test.f.mjs → test.f.ts} +8 -7
  107. package/types/function/compare/module.f.ts +26 -0
  108. package/types/function/compare/{test.f.mjs → test.f.ts} +1 -1
  109. package/types/function/module.f.ts +43 -0
  110. package/types/function/operator/module.f.ts +63 -0
  111. package/types/function/test.f.ts +20 -0
  112. package/types/list/module.f.ts +345 -0
  113. package/types/list/{test.f.mjs → test.f.ts} +30 -24
  114. package/types/map/module.f.ts +65 -0
  115. package/types/map/{test.f.mjs → test.f.ts} +6 -5
  116. package/types/nibble_set/module.f.ts +34 -0
  117. package/types/nibble_set/{test.f.mjs → test.f.ts} +3 -3
  118. package/types/nullable/module.f.ts +9 -0
  119. package/types/nullable/{test.f.mjs → test.f.ts} +2 -2
  120. package/types/number/module.f.ts +16 -0
  121. package/types/number/{test.f.mjs → test.f.ts} +7 -5
  122. package/types/object/module.f.ts +30 -0
  123. package/types/object/{test.f.mjs → test.f.ts} +2 -2
  124. package/types/range/module.f.ts +10 -0
  125. package/types/range/{test.f.mjs → test.f.ts} +1 -1
  126. package/types/range_map/module.f.ts +70 -0
  127. package/types/range_map/{test.f.mjs → test.f.ts} +82 -57
  128. package/types/result/module.f.ts +20 -0
  129. package/types/result/{module.mjs → module.ts} +4 -3
  130. package/types/sorted_list/module.f.ts +83 -0
  131. package/types/sorted_list/{test.f.mjs → test.f.ts} +14 -12
  132. package/types/sorted_set/module.f.ts +36 -0
  133. package/types/sorted_set/{test.f.mjs → test.f.ts} +14 -12
  134. package/types/string/module.f.ts +24 -0
  135. package/types/string/{test.f.mjs → test.f.ts} +2 -2
  136. package/types/string_set/module.f.ts +37 -0
  137. package/types/string_set/{test.f.mjs → test.f.ts} +2 -2
  138. package/com/cpp/testlib.f.mjs +0 -8
  139. package/com/cs/testlib.f.mjs +0 -8
  140. package/com/rust/module.f.mjs +0 -272
  141. package/com/rust/testlib.f.mjs +0 -8
  142. package/com/types/module.f.mjs +0 -67
  143. package/commonjs/build/module.f.mjs +0 -100
  144. package/commonjs/module/function/module.f.mjs +0 -21
  145. package/commonjs/module/module.f.mjs +0 -53
  146. package/commonjs/module.f.mjs +0 -11
  147. package/commonjs/package/dependencies/module.f.mjs +0 -22
  148. package/commonjs/package/module.f.mjs +0 -36
  149. package/dev/index.mjs +0 -3
  150. package/dev/test.mjs +0 -60
  151. package/fsm/module.f.mjs +0 -99
  152. package/html/module.f.mjs +0 -102
  153. package/js/tokenizer/module.f.mjs +0 -872
  154. package/json/module.f.mjs +0 -89
  155. package/json/serializer/module.f.mjs +0 -87
  156. package/jsr.json +0 -66
  157. package/nodejs/version/module.f.mjs +0 -47
  158. package/out/com/cpp/module.f.d.mts +0 -7
  159. package/out/com/cpp/module.f.mjs +0 -130
  160. package/out/com/cpp/test.f.d.mts +0 -2
  161. package/out/com/cpp/test.f.mjs +0 -40
  162. package/out/com/cpp/testlib.f.d.mts +0 -2
  163. package/out/com/cpp/testlib.f.mjs +0 -7
  164. package/out/com/cs/module.f.d.mts +0 -7
  165. package/out/com/cs/module.f.mjs +0 -104
  166. package/out/com/cs/test.f.d.mts +0 -2
  167. package/out/com/cs/test.f.mjs +0 -43
  168. package/out/com/cs/testlib.f.d.mts +0 -2
  169. package/out/com/cs/testlib.f.mjs +0 -7
  170. package/out/com/rust/module.f.d.mts +0 -23
  171. package/out/com/rust/module.f.mjs +0 -224
  172. package/out/com/rust/test.f.d.mts +0 -2
  173. package/out/com/rust/test.f.mjs +0 -123
  174. package/out/com/rust/testlib.f.d.mts +0 -2
  175. package/out/com/rust/testlib.f.mjs +0 -7
  176. package/out/com/test/build.d.mts +0 -1
  177. package/out/com/test/build.f.d.mts +0 -26
  178. package/out/com/test/build.f.mjs +0 -98
  179. package/out/com/test/build.mjs +0 -40
  180. package/out/com/types/module.f.d.mts +0 -23
  181. package/out/com/types/module.f.mjs +0 -51
  182. package/out/com/types/testlib.f.d.mts +0 -44
  183. package/out/com/types/testlib.f.mjs +0 -30
  184. package/out/commonjs/build/module.f.d.mts +0 -20
  185. package/out/commonjs/build/module.f.mjs +0 -107
  186. package/out/commonjs/build/test.f.d.mts +0 -3
  187. package/out/commonjs/build/test.f.mjs +0 -102
  188. package/out/commonjs/module/function/module.f.d.mts +0 -5
  189. package/out/commonjs/module/function/module.f.mjs +0 -15
  190. package/out/commonjs/module/module.f.d.mts +0 -52
  191. package/out/commonjs/module/module.f.mjs +0 -48
  192. package/out/commonjs/module.d.mts +0 -3
  193. package/out/commonjs/module.f.d.mts +0 -2
  194. package/out/commonjs/module.f.mjs +0 -10
  195. package/out/commonjs/module.mjs +0 -26
  196. package/out/commonjs/package/dependencies/module.f.d.mts +0 -6
  197. package/out/commonjs/package/dependencies/module.f.mjs +0 -21
  198. package/out/commonjs/package/dependencies/test.f.d.mts +0 -2
  199. package/out/commonjs/package/dependencies/test.f.mjs +0 -15
  200. package/out/commonjs/package/module.f.d.mts +0 -21
  201. package/out/commonjs/package/module.f.mjs +0 -40
  202. package/out/commonjs/package/test.f.d.mts +0 -2
  203. package/out/commonjs/package/test.f.mjs +0 -27
  204. package/out/commonjs/path/module.f.d.mts +0 -60
  205. package/out/commonjs/path/module.f.mjs +0 -171
  206. package/out/commonjs/path/test.f.d.mts +0 -25
  207. package/out/commonjs/path/test.f.mjs +0 -231
  208. package/out/commonjs/test.d.mts +0 -8
  209. package/out/commonjs/test.mjs +0 -87
  210. package/out/crypto/prime_field/module.f.d.mts +0 -67
  211. package/out/crypto/prime_field/module.f.mjs +0 -110
  212. package/out/crypto/prime_field/test.f.d.mts +0 -13
  213. package/out/crypto/prime_field/test.f.mjs +0 -152
  214. package/out/crypto/secp/module.f.d.mts +0 -110
  215. package/out/crypto/secp/module.f.mjs +0 -173
  216. package/out/crypto/secp/test.f.d.mts +0 -5
  217. package/out/crypto/secp/test.f.mjs +0 -78
  218. package/out/crypto/sha2/module.f.d.mts +0 -15
  219. package/out/crypto/sha2/module.f.mjs +0 -172
  220. package/out/crypto/sha2/test.f.d.mts +0 -10
  221. package/out/crypto/sha2/test.f.mjs +0 -86
  222. package/out/dev/index.d.mts +0 -1
  223. package/out/dev/index.mjs +0 -2
  224. package/out/dev/module.d.mts +0 -26
  225. package/out/dev/module.f.d.mts +0 -1
  226. package/out/dev/module.f.mjs +0 -2
  227. package/out/dev/module.mjs +0 -167
  228. package/out/dev/test/module.f.d.mts +0 -25
  229. package/out/dev/test/module.f.mjs +0 -134
  230. package/out/dev/test.d.mts +0 -3
  231. package/out/dev/test.f.d.mts +0 -9
  232. package/out/dev/test.f.mjs +0 -58
  233. package/out/dev/test.mjs +0 -52
  234. package/out/djs/module.f.d.mts +0 -20
  235. package/out/djs/module.f.mjs +0 -79
  236. package/out/djs/parser/module.f.d.mts +0 -56
  237. package/out/djs/parser/module.f.mjs +0 -448
  238. package/out/djs/parser/test.f.d.mts +0 -13
  239. package/out/djs/parser/test.f.mjs +0 -569
  240. package/out/djs/test.f.d.mts +0 -12
  241. package/out/djs/test.f.mjs +0 -84
  242. package/out/djs/tokenizer/module.f.d.mts +0 -13
  243. package/out/djs/tokenizer/module.f.mjs +0 -91
  244. package/out/djs/tokenizer/test.f.d.mts +0 -7
  245. package/out/djs/tokenizer/test.f.mjs +0 -530
  246. package/out/fsc/module.f.d.mts +0 -7
  247. package/out/fsc/module.f.mjs +0 -105
  248. package/out/fsc/test.f.d.mts +0 -4
  249. package/out/fsc/test.f.mjs +0 -19
  250. package/out/fsm/module.f.d.mts +0 -14
  251. package/out/fsm/module.f.mjs +0 -80
  252. package/out/fsm/test.f.d.mts +0 -5
  253. package/out/fsm/test.f.mjs +0 -138
  254. package/out/html/module.f.d.mts +0 -17
  255. package/out/html/module.f.mjs +0 -80
  256. package/out/html/test.f.d.mts +0 -10
  257. package/out/html/test.f.mjs +0 -45
  258. package/out/issues/test.f.d.mts +0 -16
  259. package/out/issues/test.f.mjs +0 -66
  260. package/out/js/tokenizer/module.f.d.mts +0 -163
  261. package/out/js/tokenizer/module.f.mjs +0 -729
  262. package/out/js/tokenizer/test.f.d.mts +0 -9
  263. package/out/js/tokenizer/test.f.mjs +0 -906
  264. package/out/json/module.f.d.mts +0 -33
  265. package/out/json/module.f.mjs +0 -89
  266. package/out/json/parser/module.f.d.mts +0 -32
  267. package/out/json/parser/module.f.mjs +0 -224
  268. package/out/json/parser/test.f.d.mts +0 -5
  269. package/out/json/parser/test.f.mjs +0 -329
  270. package/out/json/serializer/module.f.d.mts +0 -36
  271. package/out/json/serializer/module.f.mjs +0 -67
  272. package/out/json/serializer/test.f.d.mts +0 -8
  273. package/out/json/serializer/test.f.mjs +0 -87
  274. package/out/json/test.f.d.mts +0 -8
  275. package/out/json/test.f.mjs +0 -61
  276. package/out/json/tokenizer/module.f.d.mts +0 -13
  277. package/out/json/tokenizer/module.f.mjs +0 -78
  278. package/out/json/tokenizer/test.f.d.mts +0 -6
  279. package/out/json/tokenizer/test.f.mjs +0 -420
  280. package/out/nanvm-lib/tests/test.f.d.mts +0 -36
  281. package/out/nanvm-lib/tests/test.f.mjs +0 -87
  282. package/out/nodejs/version/main.d.mts +0 -1
  283. package/out/nodejs/version/main.mjs +0 -3
  284. package/out/nodejs/version/module.f.d.mts +0 -12
  285. package/out/nodejs/version/module.f.mjs +0 -34
  286. package/out/nodejs/version/test.f.d.mts +0 -2
  287. package/out/nodejs/version/test.f.mjs +0 -97
  288. package/out/text/ascii/module.f.d.mts +0 -70
  289. package/out/text/ascii/module.f.mjs +0 -154
  290. package/out/text/ascii/test.f.d.mts +0 -4
  291. package/out/text/ascii/test.f.mjs +0 -14
  292. package/out/text/module.f.d.mts +0 -13
  293. package/out/text/module.f.mjs +0 -19
  294. package/out/text/sgr/module.f.d.mts +0 -12
  295. package/out/text/sgr/module.f.mjs +0 -17
  296. package/out/text/test.f.d.mts +0 -2
  297. package/out/text/test.f.mjs +0 -19
  298. package/out/text/utf16/module.f.d.mts +0 -12
  299. package/out/text/utf16/module.f.mjs +0 -86
  300. package/out/text/utf16/test.f.d.mts +0 -6
  301. package/out/text/utf16/test.f.mjs +0 -145
  302. package/out/text/utf8/module.f.d.mts +0 -10
  303. package/out/text/utf8/module.f.mjs +0 -126
  304. package/out/text/utf8/test.f.d.mts +0 -6
  305. package/out/text/utf8/test.f.mjs +0 -175
  306. package/out/types/array/module.f.d.mts +0 -31
  307. package/out/types/array/module.f.mjs +0 -95
  308. package/out/types/array/test.f.d.mts +0 -10
  309. package/out/types/array/test.f.mjs +0 -116
  310. package/out/types/bigfloat/module.f.d.mts +0 -6
  311. package/out/types/bigfloat/module.f.mjs +0 -77
  312. package/out/types/bigfloat/test.f.d.mts +0 -6
  313. package/out/types/bigfloat/test.f.mjs +0 -349
  314. package/out/types/bigint/module.f.d.mts +0 -29
  315. package/out/types/bigint/module.f.mjs +0 -114
  316. package/out/types/bigint/test.f.d.mts +0 -16
  317. package/out/types/bigint/test.f.mjs +0 -199
  318. package/out/types/bit_vec/module.f.d.mts +0 -158
  319. package/out/types/bit_vec/module.f.mjs +0 -194
  320. package/out/types/bit_vec/test.f.d.mts +0 -23
  321. package/out/types/bit_vec/test.f.mjs +0 -210
  322. package/out/types/btree/find/module.f.d.mts +0 -36
  323. package/out/types/btree/find/module.f.mjs +0 -137
  324. package/out/types/btree/find/test.f.d.mts +0 -2
  325. package/out/types/btree/find/test.f.mjs +0 -156
  326. package/out/types/btree/module.f.d.mts +0 -5
  327. package/out/types/btree/module.f.mjs +0 -34
  328. package/out/types/btree/remove/module.f.d.mts +0 -14
  329. package/out/types/btree/remove/module.f.mjs +0 -209
  330. package/out/types/btree/remove/test.f.d.mts +0 -7
  331. package/out/types/btree/remove/test.f.mjs +0 -638
  332. package/out/types/btree/set/module.f.d.mts +0 -5
  333. package/out/types/btree/set/module.f.mjs +0 -114
  334. package/out/types/btree/set/test.f.d.mts +0 -2
  335. package/out/types/btree/set/test.f.mjs +0 -390
  336. package/out/types/btree/test.f.d.mts +0 -13
  337. package/out/types/btree/test.f.mjs +0 -83
  338. package/out/types/btree/types/module.f.d.mts +0 -14
  339. package/out/types/btree/types/module.f.mjs +0 -50
  340. package/out/types/byte_set/module.f.d.mts +0 -25
  341. package/out/types/byte_set/module.f.mjs +0 -42
  342. package/out/types/byte_set/test.f.d.mts +0 -13
  343. package/out/types/byte_set/test.f.mjs +0 -123
  344. package/out/types/function/compare/module.f.d.mts +0 -23
  345. package/out/types/function/compare/module.f.mjs +0 -22
  346. package/out/types/function/compare/test.f.d.mts +0 -2
  347. package/out/types/function/compare/test.f.mjs +0 -8
  348. package/out/types/function/module.f.d.mts +0 -51
  349. package/out/types/function/module.f.mjs +0 -44
  350. package/out/types/function/operator/module.f.d.mts +0 -60
  351. package/out/types/function/operator/module.f.mjs +0 -60
  352. package/out/types/function/test.f.d.mts +0 -2
  353. package/out/types/function/test.f.mjs +0 -15
  354. package/out/types/list/module.f.d.mts +0 -82
  355. package/out/types/list/module.f.mjs +0 -269
  356. package/out/types/list/test.f.d.mts +0 -38
  357. package/out/types/list/test.f.mjs +0 -401
  358. package/out/types/map/module.f.d.mts +0 -21
  359. package/out/types/map/module.f.mjs +0 -54
  360. package/out/types/map/test.f.d.mts +0 -5
  361. package/out/types/map/test.f.mjs +0 -115
  362. package/out/types/nibble_set/module.f.d.mts +0 -16
  363. package/out/types/nibble_set/module.f.mjs +0 -19
  364. package/out/types/nibble_set/test.f.d.mts +0 -13
  365. package/out/types/nibble_set/test.f.mjs +0 -90
  366. package/out/types/nullable/module.f.d.mts +0 -9
  367. package/out/types/nullable/module.f.mjs +0 -9
  368. package/out/types/nullable/test.f.d.mts +0 -2
  369. package/out/types/nullable/test.f.mjs +0 -12
  370. package/out/types/number/module.f.d.mts +0 -7
  371. package/out/types/number/module.f.mjs +0 -12
  372. package/out/types/number/test.f.d.mts +0 -11
  373. package/out/types/number/test.f.mjs +0 -126
  374. package/out/types/object/module.f.d.mts +0 -22
  375. package/out/types/object/module.f.mjs +0 -27
  376. package/out/types/object/test.f.d.mts +0 -5
  377. package/out/types/object/test.f.mjs +0 -17
  378. package/out/types/range/module.f.d.mts +0 -6
  379. package/out/types/range/module.f.mjs +0 -6
  380. package/out/types/range/test.f.d.mts +0 -2
  381. package/out/types/range/test.f.mjs +0 -18
  382. package/out/types/range_map/module.f.d.mts +0 -19
  383. package/out/types/range_map/module.f.mjs +0 -84
  384. package/out/types/range_map/test.f.d.mts +0 -6
  385. package/out/types/range_map/test.f.mjs +0 -201
  386. package/out/types/result/module.d.mts +0 -7
  387. package/out/types/result/module.f.d.mts +0 -22
  388. package/out/types/result/module.f.mjs +0 -25
  389. package/out/types/result/module.mjs +0 -16
  390. package/out/types/sorted_list/module.f.d.mts +0 -53
  391. package/out/types/sorted_list/module.f.mjs +0 -102
  392. package/out/types/sorted_list/test.f.d.mts +0 -5
  393. package/out/types/sorted_list/test.f.mjs +0 -66
  394. package/out/types/sorted_set/module.f.d.mts +0 -19
  395. package/out/types/sorted_set/module.f.mjs +0 -29
  396. package/out/types/sorted_set/test.f.d.mts +0 -6
  397. package/out/types/sorted_set/test.f.mjs +0 -80
  398. package/out/types/string/module.f.d.mts +0 -9
  399. package/out/types/string/module.f.mjs +0 -17
  400. package/out/types/string/test.f.d.mts +0 -15
  401. package/out/types/string/test.f.mjs +0 -58
  402. package/out/types/string_set/module.f.d.mts +0 -13
  403. package/out/types/string_set/module.f.mjs +0 -29
  404. package/out/types/string_set/test.f.d.mts +0 -5
  405. package/out/types/string_set/test.f.mjs +0 -65
  406. package/text/module.f.mjs +0 -27
  407. package/text/utf16/module.f.mjs +0 -96
  408. package/types/array/module.f.mjs +0 -119
  409. package/types/btree/find/module.f.mjs +0 -125
  410. package/types/btree/types/module.f.mjs +0 -64
  411. package/types/byte_set/module.f.mjs +0 -61
  412. package/types/function/compare/module.f.mjs +0 -29
  413. package/types/function/module.f.mjs +0 -50
  414. package/types/function/operator/module.f.mjs +0 -78
  415. package/types/function/test.f.mjs +0 -17
  416. package/types/list/module.f.mjs +0 -320
  417. package/types/map/module.f.mjs +0 -67
  418. package/types/nibble_set/module.f.mjs +0 -28
  419. package/types/nullable/module.f.mjs +0 -11
  420. package/types/number/module.f.mjs +0 -16
  421. package/types/object/module.f.mjs +0 -33
  422. package/types/range/module.f.mjs +0 -8
  423. package/types/range_map/module.f.mjs +0 -84
  424. package/types/result/module.f.mjs +0 -28
  425. package/types/sorted_list/module.f.mjs +0 -107
  426. package/types/sorted_set/module.f.mjs +0 -38
  427. package/types/string/module.f.mjs +0 -22
  428. package/types/string_set/module.f.mjs +0 -36
@@ -1,21 +0,0 @@
1
- /** @type {(name: string) => <T>(map: Map<T>) => T|null} */
2
- export const at: (name: string) => <T>(map: Map<T>) => T | null;
3
- /** @type {<T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>} */
4
- export const setReduce: <T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>;
5
- /** @type {(name: string) => <T>(value: T) => (map: Map<T>) => Map<T>} */
6
- export const setReplace: (name: string) => <T>(value: T) => (map: Map<T>) => Map<T>;
7
- /** @type {<T>(map: Map<T>) => list.List<Entry<T>>} */
8
- export const entries: <T>(map: Map<T>) => list.List<Entry<T>>;
9
- /** @type {<T>(entries: list.List<Entry<T>>) => Map<T>} */
10
- export const fromEntries: <T>(entries: list.List<Entry<T>>) => Map<T>;
11
- /** @type {(name: string) => <T>(map: Map<T>) => Map<T>} */
12
- export const remove: (name: string) => <T>(map: Map<T>) => Map<T>;
13
- export const empty: null;
14
- export type Sign = Compare.Sign;
15
- export type Cmp<T> = Compare.Compare<T>;
16
- export type Entry<T> = readonly [string, T];
17
- export type Map<T> = BtreeTypes.Tree<Entry<T>>;
18
- import * as Operator from '../function/operator/module.f.mjs';
19
- import * as list from '../list/module.f.mjs';
20
- import * as Compare from '../function/compare/module.f.mjs';
21
- import * as BtreeTypes from '../btree/types/module.f.mjs';
@@ -1,54 +0,0 @@
1
- // @ts-self-types="./module.f.d.mts"
2
- import * as BtreeTypes from '../btree/types/module.f.mjs';
3
- import * as btf from '../btree/find/module.f.mjs';
4
- const { value, find } = btf;
5
- import * as bts from '../btree/set/module.f.mjs';
6
- const { set } = bts;
7
- import * as btr from '../btree/remove/module.f.mjs';
8
- const { remove: btreeRemove } = btr;
9
- import * as bt from '../btree/module.f.mjs';
10
- const { values } = bt;
11
- import * as Compare from '../function/compare/module.f.mjs';
12
- import * as s from '../string/module.f.mjs';
13
- const { cmp } = s;
14
- import * as list from '../list/module.f.mjs';
15
- const { fold } = list;
16
- import * as Operator from '../function/operator/module.f.mjs';
17
- /** @typedef {Compare.Sign} Sign */
18
- /**
19
- * @template T
20
- * @typedef {Compare.Compare<T>} Cmp
21
- */
22
- /**
23
- * @template T
24
- * @typedef {readonly[string, T]} Entry
25
- */
26
- /**
27
- * @template T
28
- * @typedef {BtreeTypes.Tree<Entry<T>>} Map
29
- */
30
- /** @type {(a: string) => <T>(b: Entry<T>) => Sign} */
31
- const keyCmp = a => ([b]) => cmp(a)(b);
32
- /** @type {(name: string) => <T>(map: Map<T>) => T|null} */
33
- export const at = name => map => {
34
- if (map === null) {
35
- return null;
36
- }
37
- const result = value(find(keyCmp(name))(map).first);
38
- return result === null ? null : result[1];
39
- };
40
- /** @type {<T>(reduce: Operator.Reduce<T>) => (entry: Entry<T>) => (map: Map<T>) => Map<T>} */
41
- const setReduceEntry = reduce => entry => set(keyCmp(entry[0]))(old => old === null ? entry : [old[0], reduce(old[1])(entry[1])]);
42
- /** @type {<T>(reduce: Operator.Reduce<T>) => (name: string) => (value: T) => (map: Map<T>) => Map<T>} */
43
- export const setReduce = reduce => name => value => setReduceEntry(reduce)([name, value]);
44
- /** @type {<T>(a: T) => (b: T) => T} */
45
- const replace = () => b => b;
46
- /** @type {(name: string) => <T>(value: T) => (map: Map<T>) => Map<T>} */
47
- export const setReplace = name => value => setReduceEntry(replace)([name, value]);
48
- /** @type {<T>(map: Map<T>) => list.List<Entry<T>>} */
49
- export const entries = values;
50
- /** @type {<T>(entries: list.List<Entry<T>>) => Map<T>} */
51
- export const fromEntries = fold(setReduceEntry(replace))(null);
52
- /** @type {(name: string) => <T>(map: Map<T>) => Map<T>} */
53
- export const remove = name => btreeRemove(keyCmp(name));
54
- export const empty = null;
@@ -1,5 +0,0 @@
1
- declare namespace _default {
2
- let main: (() => void)[];
3
- function stress(): void;
4
- }
5
- export default _default;
@@ -1,115 +0,0 @@
1
- import * as _ from './module.f.mjs';
2
- const { at, setReplace, setReduce, empty, entries, remove } = _;
3
- import * as seq from '../list/module.f.mjs';
4
- export default {
5
- main: [
6
- () => {
7
- let m = setReplace('a')(1)(null);
8
- if (at('a')(m) !== 1) {
9
- throw 'error';
10
- }
11
- if (at('b')(m) !== null) {
12
- throw 'error';
13
- }
14
- m = setReplace('b')(2)(m);
15
- if (at('a')(m) !== 1) {
16
- throw 'error';
17
- }
18
- if (at('b')(m) !== 2) {
19
- throw 'error';
20
- }
21
- if (at('c')(m) !== null) {
22
- throw 'error';
23
- }
24
- m = setReplace('z')(3)(m);
25
- if (at('a')(m) !== 1) {
26
- throw 'error';
27
- }
28
- if (at('b')(m) !== 2) {
29
- throw 'error';
30
- }
31
- if (at('z')(m) !== 3) {
32
- throw 'error';
33
- }
34
- if (at('')(m) !== null) {
35
- throw 'error';
36
- }
37
- m = setReplace('')(4)(m);
38
- if (at('a')(m) !== 1) {
39
- throw 'error';
40
- }
41
- if (at('b')(m) !== 2) {
42
- throw 'error';
43
- }
44
- if (at('z')(m) !== 3) {
45
- throw 'error';
46
- }
47
- if (at('')(m) !== 4) {
48
- throw 'error';
49
- }
50
- if (at('Hello world!')(m) !== null) {
51
- throw 'error';
52
- }
53
- m = setReplace('Hello world!')(42)(m);
54
- if (at('a')(m) !== 1) {
55
- throw 'error';
56
- }
57
- if (at('b')(m) !== 2) {
58
- throw 'error';
59
- }
60
- if (at('z')(m) !== 3) {
61
- throw 'error';
62
- }
63
- if (at('')(m) !== 4) {
64
- throw 'error';
65
- }
66
- if (at('Hello world!')(m) !== 42) {
67
- throw 'error';
68
- }
69
- if (at('x')(m) !== null) {
70
- throw 'error';
71
- }
72
- // console.log(Array.from(m.entries()))
73
- m = remove('Hello world!')(m);
74
- if (at('Hello world!')(m) !== null) {
75
- throw m;
76
- }
77
- m = setReduce(a => b => a + b)('a')(43)(m);
78
- if (at('a')(m) !== 44) {
79
- throw 'error';
80
- }
81
- },
82
- () => {
83
- let m = setReplace('x')(12)(null);
84
- m = setReplace('y')(44)(m);
85
- if (at('x')(m) !== 12) {
86
- throw 'error';
87
- }
88
- if (at('y')(m) !== 44) {
89
- throw 'error';
90
- }
91
- if (at('a')(m) !== null) {
92
- throw 'error';
93
- }
94
- const e = seq.toArray(entries(m));
95
- if (e.length !== 2) {
96
- throw 'error';
97
- }
98
- },
99
- ],
100
- stress: () => {
101
- /** @type {import('./module.f.mjs').Map<number>} */
102
- let m = empty;
103
- for (let i = 0; i < 100_000; ++i) {
104
- m = setReplace((i * i).toString())(i)(m);
105
- /*
106
- console.log()
107
- console.log(`# ${i}`)
108
- console.log()
109
- for (const e of m.struct()) {
110
- console.log(e)
111
- }
112
- */
113
- }
114
- }
115
- };
@@ -1,16 +0,0 @@
1
- /** @typedef {number} NibbleSet */
2
- /** @typedef {number} Nibble */
3
- export const empty: 0;
4
- export const universe: 65535;
5
- /** @type {(n: Nibble) => (s: NibbleSet) => boolean} */
6
- export const has: (n: Nibble) => (s: NibbleSet) => boolean;
7
- /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
8
- export const set: (n: Nibble) => (s: NibbleSet) => NibbleSet;
9
- /** @type {(n: NibbleSet) => NibbleSet} */
10
- export const complement: (n: NibbleSet) => NibbleSet;
11
- /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
12
- export const unset: (n: Nibble) => (s: NibbleSet) => NibbleSet;
13
- /** @type {(r: readonly[number, number]) => (s: NibbleSet) => NibbleSet} */
14
- export const setRange: (r: readonly [number, number]) => (s: NibbleSet) => NibbleSet;
15
- export type NibbleSet = number;
16
- export type Nibble = number;
@@ -1,19 +0,0 @@
1
- // @ts-self-types="./module.f.d.mts"
2
- /** @typedef {number} NibbleSet */
3
- /** @typedef {number} Nibble */
4
- export const empty = 0;
5
- export const universe = 0xFFFF;
6
- /** @type {(n: Nibble) => NibbleSet} */
7
- const one = n => 1 << n;
8
- /** @type {(n: Nibble) => (s: NibbleSet) => boolean} */
9
- export const has = n => s => ((s >> n) & 1) === 1;
10
- /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
11
- export const set = n => s => s | one(n);
12
- /** @type {(n: NibbleSet) => NibbleSet} */
13
- export const complement = s => universe ^ s;
14
- /** @type {(n: Nibble) => (s: NibbleSet) => NibbleSet} */
15
- export const unset = n => s => s & complement(one(n));
16
- /** @type {(r: readonly[number, number]) => NibbleSet} */
17
- const range = ([a, b]) => one(b - a + 1) - 1 << a;
18
- /** @type {(r: readonly[number, number]) => (s: NibbleSet) => NibbleSet} */
19
- export const setRange = r => s => s | range(r);
@@ -1,13 +0,0 @@
1
- declare namespace _default {
2
- function has(): void;
3
- let set: (() => void)[];
4
- function unset(): (() => void)[];
5
- function setRange(): void;
6
- function universe(): void;
7
- namespace compliment {
8
- export function empty(): void;
9
- export function universe_1(): void;
10
- export { universe_1 as universe };
11
- }
12
- }
13
- export default _default;
@@ -1,90 +0,0 @@
1
- import * as list from '../list/module.f.mjs';
2
- const { every, map, countdown } = list;
3
- import * as _ from './module.f.mjs';
4
- export default {
5
- has: () => {
6
- if (_.has(0)(_.empty)) {
7
- throw _.empty;
8
- }
9
- if (_.has(1)(_.empty)) {
10
- throw _.empty;
11
- }
12
- if (_.has(15)(_.empty)) {
13
- throw _.empty;
14
- }
15
- },
16
- set: [
17
- () => {
18
- const s = _.set(0)(_.empty);
19
- if (s !== 1) {
20
- throw s;
21
- }
22
- if (!_.has(0)(s)) {
23
- throw s;
24
- }
25
- if (_.has(1)(s)) {
26
- throw s;
27
- }
28
- if (_.has(15)(s)) {
29
- throw s;
30
- }
31
- },
32
- () => {
33
- const s = _.set(15)(_.empty);
34
- if (s !== 0x8000) {
35
- throw s;
36
- }
37
- if (_.has(0)(s)) {
38
- throw s;
39
- }
40
- if (_.has(1)(s)) {
41
- throw s;
42
- }
43
- if (!_.has(15)(s)) {
44
- throw s;
45
- }
46
- }
47
- ],
48
- unset: () => [
49
- () => {
50
- const a = _.set(0)(_.empty);
51
- const result = _.unset(0)(a);
52
- if (result !== 0) {
53
- throw result;
54
- }
55
- },
56
- () => {
57
- const a = _.set(15)(_.empty);
58
- const result = _.unset(15)(a);
59
- if (result !== 0) {
60
- throw result;
61
- }
62
- }
63
- ],
64
- setRange: () => {
65
- const result = _.setRange([2, 5])(_.empty);
66
- if (result !== 60) {
67
- throw result;
68
- }
69
- },
70
- universe: () => {
71
- const x = every(map(v => _.has(v)(_.universe))(countdown(16)));
72
- if (!x) {
73
- throw x;
74
- }
75
- },
76
- compliment: {
77
- empty: () => {
78
- const r = _.complement(_.empty);
79
- if (r !== _.universe) {
80
- throw r;
81
- }
82
- },
83
- universe: () => {
84
- const r = _.complement(_.universe);
85
- if (r !== _.empty) {
86
- throw r;
87
- }
88
- },
89
- }
90
- };
@@ -1,9 +0,0 @@
1
- /**
2
- * @template T
3
- * @typedef {T|null} Nullable
4
- */
5
- /** @type {<T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>} */
6
- export const map: <T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>;
7
- /** @type {<T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>} */
8
- export const match: <T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>;
9
- export type Nullable<T> = T | null;
@@ -1,9 +0,0 @@
1
- // @ts-self-types="./module.f.d.mts"
2
- /**
3
- * @template T
4
- * @typedef {T|null} Nullable
5
- */
6
- /** @type {<T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>} */
7
- export const map = f => value => value === null ? null : f(value);
8
- /** @type {<T, R>(f: (_: T) => R) => (none: () => R) => (_: Nullable<T>) => Nullable<R>} */
9
- export const match = f => none => value => value === null ? none() : f(value);
@@ -1,2 +0,0 @@
1
- declare function _default(): void;
2
- export default _default;
@@ -1,12 +0,0 @@
1
- import * as _ from './module.f.mjs';
2
- export default () => {
3
- const optionSq = _.map(v => v * v);
4
- const sq3 = optionSq(3);
5
- if (sq3 !== 9) {
6
- throw sq3;
7
- }
8
- const sqNull = optionSq(null);
9
- if (sqNull !== null) {
10
- throw sqNull;
11
- }
12
- };
@@ -1,7 +0,0 @@
1
- export const sum: (input: list.List<number>) => number;
2
- export const min: (input: list.List<number>) => number | null;
3
- export const max: (input: list.List<number>) => number | null;
4
- /** @type {(a: number) => (b: number) => compare.Sign} */
5
- export const cmp: (a: number) => (b: number) => compare.Sign;
6
- import * as list from '../list/module.f.mjs';
7
- import * as compare from '../function/compare/module.f.mjs';
@@ -1,12 +0,0 @@
1
- // @ts-self-types="./module.f.d.mts"
2
- import * as list from '../list/module.f.mjs';
3
- const { reduce } = list;
4
- import * as operator from '../function/operator/module.f.mjs';
5
- const { addition, min: minOp, max: maxOp } = operator;
6
- import * as compare from '../function/compare/module.f.mjs';
7
- const { unsafeCmp } = compare;
8
- export const sum = reduce(addition)(0);
9
- export const min = reduce(minOp)(null);
10
- export const max = reduce(maxOp)(null);
11
- /** @type {(a: number) => (b: number) => compare.Sign} */
12
- export const cmp = unsafeCmp;
@@ -1,11 +0,0 @@
1
- declare namespace _default {
2
- function sum(): void;
3
- namespace min {
4
- function empty(): void;
5
- function multi(): void;
6
- }
7
- function max(): void;
8
- function cmp(): void;
9
- function standard(): void;
10
- }
11
- export default _default;
@@ -1,126 +0,0 @@
1
- import * as _ from './module.f.mjs';
2
- const { sum, min, max, cmp } = _;
3
- export default {
4
- sum: () => {
5
- const result = sum([2, 3, 4, 5]);
6
- if (result !== 14) {
7
- throw result;
8
- }
9
- },
10
- min: {
11
- empty: () => {
12
- const result = min([]);
13
- if (result !== null) {
14
- throw result;
15
- }
16
- },
17
- multi: () => {
18
- const result = min([1, 2, 12, -4, 8]);
19
- if (result !== -4) {
20
- throw result;
21
- }
22
- }
23
- },
24
- max: () => {
25
- const result = max([1, 2, 12, -4, 8]);
26
- if (result !== 12) {
27
- throw result;
28
- }
29
- },
30
- cmp: () => {
31
- const result = cmp(4)(5);
32
- if (result !== -1) {
33
- throw result;
34
- }
35
- },
36
- standard: () => {
37
- /** @type {(a: bigint) => (a: bigint) => void} */
38
- const check = a => b => {
39
- if (BigInt(Number(a)) != b) {
40
- throw [a, b];
41
- }
42
- };
43
- /** @type {(v: bigint) => void} */
44
- const eq = v => check(v)(v);
45
- // 53, 0x35 bits.
46
- // 3 2 1 0
47
- // 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210
48
- eq(4503599627370496n);
49
- eq(4503599627370497n);
50
- eq(4503599627370498n);
51
- eq(4503599627370499n);
52
- eq(4503599627370500n);
53
- //
54
- eq(8205552883602248n);
55
- eq(6023495077481713n);
56
- eq(7655550916643882n);
57
- eq(7408615831253283n);
58
- eq(5372046171422892n);
59
- //
60
- eq(9007199254740991n);
61
- eq(9007199254740990n);
62
- eq(9007199254740989n);
63
- eq(9007199254740988n);
64
- eq(9007199254740987n);
65
- eq(9007199254740986n);
66
- eq(9007199254740985n);
67
- eq(9007199254740984n);
68
- // 54, 0x35+1 bits.
69
- // 3 2 1 0
70
- // 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_1
71
- check(9007199254740992n)(9007199254740992n);
72
- check(16585805050637558n)(16585805050637558n);
73
- check(18014398509481982n)(18014398509481982n);
74
- // round down
75
- check(9007199254740993n)(9007199254740992n);
76
- check(9007199254740997n)(9007199254740996n);
77
- check(11727370849309157n)(11727370849309156n);
78
- check(18014398509481981n)(18014398509481980n);
79
- // round up
80
- check(9007199254740995n)(9007199254740996n);
81
- check(15679542343753527n)(15679542343753528n);
82
- check(18014398509481983n)(18014398509481984n);
83
- // 55, 0x35+2 bits.
84
- // 3 2 1 0
85
- // 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_12
86
- // 0_xx: down, down, up
87
- // 0_00
88
- check(18014398509481984n)(18014398509481984n);
89
- check(31009640954244032n)(31009640954244032n);
90
- check(36028797018963960n)(36028797018963960n);
91
- // 0_01 round down
92
- check(18014398509481985n)(18014398509481984n);
93
- check(35865859090492321n)(35865859090492320n);
94
- check(36028797018963961n)(36028797018963960n);
95
- // 0_10 round down
96
- check(18014398509481986n)(18014398509481984n);
97
- check(20537830900813786n)(20537830900813784n);
98
- check(36028797018963962n)(36028797018963960n);
99
- // 0_11 round up
100
- check(18014398509481987n)(18014398509481988n);
101
- check(20762549594556867n)(20762549594556868n);
102
- check(36028797018963963n)(36028797018963964n);
103
- // 1_xx: down, up, up
104
- // 1_00
105
- check(18014398509481988n)(18014398509481988n);
106
- check(27158415062912468n)(27158415062912468n);
107
- check(36028797018963963n)(36028797018963964n);
108
- // 1_01 round down
109
- check(18014398509481989n)(18014398509481988n);
110
- check(23136524663958789n)(23136524663958788n);
111
- check(36028797018963965n)(36028797018963964n);
112
- // 1_10 round up
113
- check(18014398509481990n)(18014398509481992n);
114
- check(35732739218314830n)(35732739218314832n);
115
- check(36028797018963966n)(36028797018963968n);
116
- // 1_11 round up
117
- check(18014398509481991n)(18014398509481992n);
118
- check(35015291789494295n)(35015291789494296n);
119
- check(36028797018963967n)(36028797018963968n);
120
- // 57, 0x35+4 bits.
121
- // 3 2 1 0
122
- // 4_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_FEDC_BA98_7654_3210_1234
123
- check(104002482718319358n)(104002482718319360n);
124
- check(142693895881191444n)(142693895881191440n);
125
- }
126
- };
@@ -1,22 +0,0 @@
1
- /**
2
- * @template T
3
- * @typedef {{
4
- * readonly [k in string]: T
5
- * }} Map
6
- */
7
- /**
8
- * @template T
9
- * @typedef {readonly[string, T]} Entry
10
- */
11
- /** @type {(name: string) => <T>(object: Map<T>) => T|null} */
12
- export const at: (name: string) => <T>(object: Map<T>) => T | null;
13
- /** @type {<T>(e: list.List<Entry<T>>) => list.List<Entry<T>>} */
14
- export const sort: <T>(e: list.List<Entry<T>>) => list.List<Entry<T>>;
15
- /** @type {<T>(e: list.List<Entry<T>>) => Map<T>} */
16
- export const fromEntries: <T>(e: list.List<Entry<T>>) => Map<T>;
17
- /** @type {<T>(m: btMap.Map<T>) => Map<T>} */
18
- export const fromMap: <T>(m: btMap.Map<T>) => Map<T>;
19
- export type Map<T> = { readonly [k in string]: T; };
20
- export type Entry<T> = readonly [string, T];
21
- import * as list from '../list/module.f.mjs';
22
- import * as btMap from '../map/module.f.mjs';
@@ -1,27 +0,0 @@
1
- // @ts-self-types="./module.f.d.mts"
2
- import * as list from '../list/module.f.mjs';
3
- const { iterable } = list;
4
- import * as btMap from '../map/module.f.mjs';
5
- const { entries: mapEntries, fromEntries: mapFromEntries } = btMap;
6
- const { getOwnPropertyDescriptor, fromEntries: objectFromEntries } = Object;
7
- /**
8
- * @template T
9
- * @typedef {{
10
- * readonly [k in string]: T
11
- * }} Map
12
- */
13
- /**
14
- * @template T
15
- * @typedef {readonly[string, T]} Entry
16
- */
17
- /** @type {(name: string) => <T>(object: Map<T>) => T|null} */
18
- export const at = name => object => {
19
- const r = getOwnPropertyDescriptor(object, name);
20
- return r === void 0 ? null : r.value;
21
- };
22
- /** @type {<T>(e: list.List<Entry<T>>) => list.List<Entry<T>>} */
23
- export const sort = e => mapEntries(mapFromEntries(e));
24
- /** @type {<T>(e: list.List<Entry<T>>) => Map<T>} */
25
- export const fromEntries = e => objectFromEntries(iterable(e));
26
- /** @type {<T>(m: btMap.Map<T>) => Map<T>} */
27
- export const fromMap = m => fromEntries(mapEntries(m));
@@ -1,5 +0,0 @@
1
- declare namespace _default {
2
- function ctor(): void;
3
- function property(): void;
4
- }
5
- export default _default;
@@ -1,17 +0,0 @@
1
- import * as _ from './module.f.mjs';
2
- export default {
3
- ctor: () => {
4
- const a = {};
5
- const value = _.at('constructor')(a);
6
- if (value !== null) {
7
- throw value;
8
- }
9
- },
10
- property: () => {
11
- const a = { constructor: 42 };
12
- const value = _.at('constructor')(a);
13
- if (value !== 42) {
14
- throw value;
15
- }
16
- }
17
- };
@@ -1,6 +0,0 @@
1
- /** @typedef {readonly[number,number]} Range */
2
- /** @type {(range: Range) => (i: number) => boolean} */
3
- export const contains: (range: Range) => (i: number) => boolean;
4
- /** @type {(i: number) => Range} */
5
- export const one: (i: number) => Range;
6
- export type Range = readonly [number, number];
@@ -1,6 +0,0 @@
1
- // @ts-self-types="./module.f.d.mts"
2
- /** @typedef {readonly[number,number]} Range */
3
- /** @type {(range: Range) => (i: number) => boolean} */
4
- export const contains = ([b, e]) => i => b <= i && i <= e;
5
- /** @type {(i: number) => Range} */
6
- export const one = a => [a, a];
@@ -1,2 +0,0 @@
1
- declare function _default(): void;
2
- export default _default;
@@ -1,18 +0,0 @@
1
- import * as _ from './module.f.mjs';
2
- export default () => {
3
- if (!_.contains([0, 5])(1)) {
4
- throw 1;
5
- }
6
- if (!_.contains([0, 5])(0)) {
7
- throw 0;
8
- }
9
- if (!_.contains([0, 5])(5)) {
10
- throw 5;
11
- }
12
- if (_.contains([0, 5])(-1)) {
13
- throw -1;
14
- }
15
- if (_.contains([0, 5])(6)) {
16
- throw 6;
17
- }
18
- };