functionalscript 0.0.422 → 0.0.425

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 (46) hide show
  1. package/.github/workflows/bun.yml +1 -1
  2. package/.github/workflows/deno.yml +1 -1
  3. package/com/cpp/test/build.cjs +1 -1
  4. package/com/cpp/{test.f.cjs → testlib.f.cjs} +1 -1
  5. package/com/cs/test/build.cjs +1 -1
  6. package/com/cs/{test.f.cjs → testlib.f.cjs} +1 -1
  7. package/com/rust/test.f.cjs +2 -4
  8. package/com/types/{test.f.cjs → testlib.f.cjs} +0 -0
  9. package/commonjs/build/test.f.cjs +2 -4
  10. package/commonjs/package/dependencies/test.f.cjs +1 -3
  11. package/commonjs/package/test.f.cjs +1 -5
  12. package/commonjs/path/test.f.cjs +158 -170
  13. package/commonjs/test.cjs +52 -61
  14. package/html/test.f.cjs +12 -13
  15. package/json/test.f.cjs +41 -37
  16. package/json/tokenizer/test.f.cjs +238 -296
  17. package/nodejs/version/test.f.cjs +1 -3
  18. package/package.json +2 -2
  19. package/sha2/test.f.cjs +37 -40
  20. package/test.f.cjs +49 -86
  21. package/test.mjs +142 -0
  22. package/text/test.f.cjs +1 -3
  23. package/text/utf16/test.f.cjs +96 -109
  24. package/text/utf8/test.f.cjs +116 -135
  25. package/tsconfig.json +1 -1
  26. package/types/array/test.f.cjs +83 -85
  27. package/types/bigint/test.f.cjs +6 -6
  28. package/types/btree/find/test.f.cjs +2 -2
  29. package/types/btree/remove/test.f.cjs +6 -3
  30. package/types/btree/set/test.f.cjs +372 -370
  31. package/types/btree/test.f.cjs +11 -7
  32. package/types/byteSet/module.f.cjs +2 -4
  33. package/types/byteSet/test.f.cjs +37 -40
  34. package/types/function/compare/module.f.cjs +1 -1
  35. package/types/function/compare/test.f.cjs +1 -3
  36. package/types/function/test.f.cjs +1 -3
  37. package/types/list/test.f.cjs +208 -219
  38. package/types/map/test.f.cjs +57 -57
  39. package/types/nibbleSet/test.f.cjs +37 -40
  40. package/types/number/test.f.cjs +24 -26
  41. package/types/object/test.f.cjs +12 -13
  42. package/types/option/test.f.cjs +1 -3
  43. package/types/range/test.f.cjs +1 -3
  44. package/types/string/test.f.cjs +37 -40
  45. package/types/stringset/test.f.cjs +32 -33
  46. package/denotest.mjs +0 -96
@@ -6,139 +6,120 @@ const { list } = require('../../types/module.f.cjs')
6
6
  /** @type {(a: readonly json.Unknown[]) => string} */
7
7
  const stringify = a => json.stringify(sort)(a)
8
8
 
