web-csv-toolbox 0.7.5 → 0.8.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/README.md +2 -3
- package/dist/cjs/_virtual/web_csv_toolbox_wasm_bg.wasm.cjs +1 -1
- package/dist/cjs/assertCommonOptions.cjs +1 -1
- package/dist/cjs/assertCommonOptions.cjs.map +1 -1
- package/dist/es/_virtual/web_csv_toolbox_wasm_bg.wasm.js +1 -1
- package/dist/es/assertCommonOptions.js +20 -14
- package/dist/es/assertCommonOptions.js.map +1 -1
- package/dist/types/assertCommonOptions.d.ts +16 -3
- package/dist/types/common/types.d.ts +8 -5
- 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 +3 -3
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import type { CommonOptions } from "./common/types.ts";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Asserts that the provided options object contains all the required properties.
|
|
4
|
+
* Throws an error if any required property is missing
|
|
5
|
+
* or if the delimiter and quotation length is not 1 byte character,
|
|
6
|
+
* or if the delimiter is the same as the quotation.
|
|
4
7
|
*
|
|
5
|
-
* @
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* assertCommonOptions({
|
|
12
|
+
* quotation: '"',
|
|
13
|
+
* delimiter: ',',
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param options - The options object to be validated.
|
|
18
|
+
* @throws {Error} If any required property is missing or if the delimiter is the same as the quotation.
|
|
6
19
|
*/
|
|
7
|
-
export declare function assertCommonOptions(options: Required<CommonOptions>):
|
|
20
|
+
export declare function assertCommonOptions(options: Required<CommonOptions>): asserts options is Required<CommonOptions>;
|
|
@@ -20,20 +20,23 @@ export type Token = FieldToken | typeof FieldDelimiter | typeof RecordDelimiter;
|
|
|
20
20
|
export interface CommonOptions {
|
|
21
21
|
/**
|
|
22
22
|
* CSV field delimiter.
|
|
23
|
+
* If you want to parse TSV, specify `'\t'`.
|
|
23
24
|
*
|
|
24
25
|
* @remarks
|
|
25
|
-
*
|
|
26
|
+
* Detail restrictions are as follows:
|
|
27
|
+
*
|
|
28
|
+
* - Must not be empty
|
|
29
|
+
* - Must be a single character
|
|
30
|
+
* - Multi-byte characters are not supported
|
|
31
|
+
* - Must not include CR or LF
|
|
32
|
+
* - Must not be the same as the quotation
|
|
26
33
|
*
|
|
27
|
-
* This library supports multi-character delimiters.
|
|
28
34
|
* @default ','
|
|
29
35
|
*/
|
|
30
36
|
delimiter?: string;
|
|
31
37
|
/**
|
|
32
38
|
* CSV field quotation.
|
|
33
39
|
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* This library supports multi-character quotations.
|
|
36
|
-
*
|
|
37
40
|
* @default '"'
|
|
38
41
|
*/
|
|
39
42
|
quotation?: string;
|