functionalscript 0.1.609 → 0.2.0

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 (175) hide show
  1. package/com/cpp/module.f.d.mts +4 -8
  2. package/com/cpp/module.f.mjs +20 -25
  3. package/com/cpp/testlib.f.mjs +3 -4
  4. package/com/cs/module.f.d.mts +4 -8
  5. package/com/cs/module.f.mjs +18 -23
  6. package/com/cs/testlib.f.mjs +3 -5
  7. package/com/rust/module.f.d.mts +3 -7
  8. package/com/rust/module.f.mjs +25 -30
  9. package/com/rust/testlib.f.mjs +3 -5
  10. package/com/test/build.f.d.mts +2 -2
  11. package/com/test/build.f.mjs +2 -2
  12. package/com/test/build.mjs +4 -4
  13. package/com/types/module.f.d.mts +5 -10
  14. package/com/types/module.f.mjs +5 -12
  15. package/commonjs/build/module.f.d.mts +13 -17
  16. package/commonjs/build/module.f.mjs +23 -28
  17. package/commonjs/build/test.f.mjs +4 -4
  18. package/commonjs/module/function/module.f.d.mts +0 -2
  19. package/commonjs/module/function/module.f.mjs +0 -2
  20. package/commonjs/module/module.f.d.mts +16 -21
  21. package/commonjs/module/module.f.mjs +2 -9
  22. package/commonjs/module.d.mts +1 -5
  23. package/commonjs/module.f.d.mts +0 -2
  24. package/commonjs/module.f.mjs +0 -2
  25. package/commonjs/module.mjs +2 -7
  26. package/commonjs/package/dependencies/module.f.d.mts +3 -7
  27. package/commonjs/package/dependencies/module.f.mjs +5 -10
  28. package/commonjs/package/dependencies/test.f.mjs +1 -1
  29. package/commonjs/package/module.f.d.mts +12 -18
  30. package/commonjs/package/module.f.mjs +6 -13
  31. package/commonjs/package/test.f.mjs +1 -1
  32. package/commonjs/path/module.f.d.mts +25 -32
  33. package/commonjs/path/module.f.mjs +12 -23
  34. package/commonjs/path/test.f.mjs +11 -11
  35. package/commonjs/test.mjs +1 -1
  36. package/dev/module.f.d.mts +1 -4
  37. package/dev/module.f.mjs +1 -4
  38. package/dev/test/module.f.d.mts +2 -3
  39. package/dev/test/module.f.mjs +4 -6
  40. package/djs/module.f.d.mts +13 -18
  41. package/djs/module.f.mjs +12 -19
  42. package/djs/parser/module.f.d.mts +11 -15
  43. package/djs/parser/module.f.mjs +18 -24
  44. package/djs/parser/test.f.mjs +9 -9
  45. package/djs/test.f.mjs +4 -4
  46. package/djs/tokenizer/module.f.d.mts +6 -10
  47. package/djs/tokenizer/module.f.mjs +18 -23
  48. package/djs/tokenizer/test.f.mjs +6 -6
  49. package/fsc/module.f.d.mts +4 -9
  50. package/fsc/module.f.mjs +17 -24
  51. package/fsc/test.f.mjs +3 -3
  52. package/fsm/module.f.d.mts +13 -20
  53. package/fsm/module.f.mjs +27 -38
  54. package/fsm/test.f.mjs +8 -8
  55. package/html/module.f.d.mts +7 -12
  56. package/html/module.f.mjs +14 -23
  57. package/html/test.f.mjs +4 -4
  58. package/js/tokenizer/module.f.d.mts +10 -15
  59. package/js/tokenizer/module.f.mjs +55 -62
  60. package/js/tokenizer/test.f.mjs +6 -6
  61. package/json/module.f.d.mts +18 -26
  62. package/json/module.f.mjs +18 -31
  63. package/json/parser/module.f.d.mts +9 -13
  64. package/json/parser/module.f.mjs +9 -14
  65. package/json/parser/test.f.mjs +7 -7
  66. package/json/serializer/module.f.d.mts +11 -20
  67. package/json/serializer/module.f.mjs +14 -29
  68. package/json/serializer/test.f.mjs +2 -2
  69. package/json/test.f.mjs +3 -3
  70. package/json/tokenizer/module.f.d.mts +6 -10
  71. package/json/tokenizer/module.f.mjs +14 -19
  72. package/json/tokenizer/test.f.mjs +6 -6
  73. package/jsr.json +1 -1
  74. package/nodejs/version/main.mjs +1 -1
  75. package/nodejs/version/module.f.d.mts +4 -9
  76. package/nodejs/version/module.f.mjs +2 -7
  77. package/nodejs/version/test.f.mjs +3 -3
  78. package/package.json +1 -1
  79. package/prime_field/module.f.d.mts +20 -23
  80. package/prime_field/module.f.mjs +9 -12
  81. package/prime_field/test.f.mjs +1 -1
  82. package/secp/module.f.d.mts +27 -28
  83. package/secp/module.f.mjs +38 -39
  84. package/secp/test.f.mjs +4 -4
  85. package/sha2/module.f.d.mts +8 -16
  86. package/sha2/module.f.mjs +7 -20
  87. package/sha2/test.f.mjs +4 -4
  88. package/text/ascii/module.f.d.mts +69 -72
  89. package/text/ascii/module.f.mjs +5 -10
  90. package/text/ascii/test.f.mjs +3 -3
  91. package/text/module.f.d.mts +9 -14
  92. package/text/module.f.mjs +7 -14
  93. package/text/sgr/module.f.d.mts +7 -9
  94. package/text/sgr/module.f.mjs +2 -4
  95. package/text/test.f.mjs +3 -3
  96. package/text/utf16/module.f.d.mts +8 -15
  97. package/text/utf16/module.f.mjs +17 -28
  98. package/text/utf16/test.f.mjs +5 -5
  99. package/text/utf8/module.f.d.mts +4 -9
  100. package/text/utf8/module.f.mjs +9 -16
  101. package/text/utf8/test.f.mjs +4 -4
  102. package/types/array/module.f.d.mts +14 -24
  103. package/types/array/module.f.mjs +8 -25
  104. package/types/array/test.f.mjs +3 -3
  105. package/types/bigfloat/module.f.d.mts +4 -9
  106. package/types/bigfloat/module.f.mjs +3 -10
  107. package/types/bigfloat/test.f.mjs +1 -1
  108. package/types/bigint/module.f.d.mts +16 -64
  109. package/types/bigint/module.f.mjs +11 -30
  110. package/types/bigint/test.f.mjs +1 -1
  111. package/types/btree/find/module.f.d.mts +20 -26
  112. package/types/btree/find/module.f.mjs +8 -17
  113. package/types/btree/find/test.f.mjs +7 -7
  114. package/types/btree/module.f.d.mts +4 -8
  115. package/types/btree/module.f.mjs +6 -11
  116. package/types/btree/remove/module.f.d.mts +7 -12
  117. package/types/btree/remove/module.f.mjs +10 -17
  118. package/types/btree/remove/test.f.mjs +5 -5
  119. package/types/btree/set/module.f.d.mts +3 -7
  120. package/types/btree/set/module.f.mjs +4 -9
  121. package/types/btree/set/test.f.mjs +4 -4
  122. package/types/btree/test.f.mjs +9 -9
  123. package/types/btree/types/module.f.d.mts +0 -2
  124. package/types/btree/types/module.f.mjs +0 -2
  125. package/types/byte_set/module.f.d.mts +16 -29
  126. package/types/byte_set/module.f.mjs +14 -39
  127. package/types/byte_set/test.f.mjs +5 -5
  128. package/types/function/compare/module.f.d.mts +9 -15
  129. package/types/function/compare/module.f.mjs +3 -12
  130. package/types/function/compare/test.f.mjs +1 -1
  131. package/types/function/module.f.d.mts +20 -27
  132. package/types/function/module.f.mjs +4 -15
  133. package/types/function/operator/module.f.d.mts +28 -43
  134. package/types/function/operator/module.f.mjs +14 -41
  135. package/types/function/test.f.mjs +1 -1
  136. package/types/list/module.f.d.mts +56 -91
  137. package/types/list/module.f.mjs +45 -114
  138. package/types/list/test.f.mjs +10 -10
  139. package/types/map/module.f.d.mts +15 -24
  140. package/types/map/module.f.mjs +15 -30
  141. package/types/map/test.f.mjs +2 -2
  142. package/types/nibble_set/module.f.d.mts +10 -20
  143. package/types/nibble_set/module.f.mjs +7 -24
  144. package/types/nibble_set/test.f.mjs +2 -2
  145. package/types/nullable/module.f.d.mts +3 -8
  146. package/types/nullable/module.f.mjs +2 -9
  147. package/types/nullable/test.f.mjs +1 -1
  148. package/types/number/module.f.d.mts +7 -13
  149. package/types/number/module.f.mjs +8 -19
  150. package/types/number/test.f.mjs +1 -1
  151. package/types/object/module.f.d.mts +11 -18
  152. package/types/object/module.f.mjs +9 -20
  153. package/types/object/test.f.mjs +1 -1
  154. package/types/range/module.f.d.mts +3 -8
  155. package/types/range/module.f.mjs +2 -9
  156. package/types/range/test.f.mjs +1 -1
  157. package/types/range_map/module.f.d.mts +9 -15
  158. package/types/range_map/module.f.mjs +9 -18
  159. package/types/range_map/test.f.mjs +32 -32
  160. package/types/result/module.d.mts +3 -3
  161. package/types/result/module.f.d.mts +6 -12
  162. package/types/result/module.f.mjs +3 -12
  163. package/types/result/module.mjs +2 -2
  164. package/types/sorted_list/module.f.d.mts +22 -28
  165. package/types/sorted_list/module.f.mjs +10 -19
  166. package/types/sorted_list/test.f.mjs +7 -7
  167. package/types/sorted_set/module.f.d.mts +6 -12
  168. package/types/sorted_set/module.f.mjs +7 -16
  169. package/types/sorted_set/test.f.mjs +7 -7
  170. package/types/string/module.f.d.mts +8 -14
  171. package/types/string/module.f.mjs +10 -21
  172. package/types/string/test.f.mjs +2 -2
  173. package/types/string_set/module.f.d.mts +8 -16
  174. package/types/string_set/module.f.mjs +12 -27
  175. package/types/string_set/test.f.mjs +1 -1
