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.
@@ -1,7 +1,20 @@
1
1
  import type { CommonOptions } from "./common/types.ts";
2
2
  /**
3
- * Assert that the options are valid.
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
- * @param options The options to assert.
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>): void;
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
- * If you want to parse TSV, specify `'\t'`.
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;