functionalscript 0.3.3 → 0.3.5

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 (457) hide show
  1. package/com/cpp/module.f.d.ts +10 -0
  2. package/com/cpp/module.f.js +107 -0
  3. package/com/cpp/test.f.d.ts +2 -0
  4. package/com/cpp/{test.f.ts → test.f.js} +9 -11
  5. package/com/cpp/testlib.f.d.ts +2 -0
  6. package/com/cpp/testlib.f.js +5 -0
  7. package/com/cs/module.f.d.ts +12 -0
  8. package/com/cs/module.f.js +80 -0
  9. package/com/cs/test.f.d.ts +2 -0
  10. package/com/cs/{test.f.ts → test.f.js} +9 -11
  11. package/com/cs/testlib.f.d.ts +2 -0
  12. package/com/cs/testlib.f.js +5 -0
  13. package/com/rust/module.f.d.ts +15 -0
  14. package/com/rust/module.f.js +169 -0
  15. package/com/rust/test.f.d.ts +2 -0
  16. package/com/rust/{test.f.ts → test.f.js} +7 -7
  17. package/com/rust/testlib.f.d.ts +2 -0
  18. package/com/rust/testlib.f.js +5 -0
  19. package/com/test/build.f.d.ts +20 -0
  20. package/com/test/build.f.js +58 -0
  21. package/com/types/module.f.d.ts +28 -0
  22. package/com/types/module.f.js +8 -0
  23. package/com/types/testlib.f.d.ts +44 -0
  24. package/com/types/{testlib.f.ts → testlib.f.js} +2 -3
  25. package/commonjs/build/module.f.d.ts +6 -0
  26. package/commonjs/build/module.f.js +69 -0
  27. package/commonjs/build/test.f.d.ts +2 -0
  28. package/commonjs/build/test.f.js +96 -0
  29. package/commonjs/module/function/{module.f.ts → module.f.d.ts} +5 -10
  30. package/commonjs/module/function/module.f.js +4 -0
  31. package/commonjs/module/module.f.d.ts +18 -0
  32. package/commonjs/module/module.f.js +12 -0
  33. package/commonjs/module.f.d.ts +6 -0
  34. package/commonjs/module.f.js +1 -0
  35. package/commonjs/package/dependencies/module.f.d.ts +7 -0
  36. package/commonjs/package/dependencies/module.f.js +13 -0
  37. package/commonjs/package/dependencies/test.f.d.ts +2 -0
  38. package/commonjs/package/dependencies/test.f.js +15 -0
  39. package/commonjs/package/module.f.d.ts +17 -0
  40. package/commonjs/package/module.f.js +18 -0
  41. package/commonjs/package/test.f.d.ts +2 -0
  42. package/commonjs/package/test.f.js +27 -0
  43. package/commonjs/path/module.f.d.ts +24 -0
  44. package/commonjs/path/module.f.js +114 -0
  45. package/commonjs/path/test.f.d.ts +25 -0
  46. package/commonjs/path/{test.f.ts → test.f.js} +123 -89
  47. package/crypto/prime_field/module.f.d.ts +43 -0
  48. package/crypto/prime_field/module.f.js +78 -0
  49. package/crypto/prime_field/test.f.d.ts +13 -0
  50. package/crypto/prime_field/test.f.js +149 -0
  51. package/crypto/secp/module.f.d.ts +68 -0
  52. package/crypto/secp/module.f.js +127 -0
  53. package/crypto/secp/test.f.d.ts +5 -0
  54. package/crypto/secp/test.f.js +72 -0
  55. package/crypto/sha2/module.f.d.ts +13 -0
  56. package/crypto/sha2/module.f.js +145 -0
  57. package/crypto/sha2/test.f.d.ts +9 -0
  58. package/crypto/sha2/test.f.js +82 -0
  59. package/dev/module.f.d.ts +1 -0
  60. package/dev/module.f.js +1 -0
  61. package/dev/test/module.f.d.ts +20 -0
  62. package/dev/test/module.f.js +75 -0
  63. package/dev/test.f.d.ts +9 -0
  64. package/dev/{test.f.ts → test.f.js} +22 -24
  65. package/djs/module.f.d.ts +17 -0
  66. package/djs/module.f.js +63 -0
  67. package/djs/parser/module.f.d.ts +12 -0
  68. package/djs/parser/module.f.js +333 -0
  69. package/djs/parser/test.f.d.ts +12 -0
  70. package/djs/parser/test.f.js +717 -0
  71. package/djs/serializer/module.f.d.ts +9 -0
  72. package/djs/serializer/module.f.js +81 -0
  73. package/djs/test/input.f.d.ts +2 -0
  74. package/djs/test/input.f.js +4 -0
  75. package/djs/test/m.f.d.ts +2 -0
  76. package/djs/test/m.f.js +1 -0
  77. package/djs/test.f.d.ts +12 -0
  78. package/djs/test.f.js +84 -0
  79. package/djs/tokenizer/module.f.d.ts +8 -0
  80. package/djs/tokenizer/module.f.js +60 -0
  81. package/djs/tokenizer/test.f.d.ts +7 -0
  82. package/djs/tokenizer/test.f.js +529 -0
  83. package/fsc/module.f.d.ts +5 -0
  84. package/fsc/module.f.js +75 -0
  85. package/fsc/test.f.d.ts +4 -0
  86. package/fsc/test.f.js +19 -0
  87. package/fsm/module.f.d.ts +13 -0
  88. package/fsm/module.f.js +59 -0
  89. package/fsm/test.f.d.ts +5 -0
  90. package/fsm/test.f.js +137 -0
  91. package/html/module.f.d.ts +13 -0
  92. package/html/module.f.js +58 -0
  93. package/html/test.f.d.ts +9 -0
  94. package/html/test.f.js +42 -0
  95. package/issues/test.f.d.ts +16 -0
  96. package/issues/test.f.js +70 -0
  97. package/js/tokenizer/module.f.d.ts +86 -0
  98. package/js/tokenizer/module.f.js +503 -0
  99. package/js/tokenizer/test.f.d.ts +9 -0
  100. package/js/tokenizer/test.f.js +905 -0
  101. package/json/module.f.d.ts +20 -0
  102. package/json/module.f.js +68 -0
  103. package/json/parser/module.f.d.ts +5 -0
  104. package/json/parser/module.f.js +155 -0
  105. package/json/parser/test.f.d.ts +5 -0
  106. package/json/parser/test.f.js +328 -0
  107. package/json/serializer/module.f.d.ts +7 -0
  108. package/json/serializer/module.f.js +21 -0
  109. package/json/serializer/test.f.d.ts +8 -0
  110. package/json/serializer/test.f.js +87 -0
  111. package/json/test.f.d.ts +8 -0
  112. package/json/test.f.js +61 -0
  113. package/json/tokenizer/module.f.d.ts +8 -0
  114. package/json/tokenizer/module.f.js +52 -0
  115. package/json/tokenizer/test.f.d.ts +6 -0
  116. package/json/tokenizer/test.f.js +419 -0
  117. package/nanvm-lib/tests/test.f.d.ts +27 -0
  118. package/nanvm-lib/tests/test.f.js +84 -0
  119. package/nodejs/version/module.f.d.ts +11 -0
  120. package/nodejs/version/module.f.js +16 -0
  121. package/nodejs/version/test.f.d.ts +2 -0
  122. package/nodejs/version/{test.f.ts → test.f.js} +13 -22
  123. package/package.json +9 -5
  124. package/text/ascii/module.f.d.ts +129 -0
  125. package/text/ascii/module.f.js +148 -0
  126. package/text/ascii/test.f.d.ts +4 -0
  127. package/text/ascii/test.f.js +14 -0
  128. package/text/module.f.d.ts +8 -0
  129. package/text/module.f.js +10 -0
  130. package/text/sgr/module.f.d.ts +8 -0
  131. package/text/sgr/module.f.js +8 -0
  132. package/text/test.f.d.ts +2 -0
  133. package/text/test.f.js +18 -0
  134. package/text/utf16/module.f.d.ts +9 -0
  135. package/text/utf16/module.f.js +66 -0
  136. package/text/utf16/test.f.d.ts +6 -0
  137. package/text/utf16/test.f.js +144 -0
  138. package/text/utf8/module.f.d.ts +6 -0
  139. package/text/utf8/module.f.js +112 -0
  140. package/text/utf8/test.f.d.ts +6 -0
  141. package/text/utf8/test.f.js +175 -0
  142. package/types/array/module.f.d.ts +21 -0
  143. package/types/array/module.f.js +23 -0
  144. package/types/array/test.f.d.ts +10 -0
  145. package/types/array/test.f.js +116 -0
  146. package/types/bigfloat/module.f.d.ts +3 -0
  147. package/types/bigfloat/module.f.js +66 -0
  148. package/types/bigfloat/test.f.d.ts +6 -0
  149. package/types/bigfloat/test.f.js +349 -0
  150. package/types/bigint/module.f.d.ts +54 -0
  151. package/types/bigint/{module.f.ts → module.f.js} +42 -65
  152. package/types/bigint/test.f.d.ts +16 -0
  153. package/types/bigint/test.f.js +199 -0
  154. package/types/bit_vec/module.f.d.ts +134 -0
  155. package/types/bit_vec/{module.f.ts → module.f.js} +47 -65
  156. package/types/bit_vec/test.f.d.ts +22 -0
  157. package/types/bit_vec/test.f.js +210 -0
  158. package/types/btree/find/module.f.d.ts +20 -0
  159. package/types/btree/find/module.f.js +84 -0
  160. package/types/btree/find/test.f.d.ts +2 -0
  161. package/types/btree/find/test.f.js +152 -0
  162. package/types/btree/module.f.d.ts +4 -0
  163. package/types/btree/module.f.js +31 -0
  164. package/types/btree/remove/module.f.d.ts +4 -0
  165. package/types/btree/remove/module.f.js +174 -0
  166. package/types/btree/remove/test.f.d.ts +5 -0
  167. package/types/btree/remove/test.f.js +634 -0
  168. package/types/btree/set/module.f.d.ts +3 -0
  169. package/types/btree/set/module.f.js +103 -0
  170. package/types/btree/set/test.f.d.ts +2 -0
  171. package/types/btree/set/test.f.js +360 -0
  172. package/types/btree/test.f.d.ts +8 -0
  173. package/types/btree/test.f.js +75 -0
  174. package/types/btree/types/module.f.d.ts +11 -0
  175. package/types/btree/types/module.f.js +1 -0
  176. package/types/byte_set/module.f.d.ts +16 -0
  177. package/types/byte_set/module.f.js +28 -0
  178. package/types/byte_set/test.f.d.ts +12 -0
  179. package/types/byte_set/test.f.js +122 -0
  180. package/types/function/compare/module.f.d.ts +10 -0
  181. package/types/function/compare/module.f.js +7 -0
  182. package/types/function/compare/test.f.d.ts +2 -0
  183. package/types/function/compare/test.f.js +8 -0
  184. package/types/function/module.f.d.ts +28 -0
  185. package/types/function/module.f.js +19 -0
  186. package/types/function/operator/module.f.d.ts +20 -0
  187. package/types/function/operator/module.f.js +18 -0
  188. package/types/function/test.f.d.ts +2 -0
  189. package/types/function/test.f.js +12 -0
  190. package/types/list/module.f.d.ts +50 -0
  191. package/types/list/module.f.js +171 -0
  192. package/types/list/test.f.d.ts +22 -0
  193. package/types/list/test.f.js +395 -0
  194. package/types/map/module.f.d.ts +14 -0
  195. package/types/map/module.f.js +31 -0
  196. package/types/map/test.f.d.ts +5 -0
  197. package/types/map/test.f.js +114 -0
  198. package/types/nibble_set/module.f.d.ts +10 -0
  199. package/types/nibble_set/module.f.js +9 -0
  200. package/types/nibble_set/test.f.d.ts +12 -0
  201. package/types/nibble_set/test.f.js +90 -0
  202. package/types/nullable/module.f.d.ts +3 -0
  203. package/types/nullable/module.f.js +2 -0
  204. package/types/nullable/test.f.d.ts +2 -0
  205. package/types/nullable/test.f.js +12 -0
  206. package/types/number/module.f.d.ts +6 -0
  207. package/types/number/module.f.js +8 -0
  208. package/types/number/test.f.d.ts +11 -0
  209. package/types/number/test.f.js +124 -0
  210. package/types/object/module.f.d.ts +10 -0
  211. package/types/object/module.f.js +12 -0
  212. package/types/object/test.f.d.ts +5 -0
  213. package/types/object/test.f.js +17 -0
  214. package/types/range/module.f.d.ts +3 -0
  215. package/types/range/module.f.js +2 -0
  216. package/types/range/test.f.d.ts +2 -0
  217. package/types/range/test.f.js +18 -0
  218. package/types/range_map/module.f.d.ts +14 -0
  219. package/types/range_map/module.f.js +51 -0
  220. package/types/range_map/test.f.d.ts +6 -0
  221. package/types/range_map/test.f.js +176 -0
  222. package/types/result/module.f.d.ts +7 -0
  223. package/types/result/module.f.js +8 -0
  224. package/types/sorted_list/module.f.d.ts +16 -0
  225. package/types/sorted_list/module.f.js +56 -0
  226. package/types/sorted_list/test.f.d.ts +5 -0
  227. package/types/sorted_list/test.f.js +64 -0
  228. package/types/sorted_set/module.f.d.ts +7 -0
  229. package/types/sorted_set/module.f.js +14 -0
  230. package/types/sorted_set/test.f.d.ts +6 -0
  231. package/types/sorted_set/test.f.js +78 -0
  232. package/types/string/module.f.d.ts +6 -0
  233. package/types/string/module.f.js +11 -0
  234. package/types/string/test.f.d.ts +15 -0
  235. package/types/string/test.f.js +58 -0
  236. package/types/string_set/module.f.d.ts +9 -0
  237. package/types/string_set/module.f.js +22 -0
  238. package/types/string_set/test.f.d.ts +5 -0
  239. package/types/string_set/test.f.js +65 -0
  240. package/.github/FUNDING.yml +0 -12
  241. package/.github/dependabot.yml +0 -11
  242. package/.github/workflows/ci.yml +0 -88
  243. package/.github/workflows/npm-publish.yml +0 -53
  244. package/CHANGELOG.md +0 -29
  245. package/Cargo.lock +0 -18
  246. package/Cargo.toml +0 -7
  247. package/com/README.md +0 -3
  248. package/com/cpp/README.md +0 -80
  249. package/com/cpp/module.f.ts +0 -180
  250. package/com/cpp/nanocom.hpp +0 -195
  251. package/com/cpp/testlib.f.ts +0 -8
  252. package/com/cs/module.f.ts +0 -145
  253. package/com/cs/testlib.f.ts +0 -8
  254. package/com/proposals.md +0 -28
  255. package/com/rust/module.f.ts +0 -287
  256. package/com/rust/nanocom/Cargo.lock +0 -7
  257. package/com/rust/nanocom/Cargo.toml +0 -15
  258. package/com/rust/nanocom/README.md +0 -56
  259. package/com/rust/nanocom/src/class.rs +0 -6
  260. package/com/rust/nanocom/src/cobject.rs +0 -90
  261. package/com/rust/nanocom/src/guid.rs +0 -15
  262. package/com/rust/nanocom/src/hresult.rs +0 -7
  263. package/com/rust/nanocom/src/interface.rs +0 -9
  264. package/com/rust/nanocom/src/iunknown.rs +0 -13
  265. package/com/rust/nanocom/src/lib.rs +0 -20
  266. package/com/rust/nanocom/src/object.rs +0 -34
  267. package/com/rust/nanocom/src/ref.rs +0 -57
  268. package/com/rust/nanocom/src/vmt.rs +0 -7
  269. package/com/rust/nanocom/tests/it.rs +0 -186
  270. package/com/rust/nanocom/tests/itmod.rs +0 -195
  271. package/com/rust/testlib.f.ts +0 -8
  272. package/com/test/build.f.ts +0 -111
  273. package/com/test/build.ts +0 -45
  274. package/com/test/cpp/main.cpp +0 -74
  275. package/com/test/cs/Program.cs +0 -31
  276. package/com/test/cs/cs.csproj +0 -16
  277. package/com/test/rust/Cargo.toml +0 -12
  278. package/com/test/rust/src/lib.rs +0 -56
  279. package/com/types/module.f.ts +0 -62
  280. package/commonjs/README.md +0 -94
  281. package/commonjs/build/module.f.ts +0 -100
  282. package/commonjs/build/test.f.ts +0 -107
  283. package/commonjs/module/module.f.ts +0 -41
  284. package/commonjs/module.f.ts +0 -7
  285. package/commonjs/module.ts +0 -31
  286. package/commonjs/package/dependencies/module.f.ts +0 -22
  287. package/commonjs/package/dependencies/test.f.ts +0 -8
  288. package/commonjs/package/module.f.ts +0 -31
  289. package/commonjs/package/test.f.ts +0 -12
  290. package/commonjs/path/README.md +0 -17
  291. package/commonjs/path/module.f.ts +0 -171
  292. package/commonjs/test.ts +0 -64
  293. package/crypto/README.md +0 -3
  294. package/crypto/prime_field/module.f.ts +0 -114
  295. package/crypto/prime_field/test.f.ts +0 -95
  296. package/crypto/secp/module.f.ts +0 -182
  297. package/crypto/secp/test.f.ts +0 -68
  298. package/crypto/sha2/module.f.ts +0 -215
  299. package/crypto/sha2/test.f.ts +0 -83
  300. package/deno.json +0 -71
  301. package/dev/README.md +0 -8
  302. package/dev/index.ts +0 -3
  303. package/dev/module.f.ts +0 -1
  304. package/dev/module.ts +0 -196
  305. package/dev/test/module.f.ts +0 -135
  306. package/dev/test.ts +0 -53
  307. package/djs/README.md +0 -54
  308. package/djs/module.f.ts +0 -76
  309. package/djs/parser/module.f.ts +0 -509
  310. package/djs/parser/test.f.ts +0 -461
  311. package/djs/serializer/module.f.ts +0 -90
  312. package/djs/test.f.ts +0 -67
  313. package/djs/tokenizer/module.f.ts +0 -99
  314. package/djs/tokenizer/test.f.ts +0 -364
  315. package/doc/LANGUAGE.md +0 -255
  316. package/doc/README.md +0 -61
  317. package/doc/byte-code.md +0 -59
  318. package/doc/fa.md +0 -174
  319. package/doc/predefined.md +0 -143
  320. package/doc/proposals.md +0 -21
  321. package/doc/vm/README.md +0 -24
  322. package/doc/vm-rearchitecture.md +0 -129
  323. package/doc/vm.md +0 -150
  324. package/fsc/README.md +0 -111
  325. package/fsc/module.f.ts +0 -122
  326. package/fsc/test.f.ts +0 -21
  327. package/fsm/README.md +0 -113
  328. package/fsm/module.f.ts +0 -107
  329. package/fsm/test.f.ts +0 -139
  330. package/funding.json +0 -61
  331. package/html/README.md +0 -32
  332. package/html/module.f.ts +0 -109
  333. package/html/test.f.ts +0 -37
  334. package/issues/01-test-debug.md +0 -3
  335. package/issues/02-esm.md +0 -8
  336. package/issues/03-djs.md +0 -57
  337. package/issues/05-publish.md +0 -40
  338. package/issues/11-fs-load.md +0 -13
  339. package/issues/17-djs-extension.md +0 -6
  340. package/issues/README.md +0 -42
  341. package/issues/lang/1000-json.md +0 -50
  342. package/issues/lang/2110-default-export.md +0 -11
  343. package/issues/lang/2120-const.md +0 -14
  344. package/issues/lang/2130-default-import.md +0 -10
  345. package/issues/lang/2210-block-comment.md +0 -12
  346. package/issues/lang/2220-namespace-import.md +0 -25
  347. package/issues/lang/2310-undefined.md +0 -7
  348. package/issues/lang/2320-bigint.md +0 -7
  349. package/issues/lang/2330-property-accessor.md +0 -225
  350. package/issues/lang/2340-operators.md +0 -41
  351. package/issues/lang/2350-grouping.md +0 -11
  352. package/issues/lang/2360-built-in.md +0 -81
  353. package/issues/lang/2410-identifier-property.md +0 -9
  354. package/issues/lang/2420-line-comment.md +0 -10
  355. package/issues/lang/2430-trailing-comma.md +0 -13
  356. package/issues/lang/2440-shorthand.md +0 -8
  357. package/issues/lang/2450-destructuring.md +0 -12
  358. package/issues/lang/3110-function.md +0 -35
  359. package/issues/lang/3120-parameters.md +0 -9
  360. package/issues/lang/3130-body-const.md +0 -12
  361. package/issues/lang/3220-let.md +0 -11
  362. package/issues/lang/3240-export.md +0 -44
  363. package/issues/lang/3370-type-inference.md +0 -69
  364. package/issues/lang/3380-promise.md +0 -22
  365. package/issues/lang/3390-class.md +0 -3
  366. package/issues/lang/3410-expression.md +0 -12
  367. package/issues/lang/3420-one-parameter.md +0 -10
  368. package/issues/lang/3430-assignments.md +0 -23
  369. package/issues/lang/README.md +0 -193
  370. package/issues/test.f.ts +0 -58
  371. package/js/tokenizer/module.f.ts +0 -882
  372. package/js/tokenizer/test.f.ts +0 -617
  373. package/json/html/README.md +0 -49
  374. package/json/module.f.ts +0 -94
  375. package/json/parser/module.f.ts +0 -221
  376. package/json/parser/test.f.ts +0 -255
  377. package/json/serializer/module.f.ts +0 -74
  378. package/json/serializer/test.f.ts +0 -64
  379. package/json/test.f.ts +0 -48
  380. package/json/tokenizer/module.f.ts +0 -85
  381. package/json/tokenizer/test.f.ts +0 -290
  382. package/nanvm-lib/Cargo.toml +0 -6
  383. package/nanvm-lib/src/extension.rs +0 -130
  384. package/nanvm-lib/src/interface.rs +0 -133
  385. package/nanvm-lib/src/lib.rs +0 -7
  386. package/nanvm-lib/src/naive.rs +0 -236
  387. package/nanvm-lib/src/nanenum.rs +0 -236
  388. package/nanvm-lib/src/nullish.rs +0 -7
  389. package/nanvm-lib/src/sign.rs +0 -5
  390. package/nanvm-lib/src/simple.rs +0 -32
  391. package/nanvm-lib/tests/test.f.ts +0 -80
  392. package/nanvm-lib/tests/test.rs +0 -108
  393. package/nodejs/version/main.ts +0 -4
  394. package/nodejs/version/module.f.ts +0 -42
  395. package/text/README.md +0 -110
  396. package/text/ascii/module.f.ts +0 -222
  397. package/text/ascii/test.f.ts +0 -14
  398. package/text/module.f.ts +0 -30
  399. package/text/sgr/README.md +0 -3
  400. package/text/sgr/module.f.ts +0 -13
  401. package/text/test.f.ts +0 -19
  402. package/text/utf16/module.f.ts +0 -120
  403. package/text/utf16/test.f.ts +0 -107
  404. package/text/utf8/module.f.ts +0 -116
  405. package/text/utf8/test.f.ts +0 -125
  406. package/tsconfig.json +0 -104
  407. package/types/array/module.f.ts +0 -89
  408. package/types/array/test.f.ts +0 -88
  409. package/types/bigfloat/module.f.ts +0 -93
  410. package/types/bigfloat/test.f.ts +0 -218
  411. package/types/bigint/README.md +0 -35
  412. package/types/bigint/test.f.ts +0 -144
  413. package/types/bit_vec/README.md +0 -18
  414. package/types/bit_vec/test.f.ts +0 -129
  415. package/types/btree/README.md +0 -160
  416. package/types/btree/find/module.f.ts +0 -92
  417. package/types/btree/find/test.f.ts +0 -122
  418. package/types/btree/module.f.ts +0 -35
  419. package/types/btree/remove/module.f.ts +0 -151
  420. package/types/btree/remove/test.f.ts +0 -498
  421. package/types/btree/set/module.f.ts +0 -89
  422. package/types/btree/set/test.f.ts +0 -415
  423. package/types/btree/test.f.ts +0 -92
  424. package/types/btree/types/module.f.ts +0 -27
  425. package/types/byte_set/module.f.ts +0 -73
  426. package/types/byte_set/test.f.ts +0 -84
  427. package/types/function/compare/module.f.ts +0 -26
  428. package/types/function/compare/test.f.ts +0 -7
  429. package/types/function/module.f.ts +0 -43
  430. package/types/function/operator/module.f.ts +0 -65
  431. package/types/function/test.f.ts +0 -20
  432. package/types/list/module.f.ts +0 -350
  433. package/types/list/test.f.ts +0 -327
  434. package/types/map/module.f.ts +0 -65
  435. package/types/map/test.f.ts +0 -76
  436. package/types/nibble_set/module.f.ts +0 -34
  437. package/types/nibble_set/test.f.ts +0 -57
  438. package/types/nullable/module.f.ts +0 -9
  439. package/types/nullable/test.f.ts +0 -9
  440. package/types/number/module.f.ts +0 -20
  441. package/types/number/test.f.ts +0 -194
  442. package/types/object/module.f.ts +0 -30
  443. package/types/object/test.f.ts +0 -14
  444. package/types/range/module.f.ts +0 -10
  445. package/types/range/test.f.ts +0 -9
  446. package/types/range_map/module.f.ts +0 -70
  447. package/types/range_map/test.f.ts +0 -189
  448. package/types/result/module.f.ts +0 -20
  449. package/types/result/module.ts +0 -18
  450. package/types/sorted_list/module.f.ts +0 -83
  451. package/types/sorted_list/test.f.ts +0 -57
  452. package/types/sorted_set/module.f.ts +0 -36
  453. package/types/sorted_set/test.f.ts +0 -67
  454. package/types/string/module.f.ts +0 -26
  455. package/types/string/test.f.ts +0 -43
  456. package/types/string_set/module.f.ts +0 -37
  457. package/types/string_set/test.f.ts +0 -34