@@ -1,21 +1,14 @@
1
- declare namespace _default {
2
- export { dfa };
3
- export { run };
4
- export { toRange };
5
- export { toUnion };
6
- }
7
- export default _default;
8
- export type Rule = readonly [string, byteSetT.ByteSet, string];
9
- export type Grammar = List.List<Rule>;
10
- export type Dfa = { readonly [state in string]: RM.RangeMapArray<string>; };
1
+ /** @type {(s: string) => byteSet.ByteSet} */
2
+ export const toRange: (s: string) => byteSet.ByteSet;
3
+ /** @type {(s: string) => byteSet.ByteSet} */
4
+ export const toUnion: (s: string) => byteSet.ByteSet;
11
5
  /** @type {(grammar: Grammar) => Dfa} */
12
- declare const dfa: (grammar: Grammar) => Dfa;
13
- /** @type {(dfa: Dfa) => (input: List.List<number>) => List.List<string>} */
14
- declare const run: (dfa: Dfa) => (input: List.List<number>) => List.List<string>;
15
- /** @type {(s: string) => byteSetT.ByteSet} */
16
- declare const toRange: (s: string) => byteSetT.ByteSet;
17
- /** @type {(s: string) => byteSetT.ByteSet} */
18
- declare const toUnion: (s: string) => byteSetT.ByteSet;
19
- import * as byteSetT from '../types/byte_set/module.f.mjs';
20
- import * as List from '../types/list/module.f.mjs';
21
- import * as RM from '../types/range_map/module.f.mjs';
6
+ export const dfa: (grammar: Grammar) => Dfa;
7
+ /** @type {(dfa: Dfa) => (input: list.List<number>) => list.List<string>} */
8
+ export const run: (dfa: Dfa) => (input: list.List<number>) => list.List<string>;
9
+ export type Rule = readonly [string, byteSet.ByteSet, string];
10
+ export type Grammar = list.List<Rule>;
11
+ export type Dfa = { readonly [state in string]: rangeMap.RangeMapArray<string>; };
12
+ import * as byteSet from '../types/byte_set/module.f.mjs';
13
+ import * as list from '../types/list/module.f.mjs';
14
+ import * as rangeMap from '../types/range_map/module.f.mjs';
package/fsm/module.f.mjs CHANGED
@@ -1,73 +1,73 @@
1
1
  // @ts-self-types="./module.f.d.mts"
