@thi.ng/csv 2.3.65 → 2.3.66
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 +7 -1
- package/format.js +2 -7
- package/package.json +3 -3
- package/parse.js +17 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-02-
|
|
3
|
+
- **Last updated**: 2024-02-22T23:15:26Z
|
|
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.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [2.3.66](https://github.com/thi-ng/umbrella/tree/@thi.ng/csv@2.3.66) (2024-02-22)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update object destructuring in all pkgs & examples ([f36aeb0](https://github.com/thi-ng/umbrella/commit/f36aeb0))
|
|
17
|
+
|
|
12
18
|
### [2.3.26](https://github.com/thi-ng/umbrella/tree/@thi.ng/csv@2.3.26) (2023-08-28)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/format.js
CHANGED
|
@@ -6,14 +6,9 @@ import { iterator } from "@thi.ng/transducers/iterator";
|
|
|
6
6
|
import { isReduced } from "@thi.ng/transducers/reduced";
|
|
7
7
|
import { str } from "@thi.ng/transducers/str";
|
|
8
8
|
import { transduce } from "@thi.ng/transducers/transduce";
|
|
9
|
-
function formatCSV(opts, src) {
|
|
9
|
+
function formatCSV(opts = {}, src) {
|
|
10
10
|
return isIterable(src) ? iterator(formatCSV(opts), src) : (rfn) => {
|
|
11
|
-
let {
|
|
12
|
-
delim: ",",
|
|
13
|
-
quote: `"`,
|
|
14
|
-
cols: [],
|
|
15
|
-
...opts
|
|
16
|
-
};
|
|
11
|
+
let { cols = [], delim = ",", quote = `"`, header } = opts;
|
|
17
12
|
let colTx;
|
|
18
13
|
const reQuote = new RegExp(quote, "g");
|
|
19
14
|
const reduce = rfn[2];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/csv",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.66",
|
|
4
4
|
"description": "Customizable, transducer-based CSV parser/object mapper and transformer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@thi.ng/api": "^8.9.25",
|
|
39
39
|
"@thi.ng/checks": "^3.5.0",
|
|
40
40
|
"@thi.ng/strings": "^3.7.16",
|
|
41
|
-
"@thi.ng/transducers": "^8.9.
|
|
41
|
+
"@thi.ng/transducers": "^8.9.6"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"thi.ng": {
|
|
86
86
|
"year": 2014
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "16f2b92b5410bd35dcde6c2971c8e62783ebc472\n"
|
|
89
89
|
}
|
package/parse.js
CHANGED
|
@@ -13,8 +13,15 @@ const DEFAULT_OPTS = {
|
|
|
13
13
|
};
|
|
14
14
|
function parseCSV(opts, src) {
|
|
15
15
|
return isIterable(src) ? iterator1(parseCSV(opts), src) : (rfn) => {
|
|
16
|
-
const {
|
|
17
|
-
all
|
|
16
|
+
const {
|
|
17
|
+
all = true,
|
|
18
|
+
cols,
|
|
19
|
+
comment,
|
|
20
|
+
delim,
|
|
21
|
+
header,
|
|
22
|
+
quote,
|
|
23
|
+
trim
|
|
24
|
+
} = {
|
|
18
25
|
...DEFAULT_OPTS,
|
|
19
26
|
...opts
|
|
20
27
|
};
|
|
@@ -80,8 +87,14 @@ function parseCSV(opts, src) {
|
|
|
80
87
|
}
|
|
81
88
|
function parseCSVSimple(opts, src) {
|
|
82
89
|
return isIterable(src) ? iterator1(parseCSVSimple(opts), src) : (rfn) => {
|
|
83
|
-
const {
|
|
84
|
-
header
|
|
90
|
+
const {
|
|
91
|
+
header = true,
|
|
92
|
+
cols,
|
|
93
|
+
comment,
|
|
94
|
+
delim,
|
|
95
|
+
quote,
|
|
96
|
+
trim
|
|
97
|
+
} = {
|
|
85
98
|
...DEFAULT_OPTS,
|
|
86
99
|
...opts
|
|
87
100
|
};
|