9
- {
10
- const result = stringify(list.toArray(encoding.toCodePointList([-1, 256])))
11
- if (result !== '[2147483648,2147483648]') { throw result }
9
+ module.exports = {
10
+ toCodePoint: [
11
+ () => {
12
+ const result = stringify(list.toArray(encoding.toCodePointList([-1, 256])))
13
+ if (result !== '[2147483648,2147483648]') { throw result }
14
+ },
15
+ () => {
16
+ const result = stringify(list.toArray(encoding.toCodePointList([128, 193, 245, 255])))
17
+ if (result !== '[-2147483520,-2147483455,-2147483403,-2147483393]') { throw result }
18
+ },
19
+ () => {
20
+ const result = stringify(list.toArray(encoding.toCodePointList([0, 1, 127])))
21
+ if (result !== '[0,1,127]') { throw result }
22
+ },
23
+ () => {
24
+ const result = stringify(list.toArray(encoding.toCodePointList([194, 128, 194, 169, 223, 191])))
25
+ if (result !== '[128,169,2047]') { throw result }
26
+ },
27
+ () => {
28
+ const result = stringify(list.toArray(encoding.toCodePointList([194, 194, 127, 194, 192, 194])))
29
+ if (result !== '[-2147483454,-2147483454,127,-2147483454,-2147483456,-2147483454]') { throw result }
30
+ },
31
+ () => {
32
+ const result = stringify(list.toArray(encoding.toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])))
33
+ if (result !== '[2048,2049,65535]') { throw result }
34
+ },
35
+ () => {
36
+ const result = stringify(list.toArray(encoding.toCodePointList([224, 224, 160, 127, 239, 191])))
37
+ if (result !== '[-2147483424,-2147482592,127,-2147481601]') { throw result }
38
+ },
39
+ () => {
40
+ const result = stringify(list.toArray(encoding.toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])))
41
+ if (result !== '[65536,65537,1114111]') { throw result }
42
+ },
43
+ () => {
44
+ const result = stringify(list.toArray(encoding.toCodePointList([240, 240, 160, 127, 244, 191])))
45
+ if (result !== '[-2147483408,-2147483104,127,-2147482817]') { throw result }
46
+ },
47
+ () => {
48
+ const result = stringify(list.toArray(encoding.toCodePointList([240, 160, 160, 244, 160, 160])))
49
+ if (result !== '[-2147448800,-2147432416]') { throw result }
50
+ }
51
+ ],
52
+ fromCodePointList: [
53
+ () => {
54
+ const result = stringify(list.toArray(encoding.fromCodePointList([0, 1, 0x7F])))
55
+ if (result !== '[0,1,127]') { throw result }
56
+ },
57
+ () => {
58
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x80])))
59
+ if (result !== '[194,128]') { throw result }
60
+ },
61
+ () => {
62
+ const result = stringify(list.toArray(encoding.fromCodePointList([0xa9])))
63
+ if (result !== '[194,169]') { throw result }
64
+ },
65
+ () => {
66
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x7ff])))
67
+ if (result !== '[223,191]') { throw result }
68
+ },
69
+ () => {
70
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x800])))
71
+ if (result !== '[224,160,128]') { throw result }
72
+ },
73
+ () => {
74
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x801])))
75
+ if (result !== '[224,160,129]') { throw result }
76
+ },
77
+ () => {
78
+ const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])))
79
+ if (result !== '[239,191,191]') { throw result }
80
+ },
81
+ () => {
82
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])))
83
+ if (result !== '[240,144,128,128]') { throw result }
84
+ },
85
+ () => {
86
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10001])))
87
+ if (result !== '[240,144,128,129]') { throw result }
88
+ },
89
+ () => {
90
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10FFFF])))
91
+ if (result !== '[244,143,191,191]') { throw result }
92
+ },
93
+ () => {
94
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x110000, 2147483648])))
95
+ if (result !== '[2147483648,2147483648]') { throw result }
96
+ }
97
+ ],
98
+ toFrom: [
99
+ () => {
100
+ const codePointList = encoding.toCodePointList([128, 193, 245, 255])
101
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
102
+ if (result !== '[128,193,245,255]') { throw result }
103
+ },
104
+ () => {
105
+ const codePointList = encoding.toCodePointList([194, 194, 127, 194, 192, 194])
106
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
107
+ if (result !== '[194,194,127,194,192,194]') { throw result }
108
+ },
109
+ () => {
110
+ const codePointList = encoding.toCodePointList([224, 224, 160, 127, 239, 191])
111
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
112
+ if (result !== '[224,224,160,127,239,191]') { throw result }
113
+ },
114
+ () => {
115
+ const codePointList = encoding.toCodePointList([240, 240, 160, 127, 244, 191])
116
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
117
+ if (result !== '[240,240,160,127,244,191]') { throw result }
118
+ },
119
+ () => {
120
+ const codePointList = encoding.toCodePointList([240, 160, 160, 244, 160, 160])
121
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
122
+ if (result !== '[240,160,160,244,160,160]') { throw result }
123
+ }
124
+ ]
12
125
  }
