@ezs/basics 2.5.4 → 2.5.5
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/lib/csv-parse.js +2 -2
- package/lib/txt-parse.js +7 -2
- package/package.json +2 -2
package/lib/csv-parse.js
CHANGED
|
@@ -20,9 +20,9 @@ function CSVParse(data, feed) {
|
|
|
20
20
|
this.whenFinish = feed.flow(this.input);
|
|
21
21
|
}
|
|
22
22
|
if (this.isLast()) {
|
|
23
|
-
this.decoder.end();
|
|
23
|
+
(0, _streamWrite.default)(this.input, this.decoder.end(), () => this.input.end());
|
|
24
24
|
this.whenFinish.finally(() => feed.close());
|
|
25
|
-
return
|
|
25
|
+
return;
|
|
26
26
|
}
|
|
27
27
|
(0, _streamWrite.default)(this.input, Buffer.isBuffer(data) ? this.decoder.write(data) : data, () => feed.end());
|
|
28
28
|
}
|
package/lib/txt-parse.js
CHANGED
|
@@ -8,12 +8,16 @@ var _string_decoder = require("string_decoder");
|
|
|
8
8
|
function TXTParse(data, feed) {
|
|
9
9
|
if (!this.decoder) {
|
|
10
10
|
this.decoder = new _string_decoder.StringDecoder('utf8');
|
|
11
|
+
this.remainder = '';
|
|
12
|
+
this.counter = 0;
|
|
11
13
|
}
|
|
12
14
|
if (this.isLast()) {
|
|
13
|
-
this.decoder.end();
|
|
15
|
+
this.remainder += this.decoder.end();
|
|
16
|
+
if (this.remainder && this.counter > 1) {
|
|
17
|
+
feed.write(this.remainder);
|
|
18
|
+
}
|
|
14
19
|
return feed.end();
|
|
15
20
|
}
|
|
16
|
-
this.remainder = this.remainder || '';
|
|
17
21
|
let separator;
|
|
18
22
|
try {
|
|
19
23
|
const val = '"'.concat(this.getParam('separator', '\n')).concat('"');
|
|
@@ -34,6 +38,7 @@ function TXTParse(data, feed) {
|
|
|
34
38
|
lines.forEach(line => {
|
|
35
39
|
feed.write(line);
|
|
36
40
|
});
|
|
41
|
+
this.counter += lines.length;
|
|
37
42
|
feed.end();
|
|
38
43
|
}
|
|
39
44
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezs/basics",
|
|
3
3
|
"description": "Basics statements for EZS",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.5",
|
|
5
5
|
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Inist-CNRS/ezs/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"directories": {
|
|
42
42
|
"test": "test"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f168e4c0002e2eb1865ae7eacda04f94904b37cd",
|
|
45
45
|
"homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
|
|
46
46
|
"keywords": [
|
|
47
47
|
"ezs"
|