sv 0.4.3 → 0.5.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.
Files changed (59) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +20 -128
  3. package/dist/bin.js +13085 -0
  4. package/dist/bin.js.map +1 -0
  5. package/dist/index-CfDBZLMZ.js +137 -0
  6. package/dist/index-CfDBZLMZ.js.map +1 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +5 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/shared.json +138 -0
  11. package/dist/templates/demo/assets/DOT-gitignore +21 -0
  12. package/dist/templates/demo/assets/DOT-npmrc +1 -0
  13. package/dist/templates/demo/assets/src/app.css +107 -0
  14. package/dist/templates/demo/assets/src/app.html +12 -0
  15. package/dist/templates/demo/assets/src/lib/images/github.svg +16 -0
  16. package/dist/templates/demo/assets/src/lib/images/svelte-logo.svg +1 -0
  17. package/dist/templates/demo/assets/src/lib/images/svelte-welcome.png +0 -0
  18. package/dist/templates/demo/assets/src/lib/images/svelte-welcome.webp +0 -0
  19. package/dist/templates/demo/assets/static/favicon.png +0 -0
  20. package/dist/templates/demo/assets/static/robots.txt +3 -0
  21. package/dist/templates/demo/files.types=checkjs.json +62 -0
  22. package/dist/templates/demo/files.types=none.json +58 -0
  23. package/dist/templates/demo/files.types=typescript.json +62 -0
  24. package/dist/templates/demo/meta.json +4 -0
  25. package/dist/templates/demo/package.json +19 -0
  26. package/dist/templates/skeleton/assets/DOT-gitignore +21 -0
  27. package/dist/templates/skeleton/assets/DOT-npmrc +1 -0
  28. package/dist/templates/skeleton/assets/src/app.html +12 -0
  29. package/dist/templates/skeleton/assets/static/favicon.png +0 -0
  30. package/dist/templates/skeleton/files.types=checkjs.json +14 -0
  31. package/dist/templates/skeleton/files.types=none.json +10 -0
  32. package/dist/templates/skeleton/files.types=typescript.json +14 -0
  33. package/dist/templates/skeleton/meta.json +4 -0
  34. package/dist/templates/skeleton/package.json +18 -0
  35. package/dist/templates/skeletonlib/assets/DOT-gitignore +22 -0
  36. package/dist/templates/skeletonlib/assets/DOT-npmrc +1 -0
  37. package/dist/templates/skeletonlib/assets/src/app.html +12 -0
  38. package/dist/templates/skeletonlib/assets/static/favicon.png +0 -0
  39. package/dist/templates/skeletonlib/files.types=checkjs.json +14 -0
  40. package/dist/templates/skeletonlib/files.types=none.json +10 -0
  41. package/dist/templates/skeletonlib/files.types=typescript.json +14 -0
  42. package/dist/templates/skeletonlib/meta.json +4 -0
  43. package/dist/templates/skeletonlib/package.json +34 -0
  44. package/dist/unocss-Dk7i15rK.js +11 -0
  45. package/dist/unocss-Dk7i15rK.js.map +1 -0
  46. package/dist/unplugin-icons-DkNLYvBs.js +11 -0
  47. package/dist/unplugin-icons-DkNLYvBs.js.map +1 -0
  48. package/package.json +42 -29
  49. package/bin/sv.d.ts +0 -2
  50. package/bin/sv.js +0 -126
  51. package/common.d.ts +0 -39
  52. package/common.js +0 -29
  53. package/docs/example.js +0 -57
  54. package/index.d.ts +0 -13
  55. package/index.js +0 -31
  56. package/parser.d.ts +0 -31
  57. package/parser.js +0 -209
  58. package/stringifier.d.ts +0 -44
  59. package/stringifier.js +0 -174