13
-
14
- {
15
- const result = stringify(list.toArray(encoding.toCodePointList([128, 193, 245, 255])))
16
- if (result !== '[-2147483520,-2147483455,-2147483403,-2147483393]') { throw result }
17
- }
18
-
19
- {
20
- const result = stringify(list.toArray(encoding.toCodePointList([0, 1, 127])))
21
- if (result !== '[0,1,127]') { throw result }
22
- }
23
-
24
- {
25
- const result = stringify(list.toArray(encoding.toCodePointList([194, 128, 194, 169, 223, 191])))
26
- if (result !== '[128,169,2047]') { throw result }
27
- }
28
-
29
- {
30
- const result = stringify(list.toArray(encoding.toCodePointList([194, 194, 127, 194, 192, 194])))
31
- if (result !== '[-2147483454,-2147483454,127,-2147483454,-2147483456,-2147483454]') { throw result }
32
- }
33
-
34
- {
35
- const result = stringify(list.toArray(encoding.toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])))
36
- if (result !== '[2048,2049,65535]') { throw result }
37
- }
38
-
39
- {
40
- const result = stringify(list.toArray(encoding.toCodePointList([224, 224, 160, 127, 239, 191])))
41
- if (result !== '[-2147483424,-2147482592,127,-2147481601]') { throw result }
42
- }
43
-
44
- {
45
- const result = stringify(list.toArray(encoding.toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])))
46
- if (result !== '[65536,65537,1114111]') { throw result }
47
- }
48
-
49
- {
50
- const result = stringify(list.toArray(encoding.toCodePointList([240, 240, 160, 127, 244, 191])))
51
- if (result !== '[-2147483408,-2147483104,127,-2147482817]') { throw result }
52
- }
53
-
54
- {
55
- const result = stringify(list.toArray(encoding.toCodePointList([240, 160, 160, 244, 160, 160])))
56
- if (result !== '[-2147448800,-2147432416]') { throw result }
57
- }
58
-
59
- {
60
- const result = stringify(list.toArray(encoding.fromCodePointList([0,1,0x7F])))
61
- if (result !== '[0,1,127]') { throw result }
62
- }
63
-
64
- {
65
- const result = stringify(list.toArray(encoding.fromCodePointList([0x80])))
66
- if (result !== '[194,128]') { throw result }
67
- }
68
-
69
- {
70
- const result = stringify(list.toArray(encoding.fromCodePointList([0xa9])))
71
- if (result !== '[194,169]') { throw result }
72
- }
73
-
74
- {
75
- const result = stringify(list.toArray(encoding.fromCodePointList([0x7ff])))
76
- if (result !== '[223,191]') { throw result }
77
- }
78
-
79
- {
80
- const result = stringify(list.toArray(encoding.fromCodePointList([0x800])))
81
- if (result !== '[224,160,128]') { throw result }
82
- }
83
-
84
- {
85
- const result = stringify(list.toArray(encoding.fromCodePointList([0x801])))
86
- if (result !== '[224,160,129]') { throw result }
87
- }
88
-
89
- {
90
- const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])))
91
- if (result !== '[239,191,191]') { throw result }
92
- }
93
-
94
- {
95
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])))
96
- if (result !== '[240,144,128,128]') { throw result }
97
- }
98
-
99
- {
100
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10001])))
101
- if (result !== '[240,144,128,129]') { throw result }
102
- }
103
-
104
- {
105
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10FFFF])))
106
- if (result !== '[244,143,191,191]') { throw result }
107
- }
108
-
109
- {
110
- const result = stringify(list.toArray(encoding.fromCodePointList([0x110000,2147483648])))
111
- if (result !== '[2147483648,2147483648]') { throw result }
112
- }
113
-
114
- {
115
- const codePointList = encoding.toCodePointList([128, 193, 245, 255])
116
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
117
- if (result !== '[128,193,245,255]') { throw result }
118
- }
119
-
120
- {
121
- const codePointList = encoding.toCodePointList([194, 194, 127, 194, 192, 194])
122
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
123
- if (result !== '[194,194,127,194,192,194]') { throw result }
124
- }
125
-
126
- {
127
- const codePointList = encoding.toCodePointList([224, 224, 160, 127, 239, 191])
128
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
129
- if (result !== '[224,224,160,127,239,191]') { throw result }
130
- }
131
-
132
- {
133
- const codePointList = encoding.toCodePointList([240, 240, 160, 127, 244, 191])
134
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
135
- if (result !== '[240,240,160,127,244,191]') { throw result }
136
- }
137
-
138
- {
139
- const codePointList = encoding.toCodePointList([240, 160, 160, 244, 160, 160])
140
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
141
- if (result !== '[240,160,160,244,160,160]') { throw result }
142
- }
143
-
144
- module.exports = {}
package/tsconfig.json CHANGED
@@ -97,5 +97,5 @@
97
97
  // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