@@ -0,0 +1,127 @@
1
+ import * as Operator from "../../types/function/operator/module.f.js";
2
+ import { prime_field, sqrt } from "../prime_field/module.f.js";
3
+ import { scalar_mul } from "../../types/bigint/module.f.js";
4
+ /**
5
+ * Constructs an elliptic curve with the given initialization parameters.
6
+ *
7
+ * @example
8
+ *
9
+ * ```js
10
+ * const curveParams = {
11
+ * p: 23n,
12
+ * a: [0n, 1n],
13
+ * g: [1n, 1n],
14
+ * n: 19n
15
+ * };
16
+ * const curveInstance = curve(curveParams);
17
+ *
18
+ * // Access curve operations
19
+ * const point = curveInstance.add([1n, 1n])([2n, 5n]); // Add two points
20
+ * const negPoint = curveInstance.neg([1n, 1n]); // Negate a point
21
+ * const mulPoint = curveInstance.mul([1n, 1n])(3n); // Multiply a point by 3
22
+ * ```
23
+ */
24
+ export const curve = ({ p, a: [a0, a1], n }) => {
25
+ const pf = prime_field(p);
26
+ const { pow2, pow3, sub, add, mul, neg, div } = pf;
27
+ const mul3 = mul(3n);
28
+ const mul2 = mul(2n);
29
+ const addA1 = add(a1);
30
+ const mulA1 = mul(a1);
31
+ const addA0 = add(a0);
32
+ /**
33
+ * y**2 = a1*x**3 + a0
34
+ */
35
+ const y2 = x => addA0(add(pow3(x))(mulA1(x)));
36
+ const addPoint = p => q => {
37
+ if (p === null) {
38
+ return q;
39
+ }
40
+ if (q === null) {
41
+ return p;
42
+ }
43
+ const [px, py] = p;
44
+ const [qx, qy] = q;
45
+ const md = px === qx
46
+ // (3 * px ** 2 + a1) / (2 * py)
47
+ ? py !== qy || py === 0n ? null : [addA1(mul3(pow2(px))), mul2(py)]
48
+ // (py - qy) / (px - qx)
49
+ : [sub(py)(qy), sub(px)(qx)];
50
+ if (md === null) {
51
+ return null;
52
+ }
53
+ const [ma, mb] = md;
54
+ const m = div(ma)(mb);
55
+ // m ** 2 - px - qx
56
+ const rx = sub(pow2(m))(add(px)(qx));
57
+ // [rx, m * (px - rx) - py]
58
+ return [rx, sub(mul(m)(sub(px)(rx)))(py)];
59
+ };
60
+ const sqrt_p = sqrt(pf);
61
+ return {
62
+ pf,
63
+ nf: prime_field(n),
64
+ y2,
65
+ y: x => sqrt_p(y2(x)),
66
+ neg: p => {
67
+ if (p === null) {
68
+ return null;
69
+ }
70
+ const [x, y] = p;
71
+ return [x, neg(y)];
72
+ },
73
+ add: addPoint,
74
+ mul: scalar_mul({ 0: null, add: addPoint })
75
+ };
76
+ };
77
+ export const eq = a => b => {
78
+ if (a === null || b === null) {
79
+ return a === b;
80
+ }
81
+ const [ax, ay] = a;
82
+ const [bx, by] = b;
83
+ return ax === bx && ay === by;
84
+ };
85
+ /**
86
+ * https://neuromancer.sk/std/secg/secp192r1
87
+ */
88
+ export const secp192r1 = {
89
+ p: 0xfffffffffffffffffffffffffffffffeffffffffffffffffn,
90
+ a: [
91
+ 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1n,
92
+ 0xfffffffffffffffffffffffffffffffefffffffffffffffcn
93
+ ],
94
+ g: [
95
+ 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012n,
96
+ 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811n
97
+ ],
98
+ n: 0xffffffffffffffffffffffff99def836146bc9b1b4d22831n,
99
+ };
100
+ /**
101
+ * https://en.bitcoin.it/wiki/Secp256k1
102
+ * https://neuromancer.sk/std/secg/secp256k1
103
+ */
104
+ export const secp256k1 = {
105
+ p: 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,
106
+ a: [7n, 0n],
107
+ g: [
108
+ 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,
109
+ 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n
110
+ ],
111
+ n: 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,
112
+ };
113
+ /**
114
+ * https://neuromancer.sk/std/secg/secp256r1
115
+ */
116
+ export const secp256r1 = {
117
+ p: 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffffn,
118
+ a: [
119
+ 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn, //< b
120
+ 0xffffffff00000001000000000000000000000000fffffffffffffffffffffffcn, //< a
121
+ ],
122
+ g: [
123
+ 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296n, //< x
124
+ 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5n, //< y
125
+ ],
126
+ n: 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n,
127
+ };
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ example: () => void;
3
+ test: () => void;
4
+ };
5
+ export default _default;
@@ -0,0 +1,72 @@
1
+ import { curve, secp256k1, secp192r1, secp256r1, eq } from "./module.f.js";
2
+ export default {
3
+ example: () => {
4
+ const curveParams = {
5
+ p: 23n,
6
+ a: [0n, 1n],
7
+ g: [1n, 1n],
8
+ n: 19n
9
+ };
10
+ const c = curve(curveParams);
11
+ // Access curve operations
12
+ const point = c.add([1n, 1n])([2n, 5n]); // Add two points
13
+ const negPoint = c.neg([1n, 1n]); // Negate a point
14
+ const mulPoint = c.mul([1n, 1n])(3n); // Multiply a point by 3
15
+ },
16
+ test: () => {
17
+ const test_curve = c => {
18
+ const { g } = c;
19
+ const { mul, neg, pf: { abs }, y: yf, nf: { p: n } } = curve(c);
20
+ const point_check = p => {
21
+ if (p === null) {
22
+ throw 'p === null';
23
+ }
24
+ const [x, y] = p;
25
+ const ye = yf(x);
26
+ if (ye === null) {
27
+ throw 'ye === null';
28
+ }
29
+ if (abs(ye) !== abs(y)) {
30
+ throw 'ye';
31
+ }
32
+ };
33
+ point_check(g);
34
+ point_check(neg(g));
35
+ const test_mul = p => {
36
+ if (mul(p)(0n) !== null) {
37
+ throw 'O';
38
+ }
39
+ if (mul(p)(1n) !== p) {
40
+ throw 'p';
41
+ }
42
+ if (mul(p)(n) !== null) {
43
+ throw 'n';
44
+ }
45
+ const pn = neg(p);
46
+ if (!eq(mul(p)(n - 1n))(pn)) {
47
+ throw 'n - 1';
48
+ }
49
+ const f = s => {
50
+ const r = mul(p)(s);
51
+ point_check(r);
52
+ const rn = mul(pn)(s);
53
+ point_check(rn);
54
+ if (!eq(r)(neg(rn))) {
55
+ throw 'r != -rn';
56
+ }
57
+ };
58
+ f(2n);
59
+ f(3n);
60
+ f(4n << 128n);
61
+ f((5n << 128n) + 6n);
62
+ f(7n << 128n);
63
+ f((8n << 128n) + 9n);
64
+ };
65
+ test_mul(g);
66
+ test_mul(neg(g));
67
+ };
68
+ test_curve(secp256k1);
69
+ test_curve(secp192r1);
70
+ test_curve(secp256r1);
71
+ }
72
+ };
@@ -0,0 +1,13 @@
1
+ import * as array from '../../types/array/module.f.ts';
2
+ type HashInput = {
3
+ readonly f: (i: number) => number;
4
+ readonly length: number;
5
+ };
6
+ type Hash8 = array.Array8<number>;
7
+ type Array16 = array.Array16<number>;
8
+ export declare const padding: (input: readonly number[]) => (bits: number) => HashInput;
9
+ export declare const computeSha256: (input: readonly number[]) => (bitsCount: number) => Hash8;
10
+ export declare const computeSha224: (input: readonly number[]) => (bitsCount: number) => Hash8;
11
+ export declare const compress256: (data: Array16) => Hash8;
12
+ export declare const compress224: (data: Array16) => Hash8;
13
+ export {};
@@ -0,0 +1,145 @@
1
+ import * as array from "../../types/array/module.f.js";
2
+ const appendOneWithZeros = input => pos => (input >> pos << pos) | (1 << pos);
3
+ const mod = a => b => (a % b + b) % b;
4
+ export const padding = input => bitsCount => {
5
+ const appendBlockIndex = (bitsCount / 32) | 0;
6
+ const length = (bitsCount + mod(447 - bitsCount)(512) + 65) / 32;
7
+ const f = i => {
8
+ if (i < appendBlockIndex) {
9
+ return input[i];
10
+ }
11
+ if (i === appendBlockIndex) {
12
+ return appendBlockIndex >= input.length ? 0x8000_0000 : appendOneWithZeros(input[appendBlockIndex])(31 - bitsCount % 32);
13
+ }
14
+ if (i === length - 2) {
15
+ return (bitsCount / 0x1_0000_0000) | 0;
16
+ }
17
+ if (i === length - 1) {
18
+ return bitsCount % 0x1_0000_0000;
19
+ }
20
+ return 0;
21
+ };
22
+ return ({ f, length });
23
+ };
24
+ const rotr = d => {
25
+ const r = 32 - d;
26
+ return n => n >>> d | n << r;
27
+ };
28
+ const ch = x => y => z => x & y ^ ~x & z;
29
+ const maj = x => y => z => x & y ^ x & z ^ y & z;
30
+ const shr = d => n => n >>> d;
31
+ const bigSigma = a => b => c => {
32
+ const ra = rotr(a);
33
+ const rb = rotr(b);
34
+ const rc = rotr(c);
35
+ return x => ra(x) ^ rb(x) ^ rc(x);
36
+ };
37
+ const bigSigma0 = bigSigma(2)(13)(22);
38
+ const bigSigma1 = bigSigma(6)(11)(25);
39
+ const smallSigma = a => b => c => {
40
+ const ra = rotr(a);
41
+ const rb = rotr(b);
42
+ const sc = shr(c);
43
+ return x => ra(x) ^ rb(x) ^ sc(x);
44
+ };
45
+ const smallSigma0 = smallSigma(7)(18)(3);
46
+ const smallSigma1 = smallSigma(17)(19)(10);
47
+ const wi = ([a0, a1, a2, a3]) => (smallSigma1(a0) + a1 + smallSigma0(a2) + a3) | 0;
48
+ const nextW = ([w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, wA, wB, wC, wD, wE, wF]) => {
49
+ w0 = wi([wE, w9, w1, w0]);
50
+ w1 = wi([wF, wA, w2, w1]);
51
+ w2 = wi([w0, wB, w3, w2]);
52
+ w3 = wi([w1, wC, w4, w3]);
53
+ w4 = wi([w2, wD, w5, w4]);
54
+ w5 = wi([w3, wE, w6, w5]);
55
+ w6 = wi([w4, wF, w7, w6]);
56
+ w7 = wi([w5, w0, w8, w7]);
57
+ w8 = wi([w6, w1, w9, w8]);
58
+ w9 = wi([w7, w2, wA, w9]);
59
+ wA = wi([w8, w3, wB, wA]);
60
+ wB = wi([w9, w4, wC, wB]);
61
+ wC = wi([wA, w5, wD, wC]);
62
+ wD = wi([wB, w6, wE, wD]);
63
+ wE = wi([wC, w7, wF, wE]);
64
+ wF = wi([wD, w8, w0, wF]);
65
+ return [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, wA, wB, wC, wD, wE, wF];
66
+ };
67
+ const k = [
68
+ [
69
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
70
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
71
+ ],
72
+ [
73
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
74
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
75
+ ],
76
+ [
77
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
78
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
79
+ ],
80
+ [
81
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
82
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
83
+ ],
84
+ ];
85
+ const compress = ([a0, b0, c0, d0, e0, f0, g0, h0]) => data => {
86
+ let w = data;
87
+ let a = a0;
88
+ let b = b0;
89
+ let c = c0;
90
+ let d = d0;
91
+ let e = e0;
92
+ let f = f0;
93
+ let g = g0;
94
+ let h = h0;
95
+ let i = 0;
96
+ while (true) {
97
+ const ki = k[i];
98
+ for (let j = 0; j < 16; ++j) {
99
+ const t1 = h + bigSigma1(e) + ch(e)(f)(g) + ki[j] + w[j];
100
+ const t2 = bigSigma0(a) + maj(a)(b)(c);
101
+ h = g;
102
+ g = f;
103
+ f = e;
104
+ e = (d + t1) | 0;
105
+ d = c;
106
+ c = b;
107
+ b = a;
108
+ a = (t1 + t2) | 0;
109
+ }
110
+ if (i === 3) {
111
+ break;
112
+ }
113
+ ++i;
114
+ w = nextW(w);
115
+ }
116
+ return [
117
+ (a0 + a) | 0,
118
+ (b0 + b) | 0,
119
+ (c0 + c) | 0,
120
+ (d0 + d) | 0,
121
+ (e0 + e) | 0,
122
+ (f0 + f) | 0,
123
+ (g0 + g) | 0,
124
+ (h0 + h) | 0,
125
+ ];
126
+ };
127
+ const compute = init => input => bitsCount => {
128
+ const { f, length } = padding(input)(bitsCount);
129
+ let result = init;
130
+ const chunkCount = length / 16;
131
+ for (let i = 0; i < chunkCount; i++) {
132
+ const s = i * 16;
133
+ result = compress(result)([
134
+ f(s + 0), f(s + 1), f(s + 2), f(s + 3), f(s + 4), f(s + 5), f(s + 6), f(s + 7),
135
+ f(s + 8), f(s + 9), f(s + 10), f(s + 11), f(s + 12), f(s + 13), f(s + 14), f(s + 15)
136
+ ]);
137
+ }
138
+ return result;
139
+ };
140
+ const init256 = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
141
+ export const computeSha256 = compute(init256);
142
+ const init224 = [0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4];
143
+ export const computeSha224 = compute(init224);
144
+ export const compress256 = compress(init256);
145
+ export const compress224 = compress(init224);
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ empty: {
3
+ sha256: () => void;
4
+ sha224: () => void;
5
+ };
6
+ sha224compress: (() => void)[];
7
+ sha256: (() => void)[];
8
+ };
9
+ export default _default;
@@ -0,0 +1,82 @@
1
+ import * as _ from "./module.f.js";
2
+ import * as json from "../../json/module.f.js";
3
+ import { sort } from "../../types/object/module.f.js";
4
+ const toU32 = x => (x + 0x1_0000_0000) % 0x1_0000_0000;
5
+ const toHexString = x => toU32(x).toString(16).padStart(8, '0');
6
+ const stringify = a => json.stringify(sort)(a);
7
+ // {
8
+ // const result = _.padding([])(0)
9
+ // console.log(result.map(toHexString))
10
+ // }
11
+ // {
12
+ // const result = _.padding([0x61626364, 0x65000000])(40)
13
+ // console.log(result.map(toHexString))
14
+ // }
15
+ // {
16
+ // const result = _.padding([0x11111110])(31)
17
+ // console.log(result.map(toHexString))
18
+ // }
19
+ // {
20
+ // const result = _.padding([0x11111110])(32)
21
+ // console.log(result.map(toHexString))
22
+ // }
23
+ export default {
24
+ empty: {
25
+ sha256: () => {
26
+ const hash = _.computeSha256([])(0);
27
+ const result = stringify(hash.map(toHexString));
28
+ if (result !== '["e3b0c442","98fc1c14","9afbf4c8","996fb924","27ae41e4","649b934c","a495991b","7852b855"]') {
29
+ throw result;
30
+ }
31
+ },
32
+ sha224: () => {
33
+ const hash = _.computeSha224([])(0);
34
+ const result = stringify(hash.map(toHexString));
35
+ if (result !== '["d14a028c","2a3a2bc9","476102bb","288234c4","15a2b01f","828ea62a","c5b3e42f","bdd387cb"]') {
36
+ throw result;
37
+ }
38
+ }
39
+ },
40
+ sha224compress: [
41
+ () => {
42
+ const hash = _.compress224([0x8000_0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
43
+ const result = stringify(hash.map(toHexString));
44
+ if (result !== '["d14a028c","2a3a2bc9","476102bb","288234c4","15a2b01f","828ea62a","c5b3e42f","bdd387cb"]') {
45
+ throw result;
46
+ }
47
+ }
48
+ ],
49
+ sha256: [
50
+ () => {
51
+ //[0x68656C6C, 0x6F20776F, 0x726C6400] represents phrase 'hello world'
52
+ const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C6400])(88);
53
+ const result = stringify(hash.map(toHexString));
54
+ if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') {
55
+ throw result;
56
+ }
57
+ },
58
+ () => {
59
+ //[0x68656C6C, 0x6F20776F, 0x726C6488] represents phrase 'hello world' with 1's at the end
60
+ const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C64FF])(88);
61
+ const result = stringify(hash.map(toHexString));
62
+ if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') {
63
+ throw result;
64
+ }
65
+ },
66
+ () => {
67
+ const input = Array(8).fill(0x31313131);
68
+ const result = _.computeSha256(input)(256);
69
+ if (toU32(result[0]) !== 0x8a83665f) {
70
+ throw result[0];
71
+ }
72
+ },
73
+ () => {
74
+ const input = Array(16).fill(0x31313131);
75
+ const hash = _.computeSha256(input)(512);
76
+ const result = stringify(hash.map(toHexString));
77
+ if (result !== '["3138bb9b","c78df27c","473ecfd1","410f7bd4","5ebac1f5","9cf3ff9c","fe4db77a","ab7aedd3"]') {
78
+ throw result;
79
+ }
80
+ }
81
+ ]
82
+ };
@@ -0,0 +1 @@
1
+ export declare const todo: () => never;
@@ -0,0 +1 @@
1
+ export const todo = () => { throw 'not implemented'; };
@@ -0,0 +1,20 @@
1
+ import * as Result from '../../types/result/module.f.ts';
2
+ type Module = {
3
+ readonly default?: unknown;
4
+ };
5
+ type ModuleMap = {
6
+ readonly [k in string]: Module;
7
+ };
8
+ type Log<T> = (v: string) => (state: T) => T;
9
+ type Measure<T> = <R>(f: () => R) => (state: T) => readonly [R, number, T];
10
+ type Input<T> = {
11
+ readonly moduleMap: ModuleMap;
12
+ readonly log: Log<T>;
13
+ readonly error: Log<T>;
14
+ readonly measure: Measure<T>;
15
+ readonly state: T;
16
+ readonly tryCatch: <R>(f: () => R) => Result.Result<R, unknown>;
17
+ readonly env: (n: string) => string | undefined;
18
+ };
19
+ declare const _default: <T>(input: Input<T>) => readonly [number, T];
20
+ export default _default;
@@ -0,0 +1,75 @@
1
+ import { entries, fold } from "../../types/list/module.f.js";
2
+ import { reset, fgGreen, fgRed, bold } from "../../text/sgr/module.f.js";
3
+ import * as Result from "../../types/result/module.f.js";
4
+ const isTest = s => s.endsWith('test.f.mjs') || s.endsWith('test.f.js') || s.endsWith('test.f.ts');
5
+ const addPass = delta => ts => ({ ...ts, time: ts.time + delta, pass: ts.pass + 1 });
6
+ const addFail = delta => ts => ({ ...ts, time: ts.time + delta, fail: ts.fail + 1 });
7
+ const timeFormat = a => {
8
+ const y = Math.round(a * 10_000).toString();
9
+ const yl = 5 - y.length;
10
+ const x = '0'.repeat(yl > 0 ? yl : 0) + y;
11
+ const s = x.length - 4;
12
+ const b = x.substring(0, s);
13
+ const e = x.substring(s);
14
+ return `${b}.${e} ms`;
15
+ };
16
+ export default (input) => {
17
+ let { moduleMap, log, error, measure, tryCatch, env, state } = input;
18
+ const isGitHub = env('GITHUB_ACTION') !== void 0;
19
+ const f = ([k, v]) => {
20
+ const test = i => v => ([ts, state]) => {
21
+ const next = test(`${i}| `);
22
+ switch (typeof v) {
23
+ case 'function': {
24
+ if (v.length === 0) {
25
+ const [[s, r], delta, state0] = measure(() => tryCatch(v))(state);
26
+ state = state0;
27
+ if (s === 'error') {
28
+ ts = addFail(delta)(ts);
29
+ if (isGitHub) {
30
+ // https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions
31
+ // https://github.com/OndraM/ci-detector/blob/main/src/Ci/GitHubActions.php
32
+ state = error(`::error file=${k},line=1,title=[3]['a']()::${r}`)(state);
33
+ }
34
+ else {
35
+ state = error(`${i}() ${fgRed}error${reset}, ${timeFormat(delta)}`)(state);
36
+ state = error(`${fgRed}${r}${reset}`)(state);
37
+ }
38
+ }
39
+ else {
40
+ ts = addPass(delta)(ts);
41
+ state = log(`${i}() ${fgGreen}ok${reset}, ${timeFormat(delta)}`)(state);
42
+ }
43
+ [ts, state] = next(r)([ts, state]);
44
+ }
45
+ break;
46
+ }
47
+ case 'object': {
48
+ if (v !== null) {
49
+ const f = ([k, v]) => ([time, state]) => {
50
+ state = log(`${i}${k}:`)(state);
51
+ [time, state] = next(v)([time, state]);
52
+ return [time, state];
53
+ };
54
+ [ts, state] = fold(f)([ts, state])(v instanceof Array ? entries(v) : Object.entries(v));
55
+ }
56
+ break;
57
+ }
58
+ }
59
+ return [ts, state];
60
+ };
61
+ return ([ts, state]) => {
62
+ if (isTest(k)) {
63
+ state = log(`testing ${k}`)(state);
64
+ [ts, state] = test('| ')(v.default)([ts, state]);
65
+ }
66
+ return [ts, state];
67
+ };
68
+ };
69
+ let ts = { time: 0, pass: 0, fail: 0 };
70
+ [ts, state] = fold(f)([ts, state])(Object.entries(moduleMap));
71
+ const fgFail = ts.fail === 0 ? fgGreen : fgRed;
72
+ state = log(`${bold}Number of tests: pass: ${fgGreen}${ts.pass}${reset}${bold}, fail: ${fgFail}${ts.fail}${reset}${bold}, total: ${ts.pass + ts.fail}${reset}`)(state);
73
+ state = log(`${bold}Time: ${timeFormat(ts.time)}${reset}`)(state);
74
+ return [ts.fail !== 0 ? 1 : 0, state];
75
+ };
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ ctor: () => void;
3
+ ctorEmpty: () => void;
4
+ ctorUndefined: () => void;
5
+ number: () => void;
6
+ properties: () => void;
7
+ getOwnPropertyDescriptor: () => void;
8
+ };
9
+ export default _default;
@@ -1,22 +1,20 @@
1
- const assert
2
- : () => never
3
- = () => { throw 'assert' }
4
-
5
- const assert_if
6
- : (_: boolean) => void
7
- = c => { if (c) { throw 'assert_if' } }
8
-
1
+ const assert = () => { throw 'assert'; };
2
+ const assert_if = c => { if (c) {
3
+ throw 'assert_if';
4
+ } };
9
5
  export default {
10
6
  ctor: () => {
11
- const c = (() => { })['constructor']
12
- const f = c('return 5')
13
- const result = f()
14
- if (result !== 5) { throw 'function' }
7
+ const c = (() => { })['constructor'];
8
+ const f = c('return 5');
9
+ const result = f();
10
+ if (result !== 5) {
11
+ throw 'function';
12
+ }
15
13
  },
16
14
  ctorEmpty: () => {
17
15
  /** @type {any} */
18
- const o = {}
19
- const c = o['constructor']
16
+ const o = {};
17
+ const c = o['constructor'];
20
18
  // console.log(c)
21
19
  // console.log(c(()=>{}))
22
20
  },
@@ -24,19 +22,19 @@ export default {
24
22
  /** @type {any} */
25
23
  const o = {
26
24
  constructor: void 0
27
- }
28
- const c = o['constructor']
25
+ };
26
+ const c = o['constructor'];
29
27
  //console.log(c)
30
28
  },
