@flattype/shared 1.0.0 → 1.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.
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -21,5 +21,24 @@ interface DecodeOptions {
|
|
|
21
21
|
type FlatLeaf = JsonPrimitive | Record<string, never> | never[];
|
|
22
22
|
/** Path → leaf, e.g. `{ "user.name": "John", "tags[0]": "a" }`. */
|
|
23
23
|
type FlatRecord = Record<string, FlatLeaf>;
|
|
24
|
+
/** One table row, passed to `onRow` as soon as its line has been read. */
|
|
25
|
+
interface TableRow {
|
|
26
|
+
/** Path of the table, e.g. `"users"` or `"data.items"`; `""` for a root table. */
|
|
27
|
+
path: string;
|
|
28
|
+
/** Row number within the table, from 0. */
|
|
29
|
+
index: number;
|
|
30
|
+
value: JsonValue;
|
|
31
|
+
}
|
|
32
|
+
interface DecoderOptions extends DecodeOptions {
|
|
33
|
+
onRow?: (row: TableRow) => void;
|
|
34
|
+
/** Keep rows in the decoded result. `false` passes them only to `onRow`. Default `true`. */
|
|
35
|
+
keepRows?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface Decoder {
|
|
38
|
+
/** Feeds the next chunk of text. Chunks may split lines anywhere. */
|
|
39
|
+
write(chunk: string): void;
|
|
40
|
+
/** Finishes decoding and returns the value. */
|
|
41
|
+
end(): JsonValue;
|
|
42
|
+
}
|
|
24
43
|
|
|
25
|
-
export type { DecodeOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, JsonPrimitive, JsonValue };
|
|
44
|
+
export type { DecodeOptions, Decoder, DecoderOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, JsonPrimitive, JsonValue, TableRow };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,5 +21,24 @@ interface DecodeOptions {
|
|
|
21
21
|
type FlatLeaf = JsonPrimitive | Record<string, never> | never[];
|
|
22
22
|
/** Path → leaf, e.g. `{ "user.name": "John", "tags[0]": "a" }`. */
|
|
23
23
|
type FlatRecord = Record<string, FlatLeaf>;
|
|
24
|
+
/** One table row, passed to `onRow` as soon as its line has been read. */
|
|
25
|
+
interface TableRow {
|
|
26
|
+
/** Path of the table, e.g. `"users"` or `"data.items"`; `""` for a root table. */
|
|
27
|
+
path: string;
|
|
28
|
+
/** Row number within the table, from 0. */
|
|
29
|
+
index: number;
|
|
30
|
+
value: JsonValue;
|
|
31
|
+
}
|
|
32
|
+
interface DecoderOptions extends DecodeOptions {
|
|
33
|
+
onRow?: (row: TableRow) => void;
|
|
34
|
+
/** Keep rows in the decoded result. `false` passes them only to `onRow`. Default `true`. */
|
|
35
|
+
keepRows?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface Decoder {
|
|
38
|
+
/** Feeds the next chunk of text. Chunks may split lines anywhere. */
|
|
39
|
+
write(chunk: string): void;
|
|
40
|
+
/** Finishes decoding and returns the value. */
|
|
41
|
+
end(): JsonValue;
|
|
42
|
+
}
|
|
24
43
|
|
|
25
|
-
export type { DecodeOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, JsonPrimitive, JsonValue };
|
|
44
|
+
export type { DecodeOptions, Decoder, DecoderOptions, Delimiter, EncodeOptions, FlatLeaf, FlatRecord, JsonPrimitive, JsonValue, TableRow };
|