98
98
  "skipLibCheck": true /* Skip type checking all .d.ts files. */
99
99
  },
100
- "exclude": ["target", "denotest.mjs"]
100
+ "exclude": ["target", "test.mjs"]
101
101
  }
@@ -5,90 +5,88 @@ const { sort } = require('../object/module.f.cjs')
5
5
  /** @type {(a: readonly json.Unknown[]) => string} */
6
6
  const stringify = a => json.stringify(sort)(a)
7
7
 
8
- {
9
- const result = stringify([1, 20, 300])
10
- if (result !== '[1,20,300]') { throw result }
11
- }
12
-
13
- {
14
- const result = _.at(2)([1, 20, 300])
15
- if (result === undefined) {throw result}
16
- if (result[0] !== 300) { throw result }
17
- }
18
-
19
- {
20
- const result = _.at(3)([1, 20, 300])
21
- if (result !== undefined) {throw result}
22
- }
23
-
24
- {
25
- const result = _.first([1, 20, 300])
26
- if (result !== 1) { throw result }
27
- }
28
-
29
- {
30
- const result = _.first([])
31
- if (result !== undefined) {throw result}
32
- }
33
-
34
- {
35
- const result = _.last([1, 20, 300])
36
- if (result !== 300) { throw result }
37
- }
38
-
39
- {
40
- const result = _.last([])
41
- if (result !== undefined) {throw result}
42
- }
43
-
44
- {
45
- const result = _.head([1, 20, 300])
46
- if (result === undefined) {throw result}
47
- const str = stringify(result)
48
- if (str !== '[1,20]') { throw str }
49
- }
50
-
51
- {
52
- const result = _.head([])
53
- if (result !== undefined) {throw result}
54
- }
55
-
56
- {
57
- const result = _.tail([1, 20, 300])
58
- if (result === undefined) {throw result}
59
- const str = stringify(result)
60
- if (str !== '[20,300]') { throw str }
61
- }
62
-
63
- {
64
- const result = _.tail([])
65
- if (result !== undefined) {throw result}
66
- }
67
-
68
- {
69
- const result = _.splitFirst([1, 20, 300])
70
- if (result === undefined) {throw result}
71
- const str = stringify(result)
72
- if (str !== '[1,[20,300]]') { throw str }
73
- }
74
-
75
- {
76
- const result = _.splitFirst([])
77
- if (result !== undefined) {throw result}
78
- }
79
-
80
- {
81
- const result = _.splitLast([1, 20, 300])
82
- if (result === undefined) {throw result}
83
- const str = stringify(result)
84
- if (str !== '[[1,20],300]') { throw str }
85
- }
86
-
87
- {
88
- const result = _.splitLast([])
89
- if (result !== undefined) {throw result}
90
- }
91
-
92
8
  module.exports = {
93
-
9
+ stringify: () => {
10
+ const result = stringify([1, 20, 300])
11
+ if (result !== '[1,20,300]') { throw result }
12
+ },
13
+ at: [
14
+ () => {
15
+ const result = _.at(2)([1, 20, 300])
16
+ if (result === undefined) { throw result }
17
+ if (result[0] !== 300) { throw result }
18
+ },
19
+
20
+ () => {
21
+ const result = _.at(3)([1, 20, 300])
22
+ if (result !== undefined) { throw result }
23
+ }
24
+ ],
25
+ first: [
26
+ () => {
27
+ const result = _.first([1, 20, 300])
28
+ if (result !== 1) { throw result }
29
+ },
30
+ () => {
31
+ const result = _.first([])
32
+ if (result !== undefined) { throw result }
33
+ }
34
+ ],
35
+ last: [
36
+ () => {
37
+ const result = _.last([1, 20, 300])
38
+ if (result !== 300) { throw result }
39
+ },
40
+ () => {
41
+ const result = _.last([])
42
+ if (result !== undefined) { throw result }
43
+ }
44
+ ],
45
+ head: [
46
+ () => {
47
+ const result = _.head([1, 20, 300])
48
+ if (result === undefined) { throw result }
49
+ const str = stringify(result)
50
+ if (str !== '[1,20]') { throw str }
51
+ },
52
+ () => {
53
+ const result = _.head([])
54
+ if (result !== undefined) { throw result }
55
+ }
56
+ ],
57
+ tail: [
58
+ () => {
59
+ const result = _.tail([1, 20, 300])
60
+ if (result === undefined) { throw result }
61
+ const str = stringify(result)
62
+ if (str !== '[20,300]') { throw str }
63
+ },
64
+ () => {
65
+ const result = _.tail([])
66
+ if (result !== undefined) { throw result }
67
+ }
68
+ ],
69
+
70
+ splitFirst: [
71
+ () => {
72
+ const result = _.splitFirst([1, 20, 300])
73
+ if (result === undefined) { throw result }
74
+ const str = stringify(result)
75
+ if (str !== '[1,[20,300]]') { throw str }
76
+ },
77
+ () => {
78
+ const result = _.splitFirst([])
79
+ if (result !== undefined) { throw result }
80
+ },
81
+ () => {
82
+ const result = _.splitLast([1, 20, 300])
83
+ if (result === undefined) { throw result }
84
+ const str = stringify(result)
85
+ if (str !== '[[1,20],300]') { throw str }
86
+ },
87
+ () => {
88
+ const result = _.splitLast([])
89
+ if (result !== undefined) { throw result }
90
+ }
91
+ ]
94
92
  }