31
29
  number: () => {
32
30
  /** @type {any} */
33
- const b = '42'
34
- const r = Number(b)
31
+ const b = '42';
32
+ const r = Number(b);
35
33
  //console.log(r)
36
34
  },
37
35
  properties: () => {
38
36
  /** @type {any} */
39
- const o = {}
37
+ const o = {};
40
38
  //const c = o['constructor']
41
39
  //const c = o['__proto__']
42
40
  //const c = o['__defineGetter__']
@@ -47,12 +45,12 @@ export default {
47
45
  //const c = o['isPrototypeOf']
48
46
  //const c = o['propertyIsEnumerable']
49
47
  //const c = o['toString']
50
- const c = o['valueOf']
48
+ const c = o['valueOf'];
51
49
  //console.log(c)
52
50
  },
53
51
  getOwnPropertyDescriptor: () => {
54
- const x = { 'a': 12 }
55
- const c = Object.getOwnPropertyDescriptor(x, 'constructor')
56
- const a = Object.getOwnPropertyDescriptor(x, 'a')
52
+ const x = { 'a': 12 };
53
+ const c = Object.getOwnPropertyDescriptor(x, 'constructor');
54
+ const a = Object.getOwnPropertyDescriptor(x, 'a');
57
55
  }
58
- }
56
+ };
@@ -0,0 +1,17 @@
1
+ import * as list from '../types/list/module.f.ts';
2
+ import * as O from '../types/object/module.f.ts';
3
+ type Object = {
4
+ readonly [k in string]: Unknown;
5
+ };
6
+ type Array = readonly Unknown[];
7
+ type Unknown = Object | boolean | string | number | null | Array | bigint | undefined;
8
+ type Entry = O.Entry<Unknown>;
9
+ type Entries = list.List<Entry>;
10
+ type MapEntries = (entries: Entries) => Entries;
11
+ export declare const serialize: (mapEntries: MapEntries) => (value: Unknown) => list.List<string>;
12
+ /**
13
+ * The standard `JSON.stringify` rules determined by
14
+ * https://262.ecma-international.org/6.0/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys
15
+ */
16
+ export declare const stringify: (mapEntries: MapEntries) => (value: Unknown) => string;
17
+ export {};