package/index.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transform = exports.Stringifier = exports.Parser = void 0;
4
- var json_1 = require("streaming/json");
5
- var property_1 = require("streaming/property");
6
- var parser_1 = require("./parser");
7
- Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return parser_1.Parser; } });
8
- var stringifier_1 = require("./stringifier");
9
- Object.defineProperty(exports, "Stringifier", { enumerable: true, get: function () { return stringifier_1.Stringifier; } });
10
- function transform(input, parserConfig, stringifierConfig, callback) {
11
- var transforms = [
12
- parserConfig.json ? new json_1.Parser() : new parser_1.Parser(parserConfig),
13
- ];
14
- if (stringifierConfig.omit) {
15
- transforms.push(new property_1.Omitter(stringifierConfig.omit.split(/,/g)));
16
- }
17
- if (stringifierConfig.filter) {
18
- transforms.push(new property_1.Picker(stringifierConfig.filter.split(/,/g)));
19
- }
20
- var stringifier = stringifierConfig.json ? new json_1.Stringifier() : new stringifier_1.Stringifier(stringifierConfig);
21
- transforms.push(stringifier);
22
- var output = transforms.reduce(function (outputStream, transform) { return outputStream.pipe(transform); }, input).pipe(process.stdout);
23
- output.on('finish', callback);
24
- output.on('error', function (error) {
25
- // panic! (lets us quit faster, actually)
26
- input.unpipe();
27
- // output.unpipe();
28
- callback(error);
29
- });
30
- }
31
- exports.transform = transform;
package/parser.d.ts DELETED
@@ -1,31 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Transform } from 'stream';
4
- import { Configuration } from './common';
5
- export interface ParserConfiguration extends Configuration {
6
- }
7
- export declare const defaultParserConfiguration: ParserConfiguration;
8
- /**
9
- returns a single char code (a byte) denoting the inferred delimiter.
10
- */
11
- export declare function inferDelimiter(buffer: Buffer): number;
12
- /**
13
- - `byteBuffer` is a buffer (of bytes) that have yet to be processed (and sent to output).
14
- - `cellBuffer` is a list of strings that have yet to be processed (and sent to output).
15
-
16
- */
17
- export declare class Parser extends Transform {
18
- config: ParserConfiguration;
19
- delimiterByte: number;
20
- quoteByte: number;
21
- quotequoteRegExp: RegExp;
22
- escapeByte: number;
23
- escapeQuoteRegExp: RegExp;
24
- byteBuffer: Buffer;
25
- cellBuffer: string[];
26
- constructor(config?: ParserConfiguration);
27
- protected writeRow(cells: string[]): void;
28
- flush(callback: (error?: Error) => void, nonfinal: boolean): void;
29
- _flush(callback: (error?: Error) => void): void;
30
- _transform(chunk: Buffer, encoding: BufferEncoding | 'buffer', callback: (error?: Error) => void): void;
31
- }
package/parser.js DELETED
@@ -1,209 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.Parser = exports.inferDelimiter = exports.defaultParserConfiguration = void 0;
19
- var stream_1 = require("stream");
20
- var common_1 = require("./common");
21
- exports.defaultParserConfiguration = {
22
- encoding: 'utf8',
23
- missing: '',
24
- newline: '\n',
25
- // omit delimiter so that it gets inferred
26
- quotechar: '"',
27
- escape: '\\',
28
- };
29
- /**
30
- returns a single char code (a byte) denoting the inferred delimiter.
31
- */
32
- function inferDelimiter(buffer) {
33
- var counts = {};
34
- // we look at the first newline or 256 chars, whichever is greater,
35
- // but without going through the whole file
36
- var upto = Math.min(256, buffer.length);
37
- for (var i = 0; i < upto && buffer[i] != 10 && buffer[i] != 13; i++) {
38
- var charCode = buffer[i];
39
- counts[charCode] = (counts[charCode] || 0) + 1;
40
- }
41
- // we'll go through, prioritizing characters that aren't likely to show
42
- // up unless they are a delimiter.
43
- var candidates = [
44
- 9,
45
- 59,
46
- 44,
47
- 32, // ' ' (space)
48
- ];
49
- // TODO: make this more robust (that's why I even counted them)
50
- for (var candidate = void 0, j = 0; (candidate = candidates[j]); j++) {
51
- if (counts[candidate] > 0) {
52
- return candidate;
53
- }
54
- }
55
- }
56
- exports.inferDelimiter = inferDelimiter;
57
- /**
58
- - `byteBuffer` is a buffer (of bytes) that have yet to be processed (and sent to output).
59
- - `cellBuffer` is a list of strings that have yet to be processed (and sent to output).
60
-
61
- */
62
- var Parser = /** @class */ (function (_super) {
63
- __extends(Parser, _super);
64
- function Parser(config) {
65
- if (config === void 0) { config = {}; }
66
- var _this = _super.call(this, {
67
- decodeStrings: true,
68
- readableObjectMode: true,
69
- writableObjectMode: false,
70
- }) || this;
71
- _this.byteBuffer = Buffer.alloc(0);
72
- _this.cellBuffer = [];
73
- // merge defaults
74
- _this.config = (0, common_1.merge)(config, exports.defaultParserConfiguration);
75
- // special demarcating characters
76
- // 1. delimiter
77
- if (_this.config.delimiter) {
78
- _this.delimiterByte = _this.config.delimiter.charCodeAt(0);
79
- }
80
- // 2. quote
81
- _this.quoteByte = _this.config.quotechar.charCodeAt(0);
82
- _this.quotequoteRegExp = new RegExp(_this.config.quotechar + _this.config.quotechar, 'g');
83
- // 3. escape
84
- _this.escapeByte = _this.config.escape.charCodeAt(0);
85
- _this.escapeQuoteRegExp = new RegExp('\\' + _this.config.escape + _this.config.quotechar, 'g');
86
- return _this;
87
- }
88
- Parser.prototype.writeRow = function (cells) {
89
- if (!this.config.columns) {
90
- // we don't emit the column names as data
91
- this.config.columns = cells;
92
- }
93
- else {
94
- this.push((0, common_1.zip)(this.config.columns, cells, this.config.missing));
95
- }
96
- };
97
- Parser.prototype.flush = function (callback, nonfinal) {
98
- var buffer = this.byteBuffer;
99
- var cells = this.cellBuffer;
100
- if (!this.delimiterByte) {
101
- // should we wait for some minimum amount of data?
102
- this.delimiterByte = inferDelimiter(buffer);
103
- }
104
- var start = 0;
105
- var end = buffer.length;
106
- var inside_quote = false;
107
- // outside_quote reminds us to remove the quotes later (in pushCell)
108
- var outside_quote = false;
109
- for (var i = 0; i < end; i++) {
110
- var eos = !nonfinal && i + 1 == end;
111
- // const snippet = buffer.toString('utf8', 0, i) +
112
- // '\x1b[7m' + buffer.toString('utf8', i, i + 1) + '\x1b[0m' +
113
- // buffer.toString('utf8', i + 1, end);
114
- // console.error(snippet.replace(/\n/g, 'N').replace(/\t/g, 'T'), inside_quote ? 'inside_quote' : '');
115
- // if we are on an escape char, simply skip over it (++) and the (default)
116
- if (!eos && buffer[i] == this.escapeByte) {
117
- // excel is bizarre. An escape before a quotebyte doesn't count,
118
- // so we only increment if the next character is not a quotebyte
119
- // unless we are not inside quotes, in which case we do skip over it.
120
- if (!inside_quote || buffer[i + 1] !== this.quoteByte) {
121
- i++;
122
- }
123
- }
124
- else if (!eos && buffer[i] === this.quoteByte && inside_quote) {
125
- // if we are inside, and on a "
126
- // handle excel dialect: double quotebyte => single literal quotebyte
127
- if (buffer[i + 1] === this.quoteByte) {
128
- // double quotebyte
129
- // we just advance over it for now, so that we can put this back on the buffer, if needed.
130
- i++;
131
- }
132
- else {
133
- // lone quotebyte -> don't assume that they're always followed by a delimiter.
134
- // they might be followed by a newline
135
- // and we advance so that buffer[i] skips over the delimiter
136
- inside_quote = false;
137
- outside_quote = true;
138
- }
139
- }
140
- else if (!eos && buffer[i] === this.quoteByte && !inside_quote && i == start) {
141
- // if we are not already inside, and on a "
142
- inside_quote = true;
143
- // we can only enter a quote at the edge of the cell (thus, i == start)
144
- }
145
- // otherwise we just wait for the delimiter
146
- else if (
147
- // if we are at the very end of the input and this is the final chunk (ignoring any sort of state)
148
- eos ||
149
- // OR, we push a new cell whenever we hit a delimiter (say, tab) and are not inside a quote
150
- (!inside_quote && (buffer[i] == 13 || buffer[i] == 10 || buffer[i] == this.delimiterByte))) {
151
- // this generally won't hurt, since it will only go to the end of the buffer anyway.
152
- if (eos)
153
- i++;
154
- // add the unprocessed buffer to our cells
155
- // inside_quote might be true if the file ends on a quote
156
- if (inside_quote || outside_quote) {
157
- var trimmed_cell = buffer.toString(this.config.encoding, start + 1, i - 1);
158
- if (this.quotequoteRegExp) {
159
- trimmed_cell = trimmed_cell.replace(this.quotequoteRegExp, this.config.quotechar);
160
- }
161
- // is this good enough?
162
- cells.push(trimmed_cell);
163
- outside_quote = inside_quote = false;
164
- }
165
- else {
166
- var cell = buffer.toString(this.config.encoding, start, i);
167
- if (this.escapeQuoteRegExp) {
168
- cell = cell.replace(this.escapeQuoteRegExp, this.config.quotechar);
169
- }
170
- cells.push(cell);
171
- }
172
- // handle \r, \r\n, or \n (but not \n\n) as one line break
173
- // '\r' == 13, '\n' == 10
174
- // we flush the row, also, if we are at the end and this is the final chunk
175
- if (eos || (buffer[i] != this.delimiterByte)) {
176
- // add these cells to the emit queue
177
- this.writeRow(cells);
178
- // and reset them
179
- cells = [];
180
- // also consume a following \n, if this was \r, and there is one.
181
- if (buffer[i] == 13 && buffer[i + 1] == 10) {
182
- i++;
183
- }
184
- }
185
- start = i + 1;
186
- }
187
- }
188
- // save whatever we have yet to process
189
- this.byteBuffer = buffer.slice(start, end);
190
- this.cellBuffer = cells;
191
- // if there was a trailing newline, this._buffer.length = 0
192
- callback();
193
- };
194
- Parser.prototype._flush = function (callback) {
195
- return this.flush(callback, false);
196
- };
197
- Parser.prototype._transform = function (chunk, encoding, callback) {
198
- // we'll assume that we always get chunks with the same encoding.
199
- if (!this.config.encoding && encoding != 'buffer') {
200
- this.config.encoding = encoding;
201
- }
202
- // collect unused buffer and new chunk into a single buffer
203
- this.byteBuffer = this.byteBuffer.length ? Buffer.concat([this.byteBuffer, chunk]) : chunk;
204
- // do all the processing
205
- this.flush(callback, true);
206
- };
207
- return Parser;
208
- }(stream_1.Transform));
209
- exports.Parser = Parser;
package/stringifier.d.ts DELETED
@@ -1,44 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Transform } from 'stream';
4
- import { Configuration } from './common';
5
- export interface StringifierConfiguration extends Configuration {
6
- peek?: number;
7
- }
8
- export declare const defaultStringifierConfiguration: {
9
- encoding: string;
10
- missing: string;
11
- newline: string;
12
- delimiter: string;
13
- quotechar: string;
14
- escape: string;
15
- peek: number;
16
- };
17
- export declare function inferColumns(rows: string[][]): string[];
18
- /** Stringifier class
19
- new Stringifier();
20
- - `peek` is an integer (or undefined / null) describing how many rows we
21
- should look at before inferring headers and flushing.
22
- - `columns` is an array of strings once the headers have been inferred
23
- - `encoding` is the encoding that the stream's read function will use.
24
- - `missing` is the value we write for 'time' when we have
25
- `columns = ['index', 'time']` and `write({index: 90})` is called
26
-
27
- - `delimiter` is the field separator (defaults to a comma)
28
- - `quotechar` is the character used to quote fields if they contain the
29
- `delimiter` character (defaults to a double-quote)
30
-
31
- - `_buffer` is an array of arrays or objects that need to be written
32
- */
33
- export declare class Stringifier extends Transform {
34
- /** should this even be 1? (ignored if opts.columns) */
35
- config: StringifierConfiguration;
36
- protected quotecharRegExp: RegExp;
37
- protected rowBuffer: string[][];
38
- constructor(config?: StringifierConfiguration);
39
- protected writeObject(object: any): void;
40
- protected writeObjects(objects: any[]): void;
41
- flush(callback: (error?: Error) => void, nonfinal: boolean): void;
42
- _flush(callback: (error?: Error) => void): void;
43
- _transform(chunk: any, encoding: BufferEncoding, callback: (error?: Error) => void): void;
44
- }
package/stringifier.js DELETED
@@ -1,174 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.Stringifier = exports.inferColumns = exports.defaultStringifierConfiguration = void 0;
19
- var stream_1 = require("stream");
20
- var common_1 = require("./common");
21
- exports.defaultStringifierConfiguration = {
22
- encoding: 'utf8',
23
- missing: '',
24
- newline: '\n',
25
- delimiter: ',',
26
- quotechar: '"',
27
- escape: '\\',
28
- peek: 1,
29
- };
30
- function inferColumns(rows) {
31
- var columns = [];
32
- var seen = {};
33
- rows.forEach(function (row) {
34
- // each object might be a string, array, or object, but only objects matter here.
35
- if (typeof (row) !== 'string' && !Array.isArray(row)) {
36
- Object.keys(row).forEach(function (key) {
37
- // if (row.hasOwnProperty(key)) {
38
- // maybe should also check that row[key] != null
39
- if (!(key in seen)) {
40
- columns.push(key);
41
- seen[key] = 1;
42
- }
43
- // }
44
- });
45
- }
46
- });
47
- return columns;
48
- }
49
- exports.inferColumns = inferColumns;
50
- /** Stringifier class
51
- new Stringifier();
52
- - `peek` is an integer (or undefined / null) describing how many rows we
53
- should look at before inferring headers and flushing.
54
- - `columns` is an array of strings once the headers have been inferred
55
- - `encoding` is the encoding that the stream's read function will use.
56
- - `missing` is the value we write for 'time' when we have
57
- `columns = ['index', 'time']` and `write({index: 90})` is called
58
-
59
- - `delimiter` is the field separator (defaults to a comma)
60
- - `quotechar` is the character used to quote fields if they contain the
61
- `delimiter` character (defaults to a double-quote)
62
-
63
- - `_buffer` is an array of arrays or objects that need to be written
64
- */
65
- var Stringifier = /** @class */ (function (_super) {
66
- __extends(Stringifier, _super);
67
- function Stringifier(config) {
68
- if (config === void 0) { config = {}; }
69
- var _this = _super.call(this, { readableObjectMode: false, writableObjectMode: true }) || this;
70
- _this.rowBuffer = [];
71
- _this.config = (0, common_1.merge)(config, exports.defaultStringifierConfiguration);
72
- _this.quotecharRegExp = new RegExp(_this.config.quotechar, 'ig');
73
- if (_this.config.columns) {
74
- // maybe we should write the columns even if we don't get any data?
75
- _this.rowBuffer = [_this.config.columns];
76
- }
77
- else {
78
- _this.rowBuffer = [];
79
- }
80
- return _this;
81
- }
82
- Stringifier.prototype.writeObject = function (object) {
83
- // _write is already a thing, so don't use it.
84
- // this.columns must be set!
85
- if (typeof (object) === 'string') {
86
- // raw string
87
- this.push(object + this.config.newline, this.config.encoding);
88
- }
89
- else {
90
- // if object is an array, we ignore this.columns
91
- var length_1 = object.length;
92
- if (!Array.isArray(object)) {
93
- // object
94
- length_1 = this.config.columns.length;
95
- // pull properties off the given object in proper column order
96
- var list = new Array(length_1);
97
- for (var i = 0; i < length_1; i++) {
98
- var column_value = object[this.config.columns[i]];
99
- list[i] = (column_value === undefined) ? this.config.missing : column_value;
100
- }
101
- object = list;
102
- }
103
- // obj is definitely an array now, but the fields aren't quoted.
104
- for (var j = 0; j < length_1; j++) {
105
- // assume minimal quoting (don't quote unless the cell contains the delimiter)
106
- var value = String(object[j]);
107
- var contains_newline = value.indexOf('\n') > -1 || value.indexOf('\r') > -1;
108
- var contains_quotechar = value.indexOf(this.config.quotechar) > -1;
109
- if (value.indexOf(this.config.delimiter) > -1 || contains_newline || contains_quotechar) {
110
- if (contains_quotechar) {
111
- // serialize into the excel dialect, currently
112
- value = value.replace(this.quotecharRegExp, this.config.quotechar + this.config.quotechar);
113
- // serialize with escapes:
114
- // value = value.replace(this.quotechar_regex, '\\' + this.quotechar);
115
- }
116
- value = this.config.quotechar + value + this.config.quotechar;
117
- }
118
- object[j] = value;
119
- }
120
- this.push(object.join(this.config.delimiter) + this.config.newline, this.config.encoding);
121
- }
122
- };
123
- Stringifier.prototype.writeObjects = function (objects) {
124
- for (var i = 0, l = objects.length; i < l; i++) {
125
- this.writeObject(objects[i]);
126
- }
127
- };
128
- Stringifier.prototype.flush = function (callback, nonfinal) {
129
- // called when we're done peeking (nonfinal = true) or when end() is
130
- // called (nonfinal = false), in which case we are done peeking, but for a
131
- // different reason. In either case, we need to flush the peeked columns.
132
- if (!this.config.columns) {
133
- // infer columns
134
- this.config.columns = inferColumns(this.rowBuffer);
135
- this.writeObject(this.config.columns);
136
- }
137
- if (this.rowBuffer) {
138
- // flush the _buffer
139
- this.writeObjects(this.rowBuffer);
140
- // a null _buffer means we're done peeking and won't be buffering any more rows
141
- this.rowBuffer = null;
142
- }
143
- // this.push(null); // inferred
144
- callback();
145
- };
146
- // the docs decree that we shouldn't call _flush directly
147
- Stringifier.prototype._flush = function (callback) {
148
- return this.flush(callback, false);
149
- };
150
- Stringifier.prototype._transform = function (chunk, encoding, callback) {
151
- // objectMode: true, so chunk is an object (and encoding is always 'utf8'?)
152
- if (this.config.columns) {
153
- // flush the _buffer, if needed
154
- if (this.rowBuffer) {
155
- this.writeObjects(this.rowBuffer);
156
- this.rowBuffer = null;
157
- }
158
- this.writeObject(chunk);
159
- callback();
160
- }
161
- else {
162
- // if set {peek: 10}, column inference will be called when write(obj) is called the 10th time
163
- this.rowBuffer.push(chunk);
164
- if (this.rowBuffer.length >= this.config.peek) {
165
- this.flush(callback, true);
166
- }
167
- else {
168
- callback();
169
- }
170
- }
171
- };
172
- return Stringifier;
173
- }(stream_1.Transform));
174
- exports.Stringifier = Stringifier;