@tabnas/transduce 0.1.2 → 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 (83) hide show
  1. package/README.md +18 -0
  2. package/dist/guard.d.ts +1 -3
  3. package/dist/guard.js +8 -9
  4. package/dist/guard.js.map +1 -1
  5. package/dist/lines.d.ts +1 -2
  6. package/dist/lines.js +46 -89
  7. package/dist/lines.js.map +1 -1
  8. package/dist/matcher.d.ts +1 -3
  9. package/dist/matcher.js +12 -13
  10. package/dist/matcher.js.map +1 -1
  11. package/dist/parser-source.d.ts +1 -2
  12. package/dist/parser-source.js +11 -13
  13. package/dist/parser-source.js.map +1 -1
  14. package/dist/route.d.ts +1 -32
  15. package/dist/route.js +8 -32
  16. package/dist/route.js.map +1 -1
  17. package/dist/routers.d.ts +2 -0
  18. package/dist/routers.js +24 -0
  19. package/dist/routers.js.map +1 -0
  20. package/dist/rule-events.d.ts +1 -4
  21. package/dist/rule-events.js +40 -44
  22. package/dist/rule-events.js.map +1 -1
  23. package/dist/scan.d.ts +1 -10
  24. package/dist/scan.js +4 -17
  25. package/dist/scan.js.map +1 -1
  26. package/dist/source.d.ts +1 -4
  27. package/dist/source.js +20 -22
  28. package/dist/source.js.map +1 -1
  29. package/dist/table-from-json.d.ts +1 -5
  30. package/dist/table-from-json.js +25 -29
  31. package/dist/table-from-json.js.map +1 -1
  32. package/dist/transduce.d.ts +23 -19
  33. package/dist/transduce.js +66 -56
  34. package/dist/transduce.js.map +1 -1
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +12 -4
  37. package/src/guard.ts +10 -4
  38. package/src/lines.ts +45 -6
  39. package/src/matcher.ts +1 -6
  40. package/src/parser-source.ts +2 -4
  41. package/src/route.ts +18 -70
  42. package/src/routers.ts +64 -0
  43. package/src/rule-events.ts +17 -7
  44. package/src/scan.ts +1 -19
  45. package/src/source.ts +12 -6
  46. package/src/table-from-json.ts +20 -9
  47. package/src/transduce.ts +36 -19
  48. package/dist/datum.d.ts +0 -64
  49. package/dist/datum.js +0 -391
  50. package/dist/datum.js.map +0 -1
  51. package/dist/error.d.ts +0 -43
  52. package/dist/error.js +0 -169
  53. package/dist/error.js.map +0 -1
  54. package/dist/event.d.ts +0 -56
  55. package/dist/event.js +0 -101
  56. package/dist/event.js.map +0 -1
  57. package/dist/json.d.ts +0 -4
  58. package/dist/json.js +0 -92
  59. package/dist/json.js.map +0 -1
  60. package/dist/limits.d.ts +0 -36
  61. package/dist/limits.js +0 -133
  62. package/dist/limits.js.map +0 -1
  63. package/dist/selector.d.ts +0 -40
  64. package/dist/selector.js +0 -154
  65. package/dist/selector.js.map +0 -1
  66. package/dist/sink.d.ts +0 -29
  67. package/dist/sink.js +0 -184
  68. package/dist/sink.js.map +0 -1
  69. package/dist/table.d.ts +0 -81
  70. package/dist/table.js +0 -141
  71. package/dist/table.js.map +0 -1
  72. package/dist/value.d.ts +0 -16
  73. package/dist/value.js +0 -96
  74. package/dist/value.js.map +0 -1
  75. package/src/datum.ts +0 -407
  76. package/src/error.ts +0 -198
  77. package/src/event.ts +0 -134
  78. package/src/json.ts +0 -82
  79. package/src/limits.ts +0 -165
  80. package/src/selector.ts +0 -191
  81. package/src/sink.ts +0 -199
  82. package/src/table.ts +0 -213
  83. package/src/value.ts +0 -93