2
- import list, * as List from '../types/list/module.f.mjs'
2
+ import * as list from '../types/list/module.f.mjs'
3
3
  const { equal, isEmpty, fold, toArray, scan, foldScan, empty: emptyList } = list
4
- import byteSet, * as byteSetT from '../types/byte_set/module.f.mjs'
4
+ import * as byteSet from '../types/byte_set/module.f.mjs'
5
5
  const { toRangeMap, union: byteSetUnion, one, empty } = byteSet
6
- import sortedSet, * as SortedSet from '../types/sorted_set/module.f.mjs'
6
+ import * as sortedSet from '../types/sorted_set/module.f.mjs'
7
7
  const { intersect, union: sortedSetUnion } = sortedSet
8
- import rangeMap, * as RM from '../types/range_map/module.f.mjs'
8
+ import * as rangeMap from '../types/range_map/module.f.mjs'
9
9
  const { merge } = rangeMap
10
- import cmp from '../types/function/compare/module.f.mjs'
10
+ import * as cmp from '../types/function/compare/module.f.mjs'
11
11
  const { unsafeCmp } = cmp
12
- import operator, * as Operator from '../types/function/operator/module.f.mjs'
12
+ import * as operator from '../types/function/operator/module.f.mjs'
13
13
  const { strictEqual } = operator
14
- import j from '../json/module.f.mjs'
14
+ import * as j from '../json/module.f.mjs'
15
15
  const { stringify } = j
16
- import f from '../types/function/module.f.mjs'
16
+ import * as f from '../types/function/module.f.mjs'
17
17
  const { identity } = f
18
- import utf16 from '../text/utf16/module.f.mjs'
18
+ import * as utf16 from '../text/utf16/module.f.mjs'
19
19
  const { stringToList } = utf16
20
20
 
21
- /** @typedef {readonly[string, byteSetT.ByteSet, string]} Rule */
21
+ /** @typedef {readonly[string, byteSet.ByteSet, string]} Rule */
22
22
 
23
- /** @typedef {List.List<Rule>} Grammar */
23
+ /** @typedef {list.List<Rule>} Grammar */
24
24
 
25
25
  /**
26
26
  * @typedef {{
27
- * readonly[state in string]: RM.RangeMapArray<string>
27
+ * readonly[state in string]: rangeMap.RangeMapArray<string>
28
28
  * }} Dfa
29
29
  */
30
30
 
31
31
  const stringifyIdentity = stringify(identity)
32
32
 
33
- /** @type {(s: string) => byteSetT.ByteSet} */
34
- const toRange = s => {
33
+ /** @type {(s: string) => byteSet.ByteSet} */
34
+ export const toRange = s => {
35
35
  const [b, e] = toArray(stringToList(s))
36
36
  return byteSet.range([b, e])
37
37
  }
38
38
 
39
- /** @type {Operator.Fold<number, byteSetT.ByteSet>} */
39
+ /** @type {operator.Fold<number, byteSet.ByteSet>} */
40
40
  const toUnionOp = i => bs => byteSetUnion(bs)(one(i))
41
41
 
42
- /** @type {(s: string) => byteSetT.ByteSet} */
43
- const toUnion = s => {
42
+ /** @type {(s: string) => byteSet.ByteSet} */
43
+ export const toUnion = s => {
44
44
  const codePoints = stringToList(s)
45
45
  return fold(toUnionOp)(empty)(codePoints)
46
46
  }
47
47
 
48
- /** @type {RM.Operators<SortedSet.SortedSet<string>>} */
48
+ /** @type {rangeMap.Operators<sortedSet.SortedSet<string>>} */
49
49
  const mergeOp = { union: sortedSetUnion(unsafeCmp), equal: equal(strictEqual) }
50
50
 
51
- /** @type {(s: string) => (set: SortedSet.SortedSet<string>) => boolean} */
51
+ /** @type {(s: string) => (set: sortedSet.SortedSet<string>) => boolean} */
52
52
  const hasState = s => set => !isEmpty(intersect(unsafeCmp)([s])(set))
53
53
 
54
- /** @type {(set: SortedSet.SortedSet<string>) => Operator.Fold<Rule, RM.RangeMap<SortedSet.SortedSet<string>>>} */
54
+ /** @type {(set: sortedSet.SortedSet<string>) => operator.Fold<Rule, rangeMap.RangeMap<sortedSet.SortedSet<string>>>} */
55
55
  const foldOp = set => ([ruleIn, bs, ruleOut]) => rm => {
56
56
  if (hasState(ruleIn)(set)) { return merge(mergeOp)(rm)(toRangeMap(bs)(ruleOut)) }
57
57
  return rm
58
58
  }
59
59
 
60
- /** @type {Operator.Scan<RM.Entry<SortedSet.SortedSet<string>>, RM.Entry<string>>} */
60
+ /** @type {operator.Scan<rangeMap.Entry<sortedSet.SortedSet<string>>, rangeMap.Entry<string>>} */
61
61
  const stringifyOp = ([sortedSet, max]) => [[stringifyIdentity(sortedSet), max], stringifyOp]
62
62
 
63
63
  const scanStringify = scan(stringifyOp)
64
64
 
65
- /** @type {Operator.Scan<RM.Entry<SortedSet.SortedSet<string>>, SortedSet.SortedSet<string>>} */
65
+ /** @type {operator.Scan<rangeMap.Entry<sortedSet.SortedSet<string>>, sortedSet.SortedSet<string>>} */
66
66
  const fetchOp = ([item, _]) => [item, fetchOp]
67
67
 
68
68
  const scanFetch = scan(fetchOp)
69
69
 
70
- /** @type {(grammar: Grammar) => Operator.Fold<SortedSet.SortedSet<string>, Dfa>} */
70
+ /** @type {(grammar: Grammar) => operator.Fold<sortedSet.SortedSet<string>, Dfa>} */
71
71
  const addEntry = grammar => set => dfa => {
72
72
  const s = stringifyIdentity(set)
73
73
  if (s in dfa) { return dfa }
@@ -88,23 +88,12 @@ const initialState = ['']
88
88
  const initialStateStringify = stringifyIdentity(initialState)
89
89
 
90
90
  /** @type {(grammar: Grammar) => Dfa} */
91
- const dfa = grammar => addEntry(grammar)(initialState)({})
91
+ export const dfa = grammar => addEntry(grammar)(initialState)({})
92
92
 
93
93
  const get = rangeMap.get(emptyStateStringify)
94
94
 
95
- /** @type {(dfa: Dfa) => Operator.Fold<number, string>} */
95
+ /** @type {(dfa: Dfa) => operator.Fold<number, string>} */
96
96
  const runOp = dfa => input => s => get(input)(dfa[s])
97
97
 
98
- /** @type {(dfa: Dfa) => (input: List.List<number>) => List.List<string>} */
99
- const run = dfa => input => foldScan(runOp(dfa))(initialStateStringify)(input)
100
-
101
- export default {
102
- /** @readonly */
103
- dfa,
104
- /** @readonly */
105
- run,
106
- /** @readonly */
107
- toRange,
108
- /** @readonly */
109
- toUnion
110
- }
98
+ /** @type {(dfa: Dfa) => (input: list.List<number>) => list.List<string>} */
99
+ export const run = dfa => input => foldScan(runOp(dfa))(initialStateStringify)(input)
package/fsm/test.f.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import _, * as T from './module.f.mjs'
2
- import byteSet from '../types/byte_set/module.f.mjs'
3
- import o from '../types/object/module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
+ import * as byteSet from '../types/byte_set/module.f.mjs'
3
+ import * as o from '../types/object/module.f.mjs'
4
4
  const { sort, fromEntries } = o
5
- import json from '../json/module.f.mjs'
6
- import f from '../types/function/module.f.mjs'
5
+ import * as json from '../json/module.f.mjs'
6
+ import * as f from '../types/function/module.f.mjs'
7
7
  const { identity } = f
8
- import list from '../types/list/module.f.mjs'
8
+ import * as list from '../types/list/module.f.mjs'
9
9
  const { toArray } = list
10
- import utf16 from '../text/utf16/module.f.mjs'
10
+ import * as utf16 from '../text/utf16/module.f.mjs'
11
11
  const { stringToList } = utf16
12
12
 
13
13
  const stringifyIdentity = json.stringify(identity)
@@ -22,7 +22,7 @@ const buildDfa = () => {
22
22
  const idNext = byteSet.union(idBegin)(digit)
23
23
  const dot = _.toUnion('.')
24
24
 
25
- /** @type {T.Grammar} */
25
+ /** @type {_.Grammar} */
26
26
  const grammar = [
27
27
  ['', digit, 'int'],
28
28
  ['int', digit, 'int'],
@@ -1,9 +1,7 @@
1
- declare namespace _default {
2
- export { element };
3
- export { html };
4
- export { htmlToString };
5
- }
6
- export default _default;
1
+ /** @type {(element: Element) => list.List<string>} */
2
+ export const element: (element: Element) => list.List<string>;
3
+ export const html: f.Func<Element, list.List<string>>;
4
+ export const htmlToString: f.Func<Element, string>;
7
5
  export type Tag = string;
8
6
  export type Element1 = readonly [Tag];
9
7
  export type Element2A = readonly [Tag, Attributes];
@@ -11,10 +9,7 @@ export type Element2N = readonly [Tag, readonly Node[]];
11
9
  export type Element3 = readonly [Tag, Attributes, Nodes];
12
10
  export type Element = Element1 | Element2A | Element2N | Element3;
13
11
  export type Attributes = { readonly [k in string]: string; };
14
- export type Nodes = List.List<Node>;
12
+ export type Nodes = list.List<Node>;
15
13
  export type Node = Element | string;
16
- /** @type {(element: Element) => List.List<string>} */
17
- declare const element: (element: Element) => List.List<string>;
18
- declare const html: import("../types/function/module.f.mjs").Func<Element, List.List<string>>;
19
- declare const htmlToString: import("../types/function/module.f.mjs").Func<Element, string>;
20
- import * as List from '../types/list/module.f.mjs';
14
+ import * as list from '../types/list/module.f.mjs';
15
+ import * as f from '../types/function/module.f.mjs';
package/html/module.f.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  // @ts-self-types="./module.f.d.mts"
2
- import list, * as List from '../types/list/module.f.mjs'
2
+ import * as list from '../types/list/module.f.mjs'
3
3
  const { map, flatMap, flat, concat: listConcat } = list
4
- import s from '../types/string/module.f.mjs'
4
+ import * as s from '../types/string/module.f.mjs'
5
5
  const { concat: stringConcat } = s
6
6
  import * as O from '../types/object/module.f.mjs'
7
- import f from '../types/function/module.f.mjs'
7
+ import * as f from '../types/function/module.f.mjs'
8
8
  const { compose } = f
9
- import utf16 from '../text/utf16/module.f.mjs'
9
+ import * as utf16 from '../text/utf16/module.f.mjs'
10
10
  const { stringToList } = utf16
11
11
  const { fromCharCode } = String
12
12
  const { entries } = Object
@@ -50,7 +50,7 @@ const isVoid = tag => voidTagList.includes(tag)
50
50
  * }} Attributes
51
51
  */
52
52
 
53
- /** @typedef {List.List<Node>} Nodes */
53
+ /** @typedef {list.List<Node>} Nodes */
54
54
 
55
55
  /** @typedef {Element | string} Node */
56
56
 
@@ -71,33 +71,33 @@ const escapeCharCode = code => {
71
71
 
72
72
  const escape = compose(stringToList)(map(escapeCharCode))
73
73
 
74
- /** @type {(n: Node) => List.List<string>} */
74
+ /** @type {(n: Node) => list.List<string>} */
75
75
  const node = n => typeof n === 'string' ? escape(n) : element(n)
76
76
 
77
77
  const nodes = flatMap(node)
78
78
 
79
- /** @type {(a: O.Entry<string>) => List.List<string>} */
79
+ /** @type {(a: O.Entry<string>) => list.List<string>} */
80
80
  const attribute = ([name, value]) => flat([[' ', name, '="'], escape(value), ['"']])
81
81
 
82
- /** @type {(a: Attributes) => List.List<string>} */
82
+ /** @type {(a: Attributes) => list.List<string>} */
83
83
  const attributes = compose(entries)(flatMap(attribute))
84
84
 
85
85
  const open = (/** @type {Element2A} */[tag, a]) => flat([[`<`, tag], attributes(a), [`>`]])
86
86
 
87
87
  const close = (/** @type {string}*/tag) => ['</', tag, '>']
88
88
 
89
- /** @type {(_: Element3) => List.List<string>} */
89
+ /** @type {(_: Element3) => list.List<string>} */
90
90
  const element3 = ([tag, a, ns]) =>
91
91
  flat([open([tag, a]), nodes(ns), close(tag)])
92
92
 
93
- /** @type {(_: Element2A) => List.List<string>} */
93
+ /** @type {(_: Element2A) => list.List<string>} */
94
94
  const element2a = e => {
95
95
  const [tag] = e
96
96
  return flat([open(e), isVoid(tag) ? [] : close(tag)])
97
97
  }
98
98
 
99
- /** @type {(element: Element) => List.List<string>} */
100
- const element = e => {
99
+ /** @type {(element: Element) => list.List<string>} */
100
+ export const element = e => {
101
101
  switch (e.length) {
102
102
  case 1: { return element2a([e[0], {}]) }
103
103
  case 2: {
@@ -112,15 +112,6 @@ const element = e => {
112
112
  }
113
113
  }
114
114
 
115
- const html = compose(element)(listConcat(['<!DOCTYPE html>']))
115
+ export const html = compose(element)(listConcat(['<!DOCTYPE html>']))
116
116
 
117
- const htmlToString = compose(html)(stringConcat)
118
-
119
- export default {
120
- /** @readonly */
121
- element,
122
- /** @readonly */
123
- html,
124
- /** @readonly */
125
- htmlToString,
126
- }
117
+ export const htmlToString = compose(html)(stringConcat)
package/html/test.f.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import _, * as T from './module.f.mjs'
1
+ import * as _ from './module.f.mjs'
2
2
 
3
3
  export default {
4
4
  empty: () => {
@@ -14,19 +14,19 @@ export default {
14
14
  if (r !== '<!DOCTYPE html><area>') { throw r }
15
15
  },
16
16
  some: () => {
17
- /** @type {T.Element} */
17
+ /** @type {_.Element} */
18
18
  const x = ['div', {}, ['<div>&amp;</div>', ['a', { href: 'hello"' }, []]]]
19
19
  const s = _.htmlToString(x)
20
20
  if (s !== '<!DOCTYPE html><div>&lt;div&gt;&amp;amp;&lt;/div&gt;<a href="hello&quot;"></a></div>') { throw s }
21
21
  },
22
22
  some2: () => {
23
- /** @type {T.Element} */
23
+ /** @type {_.Element} */
24
24
  const x = ['div', ['<div>&amp;</div>', ['a', { href: 'hello"' }, []]]]
25
25
  const s = _.htmlToString(x)
26
26
  if (s !== '<!DOCTYPE html><div>&lt;div&gt;&amp;amp;&lt;/div&gt;<a href="hello&quot;"></a></div>') { throw s }
27
27
  },
28
28
  someVoid: () => {
29
- /** @type {T.Element} */
29
+ /** @type {_.Element} */
30
30
  const x = ['div', [['br', {id: '5'}], '<div>&amp;</div>', ['a', { href: 'hello"' }, []]]]
31
31
  const s = _.htmlToString(x)
32
32
  if (s !== '<!DOCTYPE html><div><br id="5">&lt;div&gt;&amp;amp;&lt;/div&gt;<a href="hello&quot;"></a></div>') { throw s }
@@ -1,8 +1,7 @@
1
- declare namespace _default {
2
- export { tokenize };
3
- export { isKeywordToken };
4
- }
5
- export default _default;
1
+ /** @type {(token: JsToken) => Boolean} */
2
+ export const isKeywordToken: (token: JsToken) => boolean;
3
+ /** @type {(input: list.List<number>) => list.List<JsToken>} */
4
+ export const tokenize: (input: list.List<number>) => list.List<JsToken>;
6
5
  export type StringToken = {
7
6
  readonly kind: "string";
8
7
  readonly value: string;
@@ -132,12 +131,12 @@ export type EofState = {
132
131
  readonly kind: "eof";
133
132
  };
134
133
  export type CharCodeOrEof = number | null;
135
- export type ToToken = (input: number) => readonly [List.List<JsToken>, TokenizerState];
134
+ export type ToToken = (input: number) => readonly [list.List<JsToken>, TokenizerState];
136
135
  /**
137
136
  * <T>
138
137
  */
139
138
  export type CreateToToken<T> = (state: T) => ToToken;
140
- export type RangeSet = List.List<Range.Range>;
139
+ export type RangeSet = list.List<_range.Range>;
141
140
  /**
142
141
  * <T>
143
142
  */
@@ -145,12 +144,8 @@ export type RangeFunc<T> = (def: CreateToToken<T>) => (RangeMapToToken<T>);
145
144
  /**
146
145
  * <T>
147
146
  */
148
- export type RangeMapToToken<T> = RangeMap.RangeMapArray<CreateToToken<T>>;
149
- /** @type {(input: List.List<number>) => List.List<JsToken>} */
150
- declare const tokenize: (input: List.List<number>) => List.List<JsToken>;
151
- /** @type {(token: JsToken) => Boolean} */
152
- declare const isKeywordToken: (token: JsToken) => boolean;
147
+ export type RangeMapToToken<T> = range_map.RangeMapArray<CreateToToken<T>>;
148
+ import * as list from '../../types/list/module.f.mjs';
153
149
  import * as bigfloatT from '../../types/bigfloat/module.f.mjs';
154
- import * as List from '../../types/list/module.f.mjs';
155
- import * as Range from '../../types/range/module.f.mjs';
156
- import * as RangeMap from '../../types/range_map/module.f.mjs';
150
+ import * as _range from '../../types/range/module.f.mjs';
151
+ import * as range_map from '../../types/range_map/module.f.mjs';