@@ -1,8 +1,8 @@
1
1
  const { sum } = require('./module.f.cjs')
2
2
 
3
- {
4
- const result = sum([2n, 3n, 4n, 5n])
5
- if (result !== 14n) { throw result }
6
- }
7
-
8
- module.exports = {}
3
+ module.exports = {
4
+ sum: () => {
5
+ const result = sum([2n, 3n, 4n, 5n])
6
+ if (result !== 14n) { throw result }
7
+ }
8
+ }
@@ -17,7 +17,7 @@ const str = r => jsonStr(list.toArray(list.map(x => x[0])(r)))
17
17
  /** @type {(i: string) => (m: btree.Node<string>) => string} */
18
18
  const find = i => m => str(_.find(cmp(i))(m))
19
19
 
20
- {
20
+ const test = () => {
21
21
  /** @type {btree.Node<string>} */
22
22
  let _map = ['1']
23
23
  for (let i = 2; i <= 10; i++)
@@ -113,4 +113,4 @@ const find = i => m => str(_.find(cmp(i))(m))
113
113
  }
114
114
  }
115
115
 
116
- module.exports = {}
116
+ module.exports = test
@@ -13,7 +13,7 @@ const remove = node => value => _.nodeRemove(cmp(value))(node)
13
13
 
14
14
  const jsonStr = json.stringify(sort)
15
15
 
16
- {
16
+ const test = () => {
17
17
  /** @type {btree.Node<string> | undefined} */
18
18
  let _map = ['1']
19
19
  for (let i = 2; i <= 38; i++)
@@ -408,7 +408,7 @@ const jsonStr = json.stringify(sort)
408
408
  }
409
409
  }
410
410
 
411
- {
411
+ const test2 = () => {
412
412
  /** @type {btree.Node<string>|undefined} */
413
413
  let _map = ['1']
414
414
  for (let i = 2; i <= 10; i++)
@@ -486,4 +486,7 @@ const jsonStr = json.stringify(sort)
486
486
  }
487
487
  }
488
488
 
489
- module.exports = {}
489
+ module.exports = {
490
+ test,
491
+ test2,
492
+ }