web-csv-toolbox 0.10.3-next-ee4125d4c2daeac2840037eddcc4335c766a489a → 0.11.0-next-3e76d727a5e0c4f1fbd537e0a89bed474495294b
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/README.md +72 -7
- package/dist/cjs/Lexer.cjs +1 -1
- package/dist/cjs/Lexer.cjs.map +1 -1
- package/dist/cjs/RecordAssembler.cjs +1 -1
- package/dist/cjs/RecordAssembler.cjs.map +1 -1
- package/dist/cjs/_virtual/web_csv_toolbox_wasm_bg.wasm.cjs +1 -1
- package/dist/cjs/utils/convertIterableIteratorToAsync.cjs +1 -1
- package/dist/cjs/utils/convertIterableIteratorToAsync.cjs.map +1 -1
- package/dist/es/Lexer.js +7 -1
- package/dist/es/Lexer.js.map +1 -1
- package/dist/es/RecordAssembler.js +5 -0
- package/dist/es/RecordAssembler.js.map +1 -1
- package/dist/es/_virtual/web_csv_toolbox_wasm_bg.wasm.js +1 -1
- package/dist/es/utils/convertIterableIteratorToAsync.js +1 -2
- package/dist/es/utils/convertIterableIteratorToAsync.js.map +1 -1
- package/dist/types/Lexer.d.ts +2 -2
- package/dist/types/RecordAssembler.test.d.ts +1 -0
- package/dist/types/common/types.d.ts +54 -2
- package/dist/web-csv-toolbox.umd.cjs +1 -1
- package/dist/web-csv-toolbox.umd.cjs.map +1 -1
- package/dist/web_csv_toolbox_wasm_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -75,6 +75,58 @@ export interface RecordDelimiterToken {
|
|
|
75
75
|
* @category Types
|
|
76
76
|
*/
|
|
77
77
|
export type Token = FieldToken | FieldDelimiterToken | RecordDelimiterToken;
|
|
78
|
+
/**
|
|
79
|
+
* AbortSignal Options.
|
|
80
|
+
*
|
|
81
|
+
* @category Types
|
|
82
|
+
*/
|
|
83
|
+
export interface AbortSignalOptions {
|
|
84
|
+
/**
|
|
85
|
+
* The signal to abort the operation.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
*
|
|
89
|
+
* If the signal is aborted, the operation will be stopped.
|
|
90
|
+
*
|
|
91
|
+
* @example Abort with user action
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* const controller = new AbortController();
|
|
95
|
+
*
|
|
96
|
+
* const csv = "foo,bar\n1,2\n3,4";
|
|
97
|
+
* try {
|
|
98
|
+
* const result = await parse(csv, { signal: controller.signal });
|
|
99
|
+
* } catch (e) {
|
|
100
|
+
* if (e instanceof DOMException && e.name === "AbortError") {
|
|
101
|
+
* console.log("Aborted");
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* // Abort with user action
|
|
106
|
+
* document.getElementById("cancel-button")
|
|
107
|
+
* .addEventListener("click", () => {
|
|
108
|
+
* controller.abort();
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @example Abort with timeout
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* const csv = "foo,bar\n1,2\n3,4";
|
|
116
|
+
*
|
|
117
|
+
* try {
|
|
118
|
+
* const result = await parse(csv, { signal: AbortSignal.timeout(1000) });
|
|
119
|
+
* } catch (e) {
|
|
120
|
+
* if (e instanceof DOMException && e.name === "TimeoutError") {
|
|
121
|
+
* console.log("Timeout");
|
|
122
|
+
* }
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @default undefined
|
|
127
|
+
*/
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
}
|
|
78
130
|
/**
|
|
79
131
|
* CSV Common Options.
|
|
80
132
|
* @category Types
|
|
@@ -167,7 +219,7 @@ export interface BinaryOptions {
|
|
|
167
219
|
* If you don't specify `header`,
|
|
168
220
|
* the first record will be treated as a header.
|
|
169
221
|
*/
|
|
170
|
-
export interface RecordAssemblerOptions<Header extends ReadonlyArray<string>> {
|
|
222
|
+
export interface RecordAssemblerOptions<Header extends ReadonlyArray<string>> extends AbortSignalOptions {
|
|
171
223
|
/**
|
|
172
224
|
* CSV header.
|
|
173
225
|
*
|
|
@@ -186,7 +238,7 @@ export interface RecordAssemblerOptions<Header extends ReadonlyArray<string>> {
|
|
|
186
238
|
* Parse options for CSV string.
|
|
187
239
|
* @category Types
|
|
188
240
|
*/
|
|
189
|
-
export interface ParseOptions<Header extends ReadonlyArray<string>> extends CommonOptions, RecordAssemblerOptions<Header
|
|
241
|
+
export interface ParseOptions<Header extends ReadonlyArray<string>> extends CommonOptions, RecordAssemblerOptions<Header>, AbortSignalOptions {
|
|
190
242
|
}
|
|
191
243
|
/**
|
|
192
244
|
* Parse options for CSV binary.
|