@thi.ng/csv 2.2.1 → 2.2.4

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2021-12-13T10:26:00Z
3
+ - **Last updated**: 2022-04-07T14:17:30Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -139,4 +139,4 @@ If this project contributes to an academic publication, please cite it as:
139
139
 
140
140
  ## License
141
141
 
142
- © 2014 - 2021 Karsten Schmidt // Apache Software License 2.0
142
+ © 2014 - 2022 Karsten Schmidt // Apache Software License 2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/csv",
3
- "version": "2.2.1",
3
+ "version": "2.2.4",
4
4
  "description": "Customizable, transducer-based CSV parser/object mapper and transformer",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,18 +34,18 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "dependencies": {
37
- "@thi.ng/api": "^8.3.3",
38
- "@thi.ng/checks": "^3.1.3",
39
- "@thi.ng/strings": "^3.3.1",
40
- "@thi.ng/transducers": "^8.1.3"
37
+ "@thi.ng/api": "^8.3.5",
38
+ "@thi.ng/checks": "^3.1.5",
39
+ "@thi.ng/strings": "^3.3.3",
40
+ "@thi.ng/transducers": "^8.3.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@microsoft/api-extractor": "^7.19.2",
44
- "@thi.ng/testament": "^0.2.3",
43
+ "@microsoft/api-extractor": "^7.19.4",
44
+ "@thi.ng/testament": "^0.2.5",
45
45
  "rimraf": "^3.0.2",
46
46
  "tools": "^0.0.1",
47
- "typedoc": "^0.22.10",
48
- "typescript": "^4.5.3"
47
+ "typedoc": "^0.22.13",
48
+ "typescript": "^4.6.2"
49
49
  },
50
50
  "keywords": [
51
51
  "csv",
@@ -67,23 +67,23 @@
67
67
  ],
68
68
  "exports": {
69
69
  ".": {
70
- "import": "./index.js"
70
+ "default": "./index.js"
71
71
  },
72
72
  "./api": {
73
- "import": "./api.js"
73
+ "default": "./api.js"
74
74
  },
75
75
  "./format": {
76
- "import": "./format.js"
76
+ "default": "./format.js"
77
77
  },
78
78
  "./parse": {
79
- "import": "./parse.js"
79
+ "default": "./parse.js"
80
80
  },
81
81
  "./transforms": {
82
- "import": "./transforms.js"
82
+ "default": "./transforms.js"
83
83
  }
84
84
  },
85
85
  "thi.ng": {
86
86
  "year": 2014
87
87
  },
88
- "gitHead": "2db9dd34c0c2c60cbfde3dad0bca352b20292f5c\n"
88
+ "gitHead": "5ee1feb590dd935593b1dd4e7f38a3ed3ba64765\n"
89
89
  }
package/parse.d.ts CHANGED
@@ -52,7 +52,7 @@ import type { CSVOpts, CSVRecord, CSVRow, SimpleCSVOpts } from "./api.js";
52
52
  * // ]
53
53
  * ```
54
54
  *
55
- * @param opts
55
+ * @param opts -
56
56
  */
57
57
  export declare function parseCSV(opts?: Partial<CSVOpts>): Transducer<string, CSVRecord>;
58
58
  export declare function parseCSV(opts: Partial<CSVOpts>, src: Iterable<string>): IterableIterator<CSVRecord>;
@@ -71,7 +71,7 @@ export declare function parseCSV(opts: Partial<CSVOpts>, src: Iterable<string>):
71
71
  * // [ [ 1, 3 ], [ 4, 6 ] ]
72
72
  * ```
73
73
  *
74
- * @param opts
74
+ * @param opts -
75
75
  */
76
76
  export declare function parseCSVSimple(opts?: Partial<SimpleCSVOpts>): Transducer<string, CSVRow>;
77
77
  export declare function parseCSVSimple(opts: Partial<SimpleCSVOpts>, src: Iterable<string>): IterableIterator<CSVRow>;
