We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Array.from
1 parent 7c96d01 commit 47a925eCopy full SHA for 47a925e
lib/csv-stringifiers/abstract.js
@@ -1,4 +1,3 @@
1
-
2
'use strict';
3
4
const RECORD_DELIMITER = '\n';
@@ -16,12 +15,8 @@ class AbstractCsvStringifier {
16
15
}
17
18
stringifyRecords(records) {
19
- const array = [];
20
- for (let record of records) {
21
- array.push(this._getCsvLine(this._getRecordAsArray(record)));
22
- }
23
- array.push('');
24
- return array.join(RECORD_DELIMITER);
+ const csvLines = Array.from(records, record => this._getCsvLine(this._getRecordAsArray(record)));
+ return csvLines.join(RECORD_DELIMITER) + RECORD_DELIMITER;
25
26
27
/* istanbul ignore next */_getRecordAsArray(_record) {
0 commit comments