functionalscript 0.7.0 → 0.8.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 (125) hide show
  1. package/LICENSE +21 -661
  2. package/README.md +3 -2
  3. package/bnf/data/module.f.d.ts +16 -6
  4. package/bnf/data/module.f.js +115 -23
  5. package/bnf/data/test.f.d.ts +4 -0
  6. package/bnf/data/test.f.js +389 -14
  7. package/bnf/module.f.d.ts +5 -4
  8. package/bnf/module.f.js +1 -1
  9. package/bnf/testlib.f.js +1 -1
  10. package/ci/module.f.d.ts +3 -0
  11. package/ci/module.f.js +169 -0
  12. package/ci/module.js +3 -0
  13. package/crypto/hmac/module.f.d.ts +5 -4
  14. package/crypto/hmac/module.f.js +9 -18
  15. package/crypto/hmac/test.f.d.ts +1 -0
  16. package/crypto/hmac/test.f.js +16 -8
  17. package/crypto/prime_field/module.f.d.ts +1 -1
  18. package/crypto/prime_field/module.f.js +4 -3
  19. package/crypto/prime_field/test.f.js +13 -13
  20. package/crypto/rfc6979/module.f.d.ts +15 -0
  21. package/crypto/rfc6979/module.f.js +98 -0
  22. package/crypto/rfc6979/test.f.d.ts +10 -0
  23. package/crypto/rfc6979/test.f.js +490 -0
  24. package/crypto/secp/module.f.d.ts +4 -4
  25. package/crypto/secp/module.f.js +1 -1
  26. package/crypto/secp/test.f.js +8 -8
  27. package/crypto/sha2/module.f.d.ts +11 -5
  28. package/crypto/sha2/module.f.js +4 -3
  29. package/crypto/sha2/test.f.d.ts +4 -1
  30. package/crypto/sha2/test.f.js +41 -31
  31. package/crypto/sign/module.f.d.ts +1 -1
  32. package/crypto/sign/module.f.js +3 -2
  33. package/dev/tf/all.test.js +9 -1
  34. package/djs/ast/module.f.d.ts +3 -3
  35. package/djs/ast/test.f.js +7 -8
  36. package/djs/parser/module.f.d.ts +3 -3
  37. package/djs/parser/module.f.js +4 -4
  38. package/djs/parser/test.f.js +76 -77
  39. package/djs/serializer/module.f.d.ts +8 -8
  40. package/djs/serializer/module.f.js +4 -7
  41. package/djs/serializer/test.f.js +8 -9
  42. package/djs/tokenizer/module.f.d.ts +2 -2
  43. package/djs/tokenizer/module.f.js +3 -5
  44. package/djs/tokenizer/test.f.js +8 -10
  45. package/djs/transpiler/module.f.d.ts +3 -3
  46. package/djs/transpiler/module.f.js +2 -0
  47. package/fsc/bnf.f.d.ts +1 -1
  48. package/fsc/bnf.f.js +39 -51
  49. package/fsc/json.f.d.ts +1 -1
  50. package/fsc/json.f.js +56 -81
  51. package/fsc/test.f.d.ts +5 -0
  52. package/fsc/test.f.js +69 -7
  53. package/fsm/module.f.js +3 -3
  54. package/fsm/test.f.js +21 -25
  55. package/html/module.f.js +17 -4
  56. package/html/test.f.d.ts +7 -0
  57. package/html/test.f.js +37 -0
  58. package/issues/031-json.f.d.ts +1 -0
  59. package/js/tokenizer/module.f.d.ts +4 -4
  60. package/js/tokenizer/module.f.js +12 -17
  61. package/js/tokenizer/test.f.js +9 -11
  62. package/json/module.f.d.ts +6 -6
  63. package/json/module.f.js +5 -10
  64. package/json/parser/module.f.d.ts +4 -4
  65. package/json/parser/module.f.js +7 -4
  66. package/json/parser/test.f.js +47 -49
  67. package/json/serializer/module.f.d.ts +6 -6
  68. package/json/serializer/module.f.js +3 -2
  69. package/json/serializer/test.f.js +13 -13
  70. package/json/test.f.js +13 -15
  71. package/json/tokenizer/module.f.d.ts +4 -4
  72. package/json/tokenizer/module.f.js +6 -7
  73. package/json/tokenizer/test.f.js +7 -9
  74. package/nanvm-lib/tests/vm/test.f.d.ts +25 -0
  75. package/nanvm-lib/tests/vm/test.f.js +105 -0
  76. package/package.json +8 -8
  77. package/text/ascii/test.f.js +2 -2
  78. package/text/module.f.d.ts +3 -2
  79. package/text/module.f.js +2 -2
  80. package/text/test.f.js +3 -3
  81. package/text/utf16/test.f.js +2 -2
  82. package/text/utf8/test.f.js +2 -2
  83. package/types/array/test.f.js +2 -2
  84. package/types/bigint/module.f.d.ts +6 -3
  85. package/types/bigint/module.f.js +12 -11
  86. package/types/bigint/test.f.d.ts +2 -0
  87. package/types/bigint/test.f.js +21 -2
  88. package/types/bit_vec/module.f.d.ts +66 -34
  89. package/types/bit_vec/module.f.js +97 -32
  90. package/types/bit_vec/test.f.d.ts +7 -0
  91. package/types/bit_vec/test.f.js +283 -62
  92. package/types/btree/find/test.f.js +9 -8
  93. package/types/btree/remove/test.f.js +4 -4
  94. package/types/btree/set/test.f.js +4 -4
  95. package/types/btree/test.f.js +7 -7
  96. package/types/byte_set/test.f.js +2 -2
  97. package/types/function/compare/module.f.d.ts +15 -1
  98. package/types/function/compare/module.f.js +1 -1
  99. package/types/function/compare/test.f.js +37 -4
  100. package/types/list/test.f.js +93 -93
  101. package/types/monoid/module.f.d.ts +4 -4
  102. package/types/monoid/module.f.js +3 -3
  103. package/types/monoid/test.f.js +3 -3
  104. package/types/nominal/module.f.d.ts +5 -0
  105. package/types/nominal/module.f.js +4 -0
  106. package/types/nominal/test.f.d.ts +5 -0
  107. package/types/nominal/test.f.js +53 -0
  108. package/types/number/module.f.js +2 -2
  109. package/types/range_map/test.f.js +21 -21
  110. package/types/sorted_list/test.f.js +10 -10
  111. package/types/sorted_set/test.f.js +14 -14
  112. package/types/string/module.f.js +2 -2
  113. package/types/string_set/module.f.js +3 -3
  114. package/bnf/djs/module.f.d.ts +0 -77
  115. package/bnf/djs/module.f.js +0 -207
  116. package/bnf/djs/test.f.d.ts +0 -8
  117. package/bnf/djs/test.f.js +0 -277
  118. package/bnf/func/module.f.d.ts +0 -148
  119. package/bnf/func/module.f.js +0 -132
  120. package/bnf/func/test.f.d.ts +0 -12
  121. package/bnf/func/test.f.js +0 -171
  122. package/bnf/func/testlib.f.d.ts +0 -25
  123. package/bnf/func/testlib.f.js +0 -150
  124. /package/{issues/31-json.f.d.ts → ci/module.d.ts} +0 -0
  125. /package/issues/{31-json.f.js → 031-json.f.js} +0 -0
package/html/test.f.d.ts CHANGED
@@ -5,5 +5,12 @@ declare const _default: {
5
5
  some: () => void;
6
6
  some2: () => void;
7
7
  someVoid: () => void;
8
+ raw: {
9
+ script: () => void;
10
+ scriptEsc: () => void;
11
+ style: () => void;
12
+ styleEsc: () => void;
13
+ noRaw: () => void;
14
+ };
8
15
  };
9
16
  export default _default;
package/html/test.f.js CHANGED
@@ -38,5 +38,42 @@ export default {
38
38
  if (s !== '<!DOCTYPE html><div><br id="5">&lt;div&gt;&amp;amp;&lt;/div&gt;<a href="hello&quot;"></a></div>') {
39
39
  throw s;
40
40
  }
41
+ },
42
+ raw: {
43
+ script: () => {
44
+ const x = ['script', { id: 'a<' }, 'const a = ', 'a<b>c'];
45
+ const s = htmlToString(x);
46
+ if (s !== '<!DOCTYPE html><script id="a&lt;">const a = a<b>c</script>') {
47
+ throw s;
48
+ }
49
+ },
50
+ scriptEsc: () => {
51
+ const x = ['script', { id: 'a<' }, '<', '/script>'];
52
+ const s = htmlToString(x);
53
+ if (s !== '<!DOCTYPE html><script id="a&lt;"><\\/script></script>') {
54
+ throw s;
55
+ }
56
+ },
57
+ style: () => {
58
+ const x = ['style', { id: 'a<' }, 'const a = ', 'a<b>c'];
59
+ const s = htmlToString(x);
60
+ if (s !== '<!DOCTYPE html><style id="a&lt;">const a = a<b>c</style>') {
61
+ throw s;
62
+ }
63
+ },
64
+ styleEsc: () => {
65
+ const x = ['style', { id: 'a<' }, '</', 'stYle>'];
66
+ const s = htmlToString(x);
67
+ if (s !== '<!DOCTYPE html><style id="a&lt;"><\\/stYle></style>') {
68
+ throw s;
69
+ }
70
+ },
71
+ noRaw: () => {
72
+ const x = ['div', { id: 'a<' }, 'const a = ', 'a<b>c'];
73
+ const s = htmlToString(x);
74
+ if (s !== '<!DOCTYPE html><div id="a&lt;">const a = a&lt;b&gt;c</div>') {
75
+ throw s;
76
+ }
77
+ },
41
78
  }
42
79
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
- import * as list from '../../types/list/module.f.ts';
2
- import type * as bigfloatT from '../../types/bigfloat/module.f.ts';
1
+ import { type List } from '../../types/list/module.f.ts';
2
+ import { type BigFloat } from '../../types/bigfloat/module.f.ts';
3
3
  export type StringToken = {
4
4
  readonly kind: 'string';
5
5
  readonly value: string;
@@ -7,7 +7,7 @@ export type StringToken = {
7
7
  export type NumberToken = {
8
8
  readonly kind: 'number';
9
9
  readonly value: string;
10
- readonly bf: bigfloatT.BigFloat;
10
+ readonly bf: BigFloat;
11
11
  };
12
12
  export type BigIntToken = {
13
13
  readonly kind: 'bigint';
@@ -94,5 +94,5 @@ export type JsTokenWithMetadata = {
94
94
  };
95
95
  type ErrorMessage = '" are missing' | 'unescaped character' | 'invalid hex value' | 'unexpected character' | 'invalid number' | 'invalid token' | '*\/ expected' | 'unterminated string literal' | 'eof';
96
96
  export declare const isKeywordToken: (token: JsToken) => boolean;
97
- export declare const tokenize: (input: list.List<number>) => (path: string) => list.List<JsTokenWithMetadata>;
97
+ export declare const tokenize: (input: List<number>) => (path: string) => List<JsTokenWithMetadata>;
98
98
  export {};
@@ -1,16 +1,10 @@
1
- import * as operator from "../../types/function/operator/module.f.js";
2
- import * as range_map from "../../types/range_map/module.f.js";
3
- const { merge, fromRange, get } = range_map;
4
- import * as list from "../../types/list/module.f.js";
5
- import * as map from "../../types/ordered_map/module.f.js";
6
- const { at } = map;
7
- import * as _range from "../../types/range/module.f.js";
8
- const { one } = _range;
9
- const { empty, stateScan, flat, toArray, reduce: listReduce, scan, map: listMap } = list;
10
- const { fromCharCode } = String;
11
- import * as ascii from "../../text/ascii/module.f.js";
12
- const { range } = ascii;
13
- const {
1
+ import { strictEqual } from "../../types/function/operator/module.f.js";
2
+ import { merge, fromRange, get } from "../../types/range_map/module.f.js";
3
+ import { empty, stateScan, flat, toArray, reduce as listReduce, scan, map as listMap } from "../../types/list/module.f.js";
4
+ import { at, fromEntries } from "../../types/ordered_map/module.f.js";
5
+ import { one } from "../../types/range/module.f.js";
6
+ import {} from "../../types/bigfloat/module.f.js";
7
+ import { range,
14
8
  //
15
9
  backspace, ht, lf, ff, cr,
16
10
  //
@@ -26,7 +20,8 @@ leftSquareBracket, reverseSolidus, rightSquareBracket, lowLine,
26
20
  //
27
21
  latinSmallLetterRange, latinSmallLetterA, latinSmallLetterB, latinSmallLetterE, latinSmallLetterF, latinSmallLetterN, latinSmallLetterR, latinSmallLetterT, latinSmallLetterU,
28
22
  //
29
- leftCurlyBracket, rightCurlyBracket, dollarSign } = ascii;
23
+ leftCurlyBracket, rightCurlyBracket, dollarSign } from "../../text/ascii/module.f.js";
24
+ const { fromCharCode } = String;
30
25
  const rangeOneNine = range('19');
31
26
  const rangeSetNewLine = [
32
27
  one(lf),
@@ -106,7 +101,7 @@ const union = def => a => b => {
106
101
  };
107
102
  const rangeMapMerge = def => merge({
108
103
  union: union(def),
109
- equal: operator.strictEqual,
104
+ equal: strictEqual,
110
105
  def,
111
106
  });
112
107
  const rangeFunc = r => f => def => fromRange(def)(r)(f);
@@ -194,7 +189,7 @@ const keywordEntries = [
194
189
  ['with', { kind: 'with' }],
195
190
  ['yield', { kind: 'yield' }],
196
191
  ];
197
- const keywordMap = map.fromEntries(keywordEntries);
192
+ const keywordMap = fromEntries(keywordEntries);
198
193
  export const isKeywordToken = token => at(token.kind)(keywordMap) !== null;
199
194
  /**
200
195
  * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators
@@ -256,7 +251,7 @@ const operatorEntries = [
256
251
  ['}', { kind: '}' }],
257
252
  ['~', { kind: '~' }]
258
253
  ];
259
- const operatorMap = map.fromEntries(operatorEntries);
254
+ const operatorMap = fromEntries(operatorEntries);
260
255
  const getOperatorToken = op => at(op)(operatorMap) ?? { kind: 'error', message: 'invalid token' };
261
256
  const hasOperatorToken = op => at(op)(operatorMap) !== null;
262
257
  const initialStateOp = create((state) => () => [[{ kind: 'error', message: 'unexpected character' }], state])([
@@ -1,14 +1,12 @@
1
- import * as tokenizer from "./module.f.js";
2
- import * as list from "../../types/list/module.f.js";
3
- const { toArray } = list;
4
- import * as serializer from "../../djs/serializer/module.f.js";
5
- import * as o from "../../types/object/module.f.js";
6
- const { sort } = o;
7
- import * as encoding from "../../text/utf16/module.f.js";
8
- const tokenizeString = s => toArray(list.map(withoutMetada)(tokenizer.tokenize(encoding.stringToList(s))('')));
9
- const tokenizeStringWithMetadata = s => toArray(tokenizer.tokenize(encoding.stringToList(s))(''));
10
- const stringify = serializer.stringifyAsTree(sort);
11
- const withoutMetada = tokenWithMetada => { return tokenWithMetada.token; };
1
+ import { tokenize } from "./module.f.js";
2
+ import { map, toArray } from "../../types/list/module.f.js";
3
+ import { stringifyAsTree } from "../../djs/serializer/module.f.js";
4
+ import { sort } from "../../types/object/module.f.js";
5
+ import { stringToList } from "../../text/utf16/module.f.js";
6
+ const tokenizeString = s => toArray(map(withoutMetada)(tokenize(stringToList(s))('')));
7
+ const tokenizeStringWithMetadata = s => toArray(tokenize(stringToList(s))(''));
8
+ const stringify = stringifyAsTree(sort);
9
+ const withoutMetada = tokenWithMetada => tokenWithMetada.token;
12
10
  export default {
13
11
  djs: [
14
12
  () => {
@@ -1,16 +1,16 @@
1
- import * as list from '../types/list/module.f.ts';
2
- import * as object from '../types/object/module.f.ts';
1
+ import { type List } from '../types/list/module.f.ts';
2
+ import { type Entry as ObjectEntry } from '../types/object/module.f.ts';
3
3
  type Object = {
4
4
  readonly [k in string]: Unknown;
5
5
  };
6
6
  type Array = readonly Unknown[];
7
7
  export type Primitive = boolean | string | number | null;
8
8
  export type Unknown = Primitive | Object | Array;
9
- export declare const setProperty: (value: Unknown) => (path: list.List<string>) => (src: Unknown) => Unknown;
10
- export type Entry = object.Entry<Unknown>;
11
- type Entries = list.List<Entry>;
9
+ export declare const setProperty: (value: Unknown) => (path: List<string>) => (src: Unknown) => Unknown;
10
+ export type Entry = ObjectEntry<Unknown>;
11
+ type Entries = List<Entry>;
12
12
  type MapEntries = (entries: Entries) => Entries;
13
- export declare const serialize: (mapEntries: MapEntries) => (value: Unknown) => list.List<string>;
13
+ export declare const serialize: (mapEntries: MapEntries) => (value: Unknown) => List<string>;
14
14
  /**
15
15
  * The standard `JSON.stringify` rules determined by
16
16
  * https://262.ecma-international.org/6.0/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys
package/json/module.f.js CHANGED
@@ -1,14 +1,9 @@
1
- import * as list from "../types/list/module.f.js";
2
- const { next, flat, map } = list;
3
- import * as string from "../types/string/module.f.js";
4
- const { concat } = string;
5
- import * as object from "../types/object/module.f.js";
6
- const { at } = object;
7
- import * as f from "../types/function/module.f.js";
8
- const { compose, fn } = f;
1
+ import { next, flat, map } from "../types/list/module.f.js";
2
+ import { concat } from "../types/string/module.f.js";
3
+ import { at } from "../types/object/module.f.js";
4
+ import { compose, fn } from "../types/function/module.f.js";
5
+ import { objectWrap, arrayWrap, stringSerialize, numberSerialize, nullSerialize, boolSerialize } from "./serializer/module.f.js";
9
6
  const { entries } = Object;
10
- import * as s from "./serializer/module.f.js";
11
- const { objectWrap, arrayWrap, stringSerialize, numberSerialize, nullSerialize, boolSerialize } = s;
12
7
  export const setProperty = value => {
13
8
  const f = path => src => {
14
9
  const result = next(path);
@@ -1,5 +1,5 @@
1
- import * as result from '../../types/result/module.f.ts';
1
+ import { type Result } from '../../types/result/module.f.ts';
2
2
  import { type List } from '../../types/list/module.f.ts';
3
- import type * as Tokenizer from '../tokenizer/module.f.ts';
4
- import type * as Json from '../module.f.ts';
5
- export declare const parse: (tokenList: List<Tokenizer.JsonToken>) => result.Result<Json.Unknown, string>;
3
+ import { type JsonToken } from '../tokenizer/module.f.ts';
4
+ import { type Unknown } from '../module.f.ts';
5
+ export declare const parse: (tokenList: List<JsonToken>) => Result<Unknown, string>;
@@ -1,6 +1,9 @@
1
- import * as result from "../../types/result/module.f.js";
1
+ import { error, ok } from "../../types/result/module.f.js";
2
2
  import { fold, first, drop, toArray, concat } from "../../types/list/module.f.js";
3
+ import {} from "../../types/function/operator/module.f.js";
4
+ import {} from "../tokenizer/module.f.js";
3
5
  import { setReplace } from "../../types/ordered_map/module.f.js";
6
+ import {} from "../module.f.js";
4
7
  import { fromMap } from "../../types/object/module.f.js";
5
8
  const addKeyToObject = obj => key => ({ kind: 'object', values: obj.values, key: key });
6
9
  const addValueToObject = obj => value => ({ kind: 'object', values: setReplace(obj.key)(value)(obj.values), key: '' });
@@ -151,8 +154,8 @@ const foldOp = token => state => {
151
154
  export const parse = tokenList => {
152
155
  const state = fold(foldOp)({ status: '', top: null, stack: null })(tokenList);
153
156
  switch (state.status) {
154
- case 'result': return result.ok(state.value);
155
- case 'error': return result.error(state.message);
156
- default: return result.error('unexpected end');
157
+ case 'result': return ok(state.value);
158
+ case 'error': return error(state.message);
159
+ default: return error('unexpected end');
157
160
  }
158
161
  };
@@ -1,18 +1,16 @@
1
- import * as parser from "./module.f.js";
2
- import * as tokenizer from "../tokenizer/module.f.js";
3
- import * as list from "../../types/list/module.f.js";
4
- const { toArray } = list;
5
- import * as json from "../module.f.js";
6
- import * as o from "../../types/object/module.f.js";
7
- const { sort } = o;
8
- import * as encoding from "../../text/utf16/module.f.js";
9
- const tokenizeString = s => toArray(tokenizer.tokenize(encoding.stringToList(s)));
10
- const stringify = json.stringify(sort);
1
+ import { parse } from "./module.f.js";
2
+ import { tokenize } from "../tokenizer/module.f.js";
3
+ import { toArray } from "../../types/list/module.f.js";
4
+ import { stringify as jsonStringify } from "../module.f.js";
5
+ import { sort } from "../../types/object/module.f.js";
6
+ import { stringToList } from "../../text/utf16/module.f.js";
7
+ const tokenizeString = s => toArray(tokenize(stringToList(s)));
8
+ const stringify = jsonStringify(sort);
11
9
  export default {
12
10
  valid: [
13
11
  () => {
14
12
  const tokenList = tokenizeString('null');
15
- const obj = parser.parse(tokenList);
13
+ const obj = parse(tokenList);
16
14
  const result = stringify(obj);
17
15
  if (result !== '["ok",null]') {
18
16
  throw result;
@@ -20,7 +18,7 @@ export default {
20
18
  },
21
19
  () => {
22
20
  const tokenList = tokenizeString('true');
23
- const obj = parser.parse(tokenList);
21
+ const obj = parse(tokenList);
24
22
  const result = stringify(obj);
25
23
  if (result !== '["ok",true]') {
26
24
  throw result;
@@ -28,7 +26,7 @@ export default {
28
26
  },
29
27
  () => {
30
28
  const tokenList = tokenizeString('false');
31
- const obj = parser.parse(tokenList);
29
+ const obj = parse(tokenList);
32
30
  const result = stringify(obj);
33
31
  if (result !== '["ok",false]') {
34
32
  throw result;
@@ -36,7 +34,7 @@ export default {
36
34
  },
37
35
  () => {
38
36
  const tokenList = tokenizeString('0.1');
39
- const obj = parser.parse(tokenList);
37
+ const obj = parse(tokenList);
40
38
  const result = stringify(obj);
41
39
  if (result !== '["ok",0.1]') {
42
40
  throw result;
@@ -44,7 +42,7 @@ export default {
44
42
  },
45
43
  () => {
46
44
  const tokenList = tokenizeString('1.1e+2');
47
- const obj = parser.parse(tokenList);
45
+ const obj = parse(tokenList);
48
46
  const result = stringify(obj);
49
47
  if (result !== '["ok",110]') {
50
48
  throw result;
@@ -52,7 +50,7 @@ export default {
52
50
  },
53
51
  () => {
54
52
  const tokenList = tokenizeString('"abc"');
55
- const obj = parser.parse(tokenList);
53
+ const obj = parse(tokenList);
56
54
  const result = stringify(obj);
57
55
  if (result !== '["ok","abc"]') {
58
56
  throw result;
@@ -60,7 +58,7 @@ export default {
60
58
  },
61
59
  () => {
62
60
  const tokenList = tokenizeString('[]');
63
- const obj = parser.parse(tokenList);
61
+ const obj = parse(tokenList);
64
62
  const result = stringify(obj);
65
63
  if (result !== '["ok",[]]') {
66
64
  throw result;
@@ -68,7 +66,7 @@ export default {
68
66
  },
69
67
  () => {
70
68
  const tokenList = tokenizeString('[1]');
71
- const obj = parser.parse(tokenList);
69
+ const obj = parse(tokenList);
72
70
  const result = stringify(obj);
73
71
  if (result !== '["ok",[1]]') {
74
72
  throw result;
@@ -76,7 +74,7 @@ export default {
76
74
  },
77
75
  () => {
78
76
  const tokenList = tokenizeString('[[]]');
79
- const obj = parser.parse(tokenList);
77
+ const obj = parse(tokenList);
80
78
  const result = stringify(obj);
81
79
  if (result !== '["ok",[[]]]') {
82
80
  throw result;
@@ -84,7 +82,7 @@ export default {
84
82
  },
85
83
  () => {
86
84
  const tokenList = tokenizeString('[0,[1,[2,[]]],3]');
87
- const obj = parser.parse(tokenList);
85
+ const obj = parse(tokenList);
88
86
  const result = stringify(obj);
89
87
  if (result !== '["ok",[0,[1,[2,[]]],3]]') {
90
88
  throw result;
@@ -92,7 +90,7 @@ export default {
92
90
  },
93
91
  () => {
94
92
  const tokenList = tokenizeString('{}');
95
- const obj = parser.parse(tokenList);
93
+ const obj = parse(tokenList);
96
94
  const result = stringify(obj);
97
95
  if (result !== '["ok",{}]') {
98
96
  throw result;
@@ -100,7 +98,7 @@ export default {
100
98
  },
101
99
  () => {
102
100
  const tokenList = tokenizeString('[{}]');
103
- const obj = parser.parse(tokenList);
101
+ const obj = parse(tokenList);
104
102
  const result = stringify(obj);
105
103
  if (result !== '["ok",[{}]]') {
106
104
  throw result;
@@ -108,7 +106,7 @@ export default {
108
106
  },
109
107
  () => {
110
108
  const tokenList = tokenizeString('{"a":true,"b":false,"c":null}');
111
- const obj = parser.parse(tokenList);
109
+ const obj = parse(tokenList);
112
110
  const result = stringify(obj);
113
111
  if (result !== '["ok",{"a":true,"b":false,"c":null}]') {
114
112
  throw result;
@@ -116,7 +114,7 @@ export default {
116
114
  },
117
115
  () => {
118
116
  const tokenList = tokenizeString('{"a":{"b":{"c":["d"]}}}');
119
- const obj = parser.parse(tokenList);
117
+ const obj = parse(tokenList);
120
118
  const result = stringify(obj);
121
119
  if (result !== '["ok",{"a":{"b":{"c":["d"]}}}]') {
122
120
  throw result;
@@ -124,7 +122,7 @@ export default {
124
122
  },
125
123
  () => {
126
124
  const tokenList = tokenizeString('[1,]');
127
- const obj = parser.parse(tokenList);
125
+ const obj = parse(tokenList);
128
126
  const result = stringify(obj);
129
127
  if (result !== '["ok",[1]]') {
130
128
  throw result;
@@ -132,7 +130,7 @@ export default {
132
130
  },
133
131
  () => {
134
132
  const tokenList = tokenizeString('{"a":1,}');
135
- const obj = parser.parse(tokenList);
133
+ const obj = parse(tokenList);
136
134
  const result = stringify(obj);
137
135
  if (result !== '["ok",{"a":1}]') {
138
136
  throw result;
@@ -142,7 +140,7 @@ export default {
142
140
  invalid: [
143
141
  () => {
144
142
  const tokenList = tokenizeString('');
145
- const obj = parser.parse(tokenList);
143
+ const obj = parse(tokenList);
146
144
  const result = stringify(obj);
147
145
  if (result !== '["error","unexpected end"]') {
148
146
  throw result;
@@ -150,7 +148,7 @@ export default {
150
148
  },
151
149
  () => {
152
150
  const tokenList = tokenizeString('"123');
153
- const obj = parser.parse(tokenList);
151
+ const obj = parse(tokenList);
154
152
  const result = stringify(obj);
155
153
  if (result !== '["error","unexpected token"]') {
156
154
  throw result;
@@ -158,7 +156,7 @@ export default {
158
156
  },
159
157
  () => {
160
158
  const tokenList = tokenizeString('[,]');
161
- const obj = parser.parse(tokenList);
159
+ const obj = parse(tokenList);
162
160
  const result = stringify(obj);
163
161
  if (result !== '["error","unexpected token"]') {
164
162
  throw result;
@@ -166,7 +164,7 @@ export default {
166
164
  },
167
165
  () => {
168
166
  const tokenList = tokenizeString('[1 2]');
169
- const obj = parser.parse(tokenList);
167
+ const obj = parse(tokenList);
170
168
  const result = stringify(obj);
171
169
  if (result !== '["error","unexpected token"]') {
172
170
  throw result;
@@ -174,7 +172,7 @@ export default {
174
172
  },
175
173
  () => {
176
174
  const tokenList = tokenizeString('[1,,2]');
177
- const obj = parser.parse(tokenList);
175
+ const obj = parse(tokenList);
178
176
  const result = stringify(obj);
179
177
  if (result !== '["error","unexpected token"]') {
180
178
  throw result;
@@ -182,7 +180,7 @@ export default {
182
180
  },
183
181
  () => {
184
182
  const tokenList = tokenizeString('[]]');
185
- const obj = parser.parse(tokenList);
183
+ const obj = parse(tokenList);
186
184
  const result = stringify(obj);
187
185
  if (result !== '["error","unexpected token"]') {
188
186
  throw result;
@@ -190,7 +188,7 @@ export default {
190
188
  },
191
189
  () => {
192
190
  const tokenList = tokenizeString('["a"');
193
- const obj = parser.parse(tokenList);
191
+ const obj = parse(tokenList);
194
192
  const result = stringify(obj);
195
193
  if (result !== '["error","unexpected end"]') {
196
194
  throw result;
@@ -198,7 +196,7 @@ export default {
198
196
  },
199
197
  () => {
200
198
  const tokenList = tokenizeString('[,1]');
201
- const obj = parser.parse(tokenList);
199
+ const obj = parse(tokenList);
202
200
  const result = stringify(obj);
203
201
  if (result !== '["error","unexpected token"]') {
204
202
  throw result;
@@ -206,7 +204,7 @@ export default {
206
204
  },
207
205
  () => {
208
206
  const tokenList = tokenizeString('[:]');
209
- const obj = parser.parse(tokenList);
207
+ const obj = parse(tokenList);
210
208
  const result = stringify(obj);
211
209
  if (result !== '["error","unexpected token"]') {
212
210
  throw result;
@@ -214,7 +212,7 @@ export default {
214
212
  },
215
213
  () => {
216
214
  const tokenList = tokenizeString(']');
217
- const obj = parser.parse(tokenList);
215
+ const obj = parse(tokenList);
218
216
  const result = stringify(obj);
219
217
  if (result !== '["error","unexpected token"]') {
220
218
  throw result;
@@ -222,7 +220,7 @@ export default {
222
220
  },
223
221
  () => {
224
222
  const tokenList = tokenizeString('{,}');
225
- const obj = parser.parse(tokenList);
223
+ const obj = parse(tokenList);
226
224
  const result = stringify(obj);
227
225
  if (result !== '["error","unexpected token"]') {
228
226
  throw result;
@@ -230,7 +228,7 @@ export default {
230
228
  },
231
229
  () => {
232
230
  const tokenList = tokenizeString('{1:2}');
233
- const obj = parser.parse(tokenList);
231
+ const obj = parse(tokenList);
234
232
  const result = stringify(obj);
235
233
  if (result !== '["error","unexpected token"]') {
236
234
  throw result;
@@ -238,7 +236,7 @@ export default {
238
236
  },
239
237
  () => {
240
238
  const tokenList = tokenizeString('{"1"2}');
241
- const obj = parser.parse(tokenList);
239
+ const obj = parse(tokenList);
242
240
  const result = stringify(obj);
243
241
  if (result !== '["error","unexpected token"]') {
244
242
  throw result;
@@ -246,7 +244,7 @@ export default {
246
244
  },
247
245
  () => {
248
246
  const tokenList = tokenizeString('{"1"::2}');
249
- const obj = parser.parse(tokenList);
247
+ const obj = parse(tokenList);
250
248
  const result = stringify(obj);
251
249
  if (result !== '["error","unexpected token"]') {
252
250
  throw result;
@@ -254,7 +252,7 @@ export default {
254
252
  },
255
253
  () => {
256
254
  const tokenList = tokenizeString('{"1":2,,"3":4');
257
- const obj = parser.parse(tokenList);
255
+ const obj = parse(tokenList);
258
256
  const result = stringify(obj);
259
257
  if (result !== '["error","unexpected token"]') {
260
258
  throw result;
@@ -262,7 +260,7 @@ export default {
262
260
  },
263
261
  () => {
264
262
  const tokenList = tokenizeString('{}}');
265
- const obj = parser.parse(tokenList);
263
+ const obj = parse(tokenList);
266
264
  const result = stringify(obj);
267
265
  if (result !== '["error","unexpected token"]') {
268
266
  throw result;
@@ -270,7 +268,7 @@ export default {
270
268
  },
271
269
  () => {
272
270
  const tokenList = tokenizeString('{"1":2');
273
- const obj = parser.parse(tokenList);
271
+ const obj = parse(tokenList);
274
272
  const result = stringify(obj);
275
273
  if (result !== '["error","unexpected end"]') {
276
274
  throw result;
@@ -278,7 +276,7 @@ export default {
278
276
  },
279
277
  () => {
280
278
  const tokenList = tokenizeString('{,"1":2}');
281
- const obj = parser.parse(tokenList);
279
+ const obj = parse(tokenList);
282
280
  const result = stringify(obj);
283
281
  if (result !== '["error","unexpected token"]') {
284
282
  throw result;
@@ -286,7 +284,7 @@ export default {
286
284
  },
287
285
  () => {
288
286
  const tokenList = tokenizeString('}');
289
- const obj = parser.parse(tokenList);
287
+ const obj = parse(tokenList);
290
288
  const result = stringify(obj);
291
289
  if (result !== '["error","unexpected token"]') {
292
290
  throw result;
@@ -294,7 +292,7 @@ export default {
294
292
  },
295
293
  () => {
296
294
  const tokenList = tokenizeString('[{]}');
297
- const obj = parser.parse(tokenList);
295
+ const obj = parse(tokenList);
298
296
  const result = stringify(obj);
299
297
  if (result !== '["error","unexpected token"]') {
300
298
  throw result;
@@ -302,7 +300,7 @@ export default {
302
300
  },
303
301
  () => {
304
302
  const tokenList = tokenizeString('{[}]');
305
- const obj = parser.parse(tokenList);
303
+ const obj = parse(tokenList);
306
304
  const result = stringify(obj);
307
305
  if (result !== '["error","unexpected token"]') {
308
306
  throw result;
@@ -310,7 +308,7 @@ export default {
310
308
  },
311
309
  () => {
312
310
  const tokenList = tokenizeString('10-5');
313
- const obj = parser.parse(tokenList);
311
+ const obj = parse(tokenList);
314
312
  const result = stringify(obj);
315
313
  if (result !== '["error","unexpected token"]') {
316
314
  throw result;
@@ -318,7 +316,7 @@ export default {
318
316
  },
319
317
  () => {
320
318
  const tokenList = tokenizeString('undefined');
321
- const obj = parser.parse(tokenList);
319
+ const obj = parse(tokenList);
322
320
  const result = stringify(obj);
323
321
  if (result !== '["error","unexpected token"]') {
324
322
  throw result;
@@ -1,7 +1,7 @@
1
- import * as list from '../../types/list/module.f.ts';
2
- export declare const stringSerialize: (_: string) => list.List<string>;
3
- export declare const numberSerialize: (_: number) => list.List<string>;
1
+ import { type List } from '../../types/list/module.f.ts';
2
+ export declare const stringSerialize: (_: string) => List<string>;
3
+ export declare const numberSerialize: (_: number) => List<string>;
4
4
  export declare const nullSerialize: string[];
5
- export declare const boolSerialize: (_: boolean) => list.List<string>;
6
- export declare const objectWrap: (input: list.List<list.List<string>>) => list.List<string>;
7
- export declare const arrayWrap: (input: list.List<list.List<string>>) => list.List<string>;
5
+ export declare const boolSerialize: (_: boolean) => List<string>;
6
+ export declare const objectWrap: (input: List<List<string>>) => List<string>;
7
+ export declare const arrayWrap: (input: List<List<string>>) => List<string>;
@@ -1,5 +1,6 @@
1
- import * as list from "../../types/list/module.f.js";
2
- const { flat, reduce, empty } = list;
1
+ import { flat, reduce, empty } from "../../types/list/module.f.js";
2
+ import {} from "../../types/object/module.f.js";
3
+ import {} from "../../types/function/operator/module.f.js";
3
4
  const jsonStringify = JSON.stringify;
4
5
  export const stringSerialize = input => [jsonStringify(input)];
5
6
  export const numberSerialize = input => [jsonStringify(input)];