@@ -80,8 +80,8 @@ export declare function parseCSVSimple(opts: Partial<SimpleCSVOpts>, src: Iterab
80
80
  * given source string into a line based input using
81
81
  * {@link @thi.ng/strings#split}.
82
82
  *
83
- * @param opts
84
- * @param src
83
+ * @param opts -
84
+ * @param src -
85
85
  */
86
86
  export declare const parseCSVFromString: (opts: Partial<CSVOpts>, src: string) => IterableIterator<CSVRecord>;
87
87
  /**
@@ -89,8 +89,8 @@ export declare const parseCSVFromString: (opts: Partial<CSVOpts>, src: string) =
89
89
  * splitting given source string into a line based input using
90
90
  * {@link @thi.ng/strings#split}.
91
91
  *
92
- * @param opts
93
- * @param src
92
+ * @param opts -
93
+ * @param src -
94
94
  */
95
95
  export declare const parseCSVSimpleFromString: (opts: Partial<SimpleCSVOpts>, src: string) => IterableIterator<CSVRow>;
96
96
  //# sourceMappingURL=parse.d.ts.map
package/parse.js CHANGED
@@ -121,8 +121,8 @@ export function parseCSVSimple(opts, src) {
121
121
  * given source string into a line based input using
122
122
  * {@link @thi.ng/strings#split}.
123
123
  *
124
- * @param opts
125
- * @param src
124
+ * @param opts -
125
+ * @param src -
126
126
  */
127
127
  export const parseCSVFromString = (opts, src) => parseCSV(opts, split(src));
128
128
  /**
@@ -130,8 +130,8 @@ export const parseCSVFromString = (opts, src) => parseCSV(opts, split(src));
130
130
  * splitting given source string into a line based input using
131
131
  * {@link @thi.ng/strings#split}.
132
132
  *
133
- * @param opts
134
- * @param src
133
+ * @param opts -
134
+ * @param src -
135
135
  */
136
136
  export const parseCSVSimpleFromString = (opts, src) => parseCSVSimple(opts, split(src));
137
137
  /**
@@ -147,11 +147,11 @@ export const parseCSVSimpleFromString = (opts, src) => parseCSVSimple(opts, spli
147
147
  * Function returns current state of `isQuoted` (i.e. if line terminated in a
148
148
  * quoted cell) and should be (re)called with new lines until it returns false.
149
149
  *
150
- * @param line
151
- * @param acc
152
- * @param isQuoted
153
- * @param delim
154
- * @param quote
150
+ * @param line -
151
+ * @param acc -
152
+ * @param isQuoted -
153
+ * @param delim -
154
+ * @param quote -
155
155
  */
156
156
  const parseLine = (line, acc, isQuoted, delim, quote) => {
157
157
  let curr = "";
package/transforms.d.ts CHANGED
@@ -2,34 +2,34 @@ import type { CellTransform } from "./api.js";
2
2
  /**
3
3
  * Cell parse value transform. Returns uppercased version of given input.
4
4
  *
5
- * @param x
5
+ * @param x -
6
6
  */
7
7
  export declare const upper: CellTransform;
8
8
  /**
9
9
  * Cell parse value transform. Returns lowercased version of given input.
10
10
  *
11
- * @param x
11
+ * @param x -
12
12
  */
13
13
  export declare const lower: CellTransform;
14
14
  /**
15
15
  * Higher-order cell parse value transform. Attempts to parse cell values as
16
16
  * floating point number or returns `defaultVal` if not possible.
17
17
  *
18
- * @param defaultVal
18
+ * @param defaultVal -
19
19
  */
20
20
  export declare const float: (defaultVal?: number) => CellTransform;
21
21
  /**
22
22
  * Higher-order cell parse value transform. Attempts to parse cell values as
23
23
  * integer or returns `defaultVal` if not possible.
24
24
  *
25
- * @param defaultVal
25
+ * @param defaultVal -
26
26
  */
27
27
  export declare const int: (defaultVal?: number) => CellTransform;
28
28
  /**
29
29
  * Higher-order cell parse value transform. Attempts to parse cell values as
30
30
  * hexadecimal integer or returns `defaultVal` if not possible.
31
31
  *
32
- * @param defaultVal
32
+ * @param defaultVal -
33
33
  */
34
34
  export declare const hex: (defaultVal?: number) => CellTransform;
35
35
  export declare const percent: CellTransform;
@@ -37,21 +37,21 @@ export declare const percent: CellTransform;
37
37
  * Higher-order cell parse value transform. Attempts to parse cell values as
38
38
  * Unix epoch/timestamp or returns `defaultVal` if not possible.
39
39
  *
40
- * @param defaultVal
40
+ * @param defaultVal -
41
41
  */
42
42
  export declare const epoch: (defaultVal?: number) => CellTransform;
43
43
  /**
44
44
  * Higher-order cell parse value transform. Attempts to parse cell values as JS
45
45
  * `Date` instance or returns `defaultVal` if not possible.
46
46
  *
47
- * @param defaultVal
47
+ * @param defaultVal -
48
48
  */
49
49
  export declare const date: (defaultVal?: Date | undefined) => CellTransform;
50
50
  /**
51
51
  * Cell parse value transform. Attempts to parse cell values as JS `URL`
52
52
  * instances.
53
53
  *
54
- * @param x
54
+ * @param x -
55
55
  */
56
56
  export declare const url: CellTransform;
57
57
  export declare const zeroPad: (digits: number) => (x: any, length?: number | undefined) => string;
package/transforms.js CHANGED
@@ -4,34 +4,34 @@ import { maybeParseFloat, maybeParseInt } from "@thi.ng/strings/parse";
4
4
  /**
5
5
  * Cell parse value transform. Returns uppercased version of given input.
6
6
  *
7
- * @param x
7
+ * @param x -
8
8
  */
9
9
  export const upper = (x) => x.toUpperCase();
10
10
  /**
11
11
  * Cell parse value transform. Returns lowercased version of given input.
12
12
  *
13
- * @param x
13
+ * @param x -
14
14
  */
15
15
  export const lower = (x) => x.toLowerCase();
16
16
  /**
17
17
  * Higher-order cell parse value transform. Attempts to parse cell values as
18
18
  * floating point number or returns `defaultVal` if not possible.
19
19
  *
20
- * @param defaultVal
20
+ * @param defaultVal -
21
21
  */
22
22
  export const float = (defaultVal = 0) => (x) => maybeParseFloat(x, defaultVal);
23
23
  /**
24
24
  * Higher-order cell parse value transform. Attempts to parse cell values as
25
25
  * integer or returns `defaultVal` if not possible.
26
26
  *
27
- * @param defaultVal
27
+ * @param defaultVal -
28
28
  */
29
29
  export const int = (defaultVal = 0) => (x) => maybeParseInt(x, defaultVal, 10);
30
30
  /**
31
31
  * Higher-order cell parse value transform. Attempts to parse cell values as
32
32
  * hexadecimal integer or returns `defaultVal` if not possible.
33
33
  *
34
- * @param defaultVal
34
+ * @param defaultVal -
35
35
  */
36
36
  export const hex = (defaultVal = 0) => (x) => maybeParseInt(x, defaultVal, 16);
37
37
  export const percent = (x) => maybeParseFloat(x) * 0.01;
@@ -39,7 +39,7 @@ export const percent = (x) => maybeParseFloat(x) * 0.01;
39
39
  * Higher-order cell parse value transform. Attempts to parse cell values as
40
40
  * Unix epoch/timestamp or returns `defaultVal` if not possible.
41
41
  *
42
- * @param defaultVal
42
+ * @param defaultVal -
43
43
  */
44
44
  export const epoch = (defaultVal = 0) => (x) => {
45
45
  const res = Date.parse(x);
@@ -49,7 +49,7 @@ export const epoch = (defaultVal = 0) => (x) => {
49
49
  * Higher-order cell parse value transform. Attempts to parse cell values as JS
50
50
  * `Date` instance or returns `defaultVal` if not possible.
51
51
  *
52
- * @param defaultVal
52
+ * @param defaultVal -
53
53
  */
54
54
  export const date = (defaultVal) => (x) => {
55
55
  const epoch = Date.parse(x);
@@ -63,7 +63,7 @@ export const date = (defaultVal) => (x) => {
63
63
  * Cell parse value transform. Attempts to parse cell values as JS `URL`
64
64
  * instances.
65
65
  *
66
- * @param x
66
+ * @param x -
67
67
  */
68
68
  export const url = (x) => new URL(x);
69
69
  // formatters