package/dist/sink.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import { JsonEvent } from './event';
2
- export type Flow = 'continue' | 'stop';
3
- export interface Sink {
4
- event(ev: JsonEvent): Flow;
5
- }
6
- export declare class EventRecorder implements Sink {
7
- readonly events: JsonEvent[];
8
- event(ev: JsonEvent): Flow;
9
- }
10
- export declare class FnSink implements Sink {
11
- private fn;
12
- constructor(fn: (ev: JsonEvent) => Flow | void);
13
- event(ev: JsonEvent): Flow;
14
- }
15
- export declare class CountSink implements Sink {
16
- events: number;
17
- event(_ev: JsonEvent): Flow;
18
- }
19
- export declare function replay(events: Iterable<JsonEvent>, sink: Sink): Flow;
20
- export declare class TreeContract<S extends Sink> implements Sink {
21
- readonly inner: S;
22
- private open;
23
- private rootDone;
24
- constructor(inner: S);
25
- private path;
26
- private notATree;
27
- private closed;
28
- event(ev: JsonEvent): Flow;
29
- }
package/dist/sink.js DELETED
@@ -1,184 +0,0 @@
1
- "use strict";
2
- /* Copyright (c) 2026 tabnas, MIT License */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TreeContract = exports.CountSink = exports.FnSink = exports.EventRecorder = void 0;
5
- exports.replay = replay;
6
- // The push boundary between stages.
7
- //
8
- // A pipeline is a chain of sinks. The source calls the first sink once per
9
- // event, synchronously, inside the parse; each stage does its work and
10
- // calls the next. Nothing is queued between stages, so a slow writer at the
11
- // end slows the parser at the start: that is the backpressure, and it
12
- // costs no buffer. A stage that must stop early (a `take`) answers
13
- // `'stop'`, which the source turns into a cancelled parse. A stage that
14
- // fails throws a `Fail`; the source stops the parse and the failure
15
- // reaches the caller unchanged.
16
- const error_1 = require("./error");
17
- const selector_1 = require("./selector");
18
- // A sink that records every event, for tests and small results.
19
- class EventRecorder {
20
- constructor() {
21
- this.events = [];
22
- }
23
- event(ev) {
24
- this.events.push(ev);
25
- return 'continue';
26
- }
27
- }
28
- exports.EventRecorder = EventRecorder;
29
- // A sink made of a function. A function that returns nothing continues.
30
- class FnSink {
31
- constructor(fn) {
32
- this.fn = fn;
33
- }
34
- event(ev) {
35
- return this.fn(ev) || 'continue';
36
- }
37
- }
38
- exports.FnSink = FnSink;
39
- // A sink that counts events and drops them: the cheapest consumer, for
40
- // measuring a source on its own.
41
- class CountSink {
42
- constructor() {
43
- this.events = 0;
44
- }
45
- event(_ev) {
46
- this.events++;
47
- return 'continue';
48
- }
49
- }
50
- exports.CountSink = CountSink;
51
- // Replay a recording into a sink, stopping where the sink stops.
52
- function replay(events, sink) {
53
- for (const ev of events) {
54
- if ('stop' === sink.event(ev))
55
- return 'stop';
56
- }
57
- return 'continue';
58
- }
59
- // A tree's events, held to their contract in front of a sink that takes
60
- // them as one (a render that writes a document from them): one root value,
61
- // and in each object a key and then its value, each key once. A value
62
- // walked from a parsed tree keeps it by construction. A parse streamed as
63
- // it proceeds may not: it hands on a member its grammar reads twice
64
- // (JSON's `{"a":1,"a":2}`, whose value keeps the last) where a tree has
65
- // one, and the rule-event adapter refuses most shapes it cannot follow but
66
- // not every one a grammar can produce. A repeated key in one object is
67
- // refused with `DUPLICATE_MEMBER`, and events no tree has (a value where a
68
- // key is due, a key outside an object, a close with nothing open, a second
69
- // root) with `STREAMABILITY_UNKNOWN`, each at the path of the object
70
- // concerned; the event is not passed on. Each open object keeps the keys
71
- // it has had, dropped when it closes.
72
- class TreeContract {
73
- constructor(inner) {
74
- this.open = [];
75
- this.rootDone = false;
76
- this.inner = inner;
77
- }
78
- // The path of the value due next: the open containers, each by the member
79
- // or element open in it, and in the innermost object its last key when
80
- // that member's value is due.
81
- path() {
82
- const segments = [];
83
- const last = this.open.length - 1;
84
- this.open.forEach((open, i) => {
85
- if (open.array) {
86
- segments.push(open.next);
87
- }
88
- else if ((i !== last || !open.keyDue) && null != open.last) {
89
- // A container open inside this object is its last key's value,
90
- // whatever `keyDue` says: the member was counted as taken when its
91
- // value opened.
92
- segments.push(open.last);
93
- }
94
- });
95
- return new selector_1.Path(segments);
96
- }
97
- notATree(what) {
98
- return new error_1.Fail('STREAMABILITY_UNKNOWN', `the stream holds ${what}, which a tree's events never do, so it is not a tree's`).atPath(this.path().toString());
99
- }
100
- // A value is complete: the next in its array is due, or the root is.
101
- closed() {
102
- const top = this.open[this.open.length - 1];
103
- if (undefined === top)
104
- this.rootDone = true;
105
- else if (top.array)
106
- top.next++;
107
- }
108
- event(ev) {
109
- const top = this.open[this.open.length - 1];
110
- switch (ev.type) {
111
- case 'key': {
112
- if (undefined !== top && !top.array && top.keyDue) {
113
- if (top.keys.has(ev.key)) {
114
- const path = this.path();
115
- path.push(ev.key);
116
- throw new error_1.Fail('DUPLICATE_MEMBER', `member ${JSON.stringify(ev.key)} appears twice in one object, and a tree's ` +
117
- `events hold each key once`).atPath(path.toString());
118
- }
119
- top.keys.add(ev.key);
120
- top.last = ev.key;
121
- top.keyDue = false;
122
- }
123
- else if (undefined !== top && !top.array) {
124
- throw this.notATree('a key where a value is due');
125
- }
126
- else {
127
- throw this.notATree('a key outside an object');
128
- }
129
- break;
130
- }
131
- case 'object_end':
132
- if (undefined !== top && !top.array && top.keyDue) {
133
- this.open.pop();
134
- this.closed();
135
- }
136
- else if (undefined !== top && !top.array) {
137
- throw this.notATree("an object's end where a value is due");
138
- }
139
- else {
140
- throw this.notATree("an object's end where none is due");
141
- }
142
- break;
143
- case 'array_end':
144
- if (undefined !== top && top.array) {
145
- this.open.pop();
146
- this.closed();
147
- }
148
- else {
149
- throw this.notATree("an array's end where none is due");
150
- }
151
- break;
152
- case 'end':
153
- if (0 < this.open.length) {
154
- throw this.notATree('its end inside an open container');
155
- }
156
- break;
157
- default: {
158
- // A value: in an object, only once its key is in; at the root,
159
- // only once.
160
- if (undefined === top) {
161
- if (this.rootDone)
162
- throw this.notATree('a second root value');
163
- }
164
- else if (!top.array) {
165
- if (top.keyDue)
166
- throw this.notATree('a value where a key is due');
167
- top.keyDue = true;
168
- }
169
- if ('object_start' === ev.type) {
170
- this.open.push({ array: false, keys: new Set(), last: null, keyDue: true });
171
- }
172
- else if ('array_start' === ev.type) {
173
- this.open.push({ array: true, next: 0 });
174
- }
175
- else {
176
- this.closed();
177
- }
178
- }
179
- }
180
- return this.inner.event(ev);
181
- }
182
- }
183
- exports.TreeContract = TreeContract;
184
- //# sourceMappingURL=sink.js.map
package/dist/sink.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sink.js","sourceRoot":"","sources":["../src/sink.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;;AAE5C,oCAAoC;AACpC,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,4EAA4E;AAC5E,sEAAsE;AACtE,mEAAmE;AACnE,wEAAwE;AACxE,oEAAoE;AACpE,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EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;gBAC7E,CAAC;qBAAM,IAAI,aAAa,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;oBACrC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;gBAC1C,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,EAAE,CAAA;gBACf,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;CACF"}
package/dist/table.d.ts DELETED
@@ -1,81 +0,0 @@
1
- import { Datum } from './datum';
2
- import { Segment, Selector } from './selector';
3
- import { Flow } from './sink';
4
- export type Cell = {
5
- readonly type: 'null';
6
- } | {
7
- readonly type: 'bool';
8
- readonly value: boolean;
9
- } | {
10
- readonly type: 'number';
11
- readonly value: number;
12
- readonly lexeme: string | null;
13
- } | {
14
- readonly type: 'string';
15
- readonly value: string;
16
- } | {
17
- readonly type: 'missing';
18
- };
19
- export declare const Cell: Readonly<{
20
- null: {
21
- readonly type: 'null';
22
- };
23
- missing: {
24
- readonly type: 'missing';
25
- };
26
- bool(value: boolean): Cell;
27
- number(value: number, lexeme?: string | null): Cell;
28
- string(value: string): Cell;
29
- fromDatum(d: Datum): Cell;
30
- byteSize(c: Cell): number;
31
- toText(c: Cell): string;
32
- }>;
33
- export type PublicColumn = {
34
- label: string;
35
- };
36
- export type TableEvent = {
37
- readonly type: 'schema';
38
- readonly columns: readonly PublicColumn[];
39
- } | {
40
- readonly type: 'row';
41
- readonly cells: readonly Cell[];
42
- } | {
43
- readonly type: 'end';
44
- };
45
- export interface TableSink {
46
- tableEvent(ev: TableEvent): Flow;
47
- }
48
- export declare class Table implements TableSink {
49
- columns: PublicColumn[];
50
- rows: Cell[][];
51
- ended: boolean;
52
- tableEvent(ev: TableEvent): Flow;
53
- }
54
- export type MissingPolicy = 'missing' | 'null' | 'error';
55
- export type BoundColumn = {
56
- label: string;
57
- source: Segment[];
58
- missing: MissingPolicy;
59
- };
60
- export declare function boundColumn(label: string, source: Segment[], missing?: MissingPolicy): BoundColumn;
61
- export type ColumnMapper = (meta: Datum) => BoundColumn;
62
- export type Schema = {
63
- type: 'static';
64
- columns: BoundColumn[];
65
- } | {
66
- type: 'metadata';
67
- columns: Selector;
68
- column: ColumnMapper;
69
- } | {
70
- type: 'infer';
71
- };
72
- export declare const Schema: Readonly<{
73
- static(columns: BoundColumn[]): Schema;
74
- fromMetadata(columns: Selector, column?: ColumnMapper): Schema;
75
- infer(): Schema;
76
- }>;
77
- export type TableBinding = {
78
- schema: Schema;
79
- rows: Selector;
80
- };
81
- export declare function columnFromMeta(meta: Datum): BoundColumn;
package/dist/table.js DELETED
@@ -1,141 +0,0 @@
1
- "use strict";
2
- /* Copyright (c) 2026 tabnas, MIT License */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Schema = exports.Table = exports.Cell = void 0;
5
- exports.boundColumn = boundColumn;
6
- exports.columnFromMeta = columnFromMeta;
7
- // `TableRows/1`: one schema, ordered finite rows, completion.
8
- //
9
- // The protocol is flat and budgeted: a row is a finite vector of cells,
10
- // already projected into schema order by the transducer, and a renderer
11
- // never sees a source path. Public columns carry a label; the source
12
- // binding (`BoundColumn`) stays on the transducer's side of the boundary.
13
- const datum_1 = require("./datum");
14
- const error_1 = require("./error");
15
- const json_1 = require("./json");
16
- const limits_1 = require("./limits");
17
- const NULL = Object.freeze({ type: 'null' });
18
- const MISSING = Object.freeze({ type: 'missing' });
19
- exports.Cell = Object.freeze({
20
- null: NULL,
21
- missing: MISSING,
22
- bool(value) {
23
- return { type: 'bool', value };
24
- },
25
- number(value, lexeme) {
26
- return { type: 'number', value, lexeme: lexeme ?? null };
27
- },
28
- string(value) {
29
- return { type: 'string', value };
30
- },
31
- // From a retained value. A container is not a cell; it is serialized as
32
- // compact JSON text, the lossy but unambiguous choice the standard
33
- // binding makes and documents.
34
- fromDatum(d) {
35
- switch (d.type) {
36
- case 'null':
37
- return NULL;
38
- case 'bool':
39
- return { type: 'bool', value: d.value };
40
- case 'number':
41
- return { type: 'number', value: d.value, lexeme: d.lexeme };
42
- case 'string':
43
- return { type: 'string', value: d.value };
44
- default:
45
- return { type: 'string', value: (0, datum_1.toText)(d) };
46
- }
47
- },
48
- // The bytes this cell retains, on the same basis as a datum's size.
49
- byteSize(c) {
50
- switch (c.type) {
51
- case 'number':
52
- return limits_1.NODE_BYTES + (null != c.lexeme ? (0, limits_1.utf8Bytes)(c.lexeme) : 8);
53
- case 'string':
54
- return limits_1.NODE_BYTES + (0, limits_1.utf8Bytes)(c.value);
55
- default:
56
- return limits_1.NODE_BYTES;
57
- }
58
- },
59
- // The cell as JSON text; `missing` prints as `missing`.
60
- toText(c) {
61
- switch (c.type) {
62
- case 'null':
63
- return 'null';
64
- case 'bool':
65
- return String(c.value);
66
- case 'number':
67
- return (0, json_1.jsonNumber)(c.value, c.lexeme);
68
- case 'string':
69
- return (0, json_1.jsonString)(c.value);
70
- case 'missing':
71
- return 'missing';
72
- }
73
- },
74
- });
75
- // An owned recording of a table, for tests and small results.
76
- class Table {
77
- constructor() {
78
- this.columns = [];
79
- this.rows = [];
80
- this.ended = false;
81
- }
82
- tableEvent(ev) {
83
- switch (ev.type) {
84
- case 'schema':
85
- this.columns = ev.columns.slice();
86
- break;
87
- case 'row':
88
- this.rows.push(ev.cells.slice());
89
- break;
90
- case 'end':
91
- this.ended = true;
92
- break;
93
- }
94
- return 'continue';
95
- }
96
- }
97
- exports.Table = Table;
98
- function boundColumn(label, source, missing = 'missing') {
99
- return { label, source, missing };
100
- }
101
- exports.Schema = Object.freeze({
102
- static(columns) {
103
- return { type: 'static', columns };
104
- },
105
- fromMetadata(columns, column = columnFromMeta) {
106
- return { type: 'metadata', columns, column };
107
- },
108
- infer() {
109
- return { type: 'infer' };
110
- },
111
- });
112
- // The standard mapping from a metadata descriptor to a column: the spec's
113
- // `column-from-meta`, reading `title` and a `path` of segments.
114
- function columnFromMeta(meta) {
115
- if ('object' !== meta.type) {
116
- throw error_1.Fail.input('a column descriptor is not an object');
117
- }
118
- const title = meta.members.get('title');
119
- if (undefined === title || 'string' !== title.type) {
120
- throw error_1.Fail.input('a column descriptor has no string "title"');
121
- }
122
- const label = title.value;
123
- const path = meta.members.get('path');
124
- if (undefined === path || 'array' !== path.type) {
125
- throw error_1.Fail.input(`column ${JSON.stringify(label)} has no "path" array`);
126
- }
127
- const source = path.items.map((seg) => {
128
- if ('string' === seg.type)
129
- return seg.value;
130
- if ('number' === seg.type &&
131
- seg.value >= 0 &&
132
- Number.isInteger(seg.value) &&
133
- seg.value <= 0xffffffff) {
134
- return seg.value;
135
- }
136
- throw error_1.Fail.input(`column ${JSON.stringify(label)} has a path segment that is neither a string nor a ` +
137
- `non-negative integer: ${(0, datum_1.toText)(seg)}`);
138
- });
139
- return boundColumn(label, source);
140
- }
141
- //# sourceMappingURL=table.js.map
package/dist/table.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"table.js","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;;;AAE5C,8DAA8D;AAC9D,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,qEAAqE;AACrE,0EAA0E;AAE1E,mCAAuC;AACvC,mCAA8B;AAC9B,iCAA+C;AAC/C,qCAAgD;AAchD,MAAM,IAAI,GAAS,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAClD,MAAM,OAAO,GAAS,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAE3C,QAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAChB,IAAI,CAAC,KAAc;QACjB,OAAO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AAE,OAAO,GAAG,CAAC,KAAK,CAAA;QAC3C,IACE,QAAQ,KAAK,GAAG,CAAC,IAAI;YACrB,GAAG,CAAC,KAAK,IAAI,CAAC;YACd,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;YAC3B,GAAG,CAAC,KAAK,IAAI,UAAU,EACvB,CAAC;YACD,OAAO,GAAG,CAAC,KAAK,CAAA;QAClB,CAAC;QACD,MAAM,YAAI,CAAC,KAAK,CACd,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,qDAAqD;YAClF,yBAAyB,IAAA,cAAM,EAAC,GAAG,CAAC,EAAE,CACzC,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AACnC,CAAC"}
package/dist/value.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export type EngineScalar = {
2
- type: 'null';
3
- } | {
4
- type: 'bool';
5
- value: boolean;
6
- } | {
7
- type: 'number';
8
- value: number;
9
- } | {
10
- type: 'string';
11
- value: string;
12
- };
13
- export declare function engineScalar(v: unknown): EngineScalar | undefined;
14
- export declare function isEngineContainer(v: unknown): boolean;
15
- export declare function isEngineMap(v: unknown): v is Record<string, unknown>;
16
- export declare function engineKeys(v: unknown): string[];
package/dist/value.js DELETED
@@ -1,96 +0,0 @@
1
- "use strict";
2
- /* Copyright (c) 2026 tabnas, MIT License */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.engineScalar = engineScalar;
5
- exports.isEngineContainer = isEngineContainer;
6
- exports.isEngineMap = isEngineMap;
7
- exports.engineKeys = engineKeys;
8
- // Reading the engine's values: what a tabnas parse returns in TypeScript.
9
- //
10
- // The engine builds plain JavaScript values: `null` and `undefined`,
11
- // booleans, numbers, strings, arrays and objects. A few grammars hand over
12
- // host types, which read as the scalars they stand for: a boxed `String`
13
- // (the engine's text annotation), a `BigInt`, and a TOML `Date`, which
14
- // reads as the source text it carries (`__toml__.src`), as the Rust
15
- // runtime's date does.
16
- //
17
- // An object's member order is its insertion order. A plain object
18
- // enumerates integer-like keys first whatever order they were written in,
19
- // so the engine records the order on the node under `map.ordered` (read
20
- // with `KEY_ORDER`); the sources switch that on, and `engineKeys` reads
21
- // it, falling back to `Object.keys`.
22
- // The engine's key-order side channel (`keyOrder` in @tabnas/parser).
23
- const KEY_ORDER = Symbol.for('tabnas.keyOrder');
24
- const NULL = { type: 'null' };
25
- // The value as a scalar, or `undefined` when it is a container.
26
- function engineScalar(v) {
27
- switch (typeof v) {
28
- case 'undefined':
29
- return NULL;
30
- case 'boolean':
31
- return { type: 'bool', value: v };
32
- case 'number':
33
- return { type: 'number', value: v };
34
- case 'bigint':
35
- return { type: 'number', value: Number(v) };
36
- case 'string':
37
- return { type: 'string', value: v };
38
- case 'object':
39
- if (null === v)
40
- return NULL;
41
- if (Array.isArray(v))
42
- return undefined;
43
- if (v instanceof String)
44
- return { type: 'string', value: v.valueOf() };
45
- if (v instanceof Number)
46
- return { type: 'number', value: v.valueOf() };
47
- if (v instanceof Boolean)
48
- return { type: 'bool', value: v.valueOf() };
49
- if (v instanceof Date) {
50
- const src = v.__toml__?.src;
51
- return { type: 'string', value: 'string' === typeof src ? src : v.toJSON() ?? 'null' };
52
- }
53
- return undefined;
54
- default:
55
- // A function or a symbol has no JSON form.
56
- return NULL;
57
- }
58
- }
59
- // Whether the value is a container: an array, or an object that is no
60
- // scalar's host type.
61
- function isEngineContainer(v) {
62
- return null !== v && 'object' === typeof v && undefined === engineScalar(v);
63
- }
64
- // Whether the value is a map (a container that is not an array).
65
- function isEngineMap(v) {
66
- return isEngineContainer(v) && !Array.isArray(v);
67
- }
68
- // A map's member names, in insertion order: the engine's recorded order
69
- // where it kept one, each name once and only while the map still holds it,
70
- // then any member the record missed.
71
- function engineKeys(v) {
72
- if (null === v || 'object' !== typeof v)
73
- return [];
74
- const own = Object.keys(v);
75
- const order = v[KEY_ORDER];
76
- if (!Array.isArray(order) || 0 === order.length)
77
- return own;
78
- const has = Object.prototype.hasOwnProperty;
79
- const seen = new Set();
80
- const out = [];
81
- for (const k of order) {
82
- const key = String(k);
83
- if (seen.has(key) || !has.call(v, key))
84
- continue;
85
- seen.add(key);
86
- out.push(key);
87
- }
88
- if (out.length !== own.length) {
89
- for (const k of own) {
90
- if (!seen.has(k))
91
- out.push(k);
92
- }
93
- }
94
- return out;
95
- }
96
- //# sourceMappingURL=value.js.map
package/dist/value.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"value.js","sourceRoot":"","sources":["../src/value.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;;;;AAE5C,0EAA0E;AAC1E,EAAE;AACF,qEAAqE;AACrE,2EAA2E;AAC3E,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,uBAAuB;AACvB,EAAE;AACF,kEAAkE;AAClE,0EAA0E;AAC1E,wEAAwE;AACxE,wEAAwE;AACxE,qCAAqC;AAErC,sEAAsE;AACtE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAQ/C,MAAM,IAAI,GAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AAE3C,gEAAgE;AAChE,sBAA6B,CAAU;IACrC,QAAQ,OAAO,CAAC,EAAE,CAAC;QACjB,KAAK,WAAW;YACd,OAAO,IAAI,CAAA;QACb,KAAK,SAAS;YACZ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QACnC,KAAK,QAAQ;YACX,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QACrC,KAAK,QAAQ;YACX,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;QAC7C,KAAK,QAAQ;YACX,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QACrC,K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