From 51cfe072109082af2a344a3524c2e5870132024c Mon Sep 17 00:00:00 2001 From: Andreas Lubbe Date: Mon, 28 Sep 2020 20:17:04 +0200 Subject: [PATCH] Use arrow-parens only as-needed --- .eslintrc | 1 + .prettier | 3 +- benchmark.js | 4 +- lib/csv/csv.js | 4 +- lib/csv/line-buffer.js | 2 +- lib/csv/stream-converter.js | 2 +- lib/doc/cell.js | 6 +- lib/doc/column.js | 2 +- lib/doc/defined-names.js | 20 +++--- lib/doc/row.js | 12 ++-- lib/doc/table.js | 8 +-- lib/doc/workbook.js | 14 ++-- lib/doc/worksheet.js | 40 +++++------ lib/exceljs.bare.js | 2 +- lib/exceljs.browser.js | 2 +- lib/stream/xlsx/sheet-comments-writer.js | 4 +- lib/stream/xlsx/workbook-writer.js | 26 +++---- lib/stream/xlsx/worksheet-writer.js | 10 +-- lib/utils/cell-matrix.js | 4 +- lib/utils/iterate-stream.js | 8 +-- lib/utils/parse-sax.js | 8 +-- lib/utils/stream-base64.js | 2 +- lib/utils/stream-buf.js | 12 ++-- lib/utils/under-dash.js | 8 +-- lib/utils/utils.js | 14 ++-- lib/xlsx/xform/base-xform.js | 2 +- lib/xlsx/xform/book/defined-name-xform.js | 2 +- lib/xlsx/xform/book/workbook-xform.js | 8 +-- lib/xlsx/xform/comment/comment-xform.js | 2 +- lib/xlsx/xform/comment/comments-xform.js | 2 +- lib/xlsx/xform/comment/vml-notes-xform.js | 2 +- lib/xlsx/xform/comment/vml-textbox-xform.js | 4 +- .../xform/core/app-titles-of-parts-xform.js | 2 +- lib/xlsx/xform/core/content-types-xform.js | 8 +-- lib/xlsx/xform/core/relationships-xform.js | 2 +- lib/xlsx/xform/drawing/drawing-xform.js | 4 +- lib/xlsx/xform/list-xform.js | 2 +- lib/xlsx/xform/sheet/cell-xform.js | 2 +- .../conditional-formatting-ext-xform.js | 4 +- .../conditional-formattings-ext-xform.js | 6 +- .../xform/sheet/cf-ext/databar-ext-xform.js | 2 +- .../xform/sheet/cf-ext/icon-set-ext-xform.js | 2 +- lib/xlsx/xform/sheet/cf/cf-rule-xform.js | 8 +-- lib/xlsx/xform/sheet/cf/color-scale-xform.js | 4 +- .../sheet/cf/conditional-formatting-xform.js | 2 +- .../sheet/cf/conditional-formattings-xform.js | 12 ++-- lib/xlsx/xform/sheet/cf/databar-xform.js | 2 +- lib/xlsx/xform/sheet/cf/icon-set-xform.js | 2 +- .../xform/sheet/data-validations-xform.js | 8 +-- lib/xlsx/xform/sheet/merges.js | 4 +- .../xform/sheet/outline-properties-xform.js | 2 +- lib/xlsx/xform/sheet/page-margins-xform.js | 2 +- lib/xlsx/xform/sheet/page-setup-xform.js | 2 +- lib/xlsx/xform/sheet/print-options-xform.js | 2 +- lib/xlsx/xform/sheet/row-breaks-xform.js | 2 +- lib/xlsx/xform/sheet/row-xform.js | 8 +-- .../sheet/sheet-format-properties-xform.js | 2 +- .../xform/sheet/sheet-protection-xform.js | 2 +- lib/xlsx/xform/sheet/worksheet-xform.js | 30 ++++---- lib/xlsx/xform/static-xform.js | 2 +- lib/xlsx/xform/strings/phonetic-text-xform.js | 2 +- lib/xlsx/xform/strings/shared-string-xform.js | 2 +- .../xform/strings/shared-strings-xform.js | 2 +- lib/xlsx/xform/style/fill-xform.js | 2 +- lib/xlsx/xform/style/styles-xform.js | 12 ++-- lib/xlsx/xform/table/auto-filter-xform.js | 2 +- lib/xlsx/xform/table/table-xform.js | 2 +- lib/xlsx/xlsx.js | 30 ++++---- spec/browser/exceljs.spec.js | 18 ++--- ...ue-1328-xlsx-worksheet-reader-date.spec.js | 4 +- .../issues/issue-219-1904-dates.spec.js | 2 +- .../issue-234-vertical-tab-char.spec.js | 2 +- .../issues/issue-257-sheet-order.spec.js | 2 +- .../issue-275-hyperlink-query-param.spec.js | 2 +- .../issue-623-borders-for-merged-cell.spec.js | 4 +- .../issue-703-speciel-cell-file.spec.js | 2 +- .../issues/issue-991-csv-read-dates.spec.js | 2 +- .../integration/pr/pr-896/test-pr-896.spec.js | 2 +- spec/integration/pr/test-pr-1431.spec.js | 4 +- spec/integration/pr/test-pr-896.spec.js | 4 +- spec/integration/workbook-xlsx-reader.spec.js | 28 ++++---- .../workbook-xlsx-writer.spec.js | 26 +++---- spec/integration/workbook/images.spec.js | 12 ++-- spec/integration/workbook/styles.spec.js | 6 +- spec/integration/workbook/workbook.spec.js | 62 ++++++++-------- .../integration/worksheet-xlsx-writer.spec.js | 2 +- spec/integration/worksheet.spec.js | 12 ++-- spec/unit/doc/defined-names.spec.js | 4 +- spec/unit/doc/worksheet-table.spec.js | 2 +- spec/unit/doc/worksheet.values.spec.js | 4 +- spec/unit/utils/stream-buf.spec.js | 2 +- spec/unit/utils/utils.spec.js | 4 +- spec/unit/xlsx/xform/compy-xform.js | 6 +- spec/unit/xlsx/xform/test-xform-helper.js | 18 ++--- spec/utils/index.js | 4 +- .../test-conditional-formatting-sheet.js | 4 +- spec/utils/test-data-validation-sheet.js | 6 +- spec/utils/test-spliced-sheet.js | 72 +++++++++---------- spec/utils/test-values-sheet.js | 2 +- spec/utils/test-workbook-reader.js | 4 +- spec/utils/tools.js | 2 +- test/test-a1.js | 2 +- test/test-cf.js | 2 +- test/test-chart.js | 2 +- test/test-colour-cell.js | 2 +- test/test-comment-new.js | 2 +- test/test-comment-stream-writer.js | 2 +- test/test-comments.js | 2 +- test/test-copy.js | 2 +- test/test-default-height.js | 2 +- test/test-formula.js | 4 +- test/test-header-footer.js | 2 +- test/test-hyperlink.js | 2 +- test/test-image-one-cell-anchor.js | 2 +- test/test-image-oneCell.js | 2 +- test/test-image-out.js | 2 +- test/test-image-stream-writer.js | 2 +- test/test-jszip.js | 4 +- test/test-merge-align.js | 2 +- test/test-newline.js | 2 +- test/test-protection-spinCount.js | 2 +- test/test-protection.js | 2 +- test/test-table.js | 2 +- test/testArray.js | 2 +- test/testBigBookIn.js | 6 +- test/testBigBookOut.js | 2 +- test/testBookFont.js | 8 +-- test/testBookOut.js | 2 +- test/testBookOutS.js | 2 +- test/testBookRead.js | 4 +- test/testCsvOut.js | 2 +- test/testImageIn.js | 2 +- test/testMergedBorder.js | 2 +- test/testMultiplePrintAreaOut.js | 2 +- test/testPerformance.js | 12 ++-- test/testPrintAreaOut.js | 2 +- test/testPrintColRowOut.js | 2 +- test/testProcess.js | 4 +- test/testSax2.js | 6 +- test/testSharedStrings.js | 2 +- test/testStringBuf.js | 2 +- test/testStringtable.js | 2 +- test/testTemplate.js | 4 +- test/testXlsxIn.js | 2 +- test/utils/column-sum.js | 6 +- test/utils/utils.js | 4 +- 146 files changed, 443 insertions(+), 441 deletions(-) diff --git a/.eslintrc b/.eslintrc index b59db4aa1..9342c97f5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,6 +13,7 @@ "node": true }, "rules": { + "arrow-parens": ["error", "as-needed"], "class-methods-use-this": ["off"], "comma-dangle": ["error", {"arrays": "always-multiline", "objects": "always-multiline", "imports": "always-multiline", "exports": "always-multiline", "functions": "never"}], "default-case": ["off"], diff --git a/.prettier b/.prettier index 2f891b81a..dc9121c80 100644 --- a/.prettier +++ b/.prettier @@ -2,5 +2,6 @@ "bracketSpacing": false, "printWidth": 160, "trailingComma": "all", - "bracketSpacing": false + "bracketSpacing": true, + "arrowParens": "avoid" } diff --git a/benchmark.js b/benchmark.js index ce854a0ba..ca698f02d 100644 --- a/benchmark.js +++ b/benchmark.js @@ -13,10 +13,10 @@ const runs = 3; let worksheetCount = 0; let rowCount = 0; - workbookReader.on('worksheet', (worksheet) => { + workbookReader.on('worksheet', worksheet => { worksheetCount += 1; console.log(`Reading worksheet ${worksheetCount}`); - worksheet.on('row', (row) => { + worksheet.on('row', row => { rowCount += 1; if (rowCount % 50000 === 0) console.log(`Reading row ${rowCount}`); }); diff --git a/lib/csv/csv.js b/lib/csv/csv.js index 8bb95c840..fb6c70024 100644 --- a/lib/csv/csv.js +++ b/lib/csv/csv.js @@ -79,7 +79,7 @@ class CSV { const csvStream = fastCsv .parse(options.parserOptions) - .on('data', (data) => { + .on('data', data => { worksheet.addRow(data.map(map)); }) .on('end', () => { @@ -120,7 +120,7 @@ class CSV { const {dateFormat, dateUTC} = options; const map = options.map || - ((value) => { + (value => { if (value) { if (value.text || value.hyperlink) { return value.hyperlink || value.text || ''; diff --git a/lib/csv/line-buffer.js b/lib/csv/line-buffer.js index a97ea4254..8ea489c96 100644 --- a/lib/csv/line-buffer.js +++ b/lib/csv/line-buffer.js @@ -63,7 +63,7 @@ class LineBuffer extends EventEmitter { _flush() { if (!this.corked) { - this.queue.forEach((line) => { + this.queue.forEach(line => { this.emit('line', line); }); this.queue = []; diff --git a/lib/csv/stream-converter.js b/lib/csv/stream-converter.js index 49638c4ab..639aa5b7d 100644 --- a/lib/csv/stream-converter.js +++ b/lib/csv/stream-converter.js @@ -105,7 +105,7 @@ class StreamConverter { on(type, callback) { switch (type) { case 'data': - this.inner.on('data', (chunk) => { + this.inner.on('data', chunk => { callback(this.convertOutwards(chunk)); }); return this; diff --git a/lib/doc/cell.js b/lib/doc/cell.js index cf7fb3750..3ae2457a8 100644 --- a/lib/doc/cell.js +++ b/lib/doc/cell.js @@ -292,7 +292,7 @@ class Cell { set names(value) { const {definedNames} = this.workbook; definedNames.removeAllNames(this.fullAddress); - value.forEach((name) => { + value.forEach(name => { definedNames.addEx(this.fullAddress, name); }); } @@ -509,7 +509,7 @@ class RichTextValue { } toString() { - return this.model.value.richText.map((t) => t.text).join(''); + return this.model.value.richText.map(t => t.text).join(''); } get type() { @@ -748,7 +748,7 @@ class FormulaValue { _copyModel(model) { const copy = {}; - const cp = (name) => { + const cp = name => { const value = model[name]; if (value) { copy[name] = value; diff --git a/lib/doc/column.js b/lib/doc/column.js index 6283407e2..e5f8ceef0 100644 --- a/lib/doc/column.js +++ b/lib/doc/column.js @@ -198,7 +198,7 @@ class Column { // styles _applyStyle(name, value) { this.style[name] = value; - this.eachCell((cell) => { + this.eachCell(cell => { cell[name] = value; }); return value; diff --git a/lib/doc/defined-names.js b/lib/doc/defined-names.js index 522792f8a..597744207 100644 --- a/lib/doc/defined-names.js +++ b/lib/doc/defined-names.js @@ -54,14 +54,14 @@ class DefinedNames { } removeAllNames(location) { - _.each(this.matrixMap, (matrix) => { + _.each(this.matrixMap, matrix => { matrix.removeCellEx(location); }); } forEach(callback) { _.each(this.matrixMap, (matrix, name) => { - matrix.forEach((cell) => { + matrix.forEach(cell => { callback(name, cell); }); }); @@ -128,13 +128,13 @@ class DefinedNames { } // mark and sweep! - matrix.forEach((cell) => { + matrix.forEach(cell => { cell.mark = true; }); const ranges = matrix - .map((cell) => cell.mark && this._explore(matrix, cell)) + .map(cell => cell.mark && this._explore(matrix, cell)) .filter(Boolean) - .map((range) => range.$shortRange); + .map(range => range.$shortRange); return { name, @@ -157,14 +157,14 @@ class DefinedNames { } spliceRows(sheetName, start, numDelete, numInsert) { - _.each(this.matrixMap, (matrix) => { + _.each(this.matrixMap, matrix => { matrix.spliceRows(sheetName, start, numDelete, numInsert); this.normaliseMatrix(matrix, sheetName); }); } spliceColumns(sheetName, start, numDelete, numInsert) { - _.each(this.matrixMap, (matrix) => { + _.each(this.matrixMap, matrix => { matrix.spliceColumns(sheetName, start, numDelete, numInsert); this.normaliseMatrix(matrix, sheetName); }); @@ -172,15 +172,15 @@ class DefinedNames { get model() { // To get names per cell - just iterate over all names finding cells if they exist - return _.map(this.matrixMap, (matrix, name) => this.getRanges(name, matrix)).filter((definedName) => definedName.ranges.length); + return _.map(this.matrixMap, (matrix, name) => this.getRanges(name, matrix)).filter(definedName => definedName.ranges.length); } set model(value) { // value is [ { name, ranges }, ... ] const matrixMap = (this.matrixMap = {}); - value.forEach((definedName) => { + value.forEach(definedName => { const matrix = (matrixMap[definedName.name] = new CellMatrix()); - definedName.ranges.forEach((rangeStr) => { + definedName.ranges.forEach(rangeStr => { if (rangeRegexp.test(rangeStr.split('!').pop() || '')) { matrix.addCell(rangeStr); } diff --git a/lib/doc/row.js b/lib/doc/row.js index caa1c1895..520cc7fe9 100644 --- a/lib/doc/row.js +++ b/lib/doc/row.js @@ -165,7 +165,7 @@ class Row { // return a sparse array of cell values get values() { const values = []; - this._cells.forEach((cell) => { + this._cells.forEach(cell => { if (cell && cell.type !== Enums.ValueType.Null) { values[cell.col] = cell.value; } @@ -210,7 +210,7 @@ class Row { // returns true if the row includes at least one cell with a value get hasValues() { - return _.some(this._cells, (cell) => cell && cell.type !== Enums.ValueType.Null); + return _.some(this._cells, cell => cell && cell.type !== Enums.ValueType.Null); } get cellCount() { @@ -229,7 +229,7 @@ class Row { get dimensions() { let min = 0; let max = 0; - this._cells.forEach((cell) => { + this._cells.forEach(cell => { if (cell && cell.type !== Enums.ValueType.Null) { if (!min || min > cell.col) { min = cell.col; @@ -251,7 +251,7 @@ class Row { // styles _applyStyle(name, value) { this.style[name] = value; - this._cells.forEach((cell) => { + this._cells.forEach(cell => { if (cell) { cell[name] = value; } @@ -332,7 +332,7 @@ class Row { const cells = []; let min = 0; let max = 0; - this._cells.forEach((cell) => { + this._cells.forEach(cell => { if (cell) { const cellModel = cell.model; if (cellModel) { @@ -368,7 +368,7 @@ class Row { } this._cells = []; let previousAddress; - value.cells.forEach((cellModel) => { + value.cells.forEach(cellModel => { switch (cellModel.type) { case Cell.Types.Merge: // special case - don't add this types diff --git a/lib/doc/table.js b/lib/doc/table.js index a5c565ed8..87a96d29c 100644 --- a/lib/doc/table.js +++ b/lib/doc/table.js @@ -182,7 +182,7 @@ class Table { // the sheet... const assignStyle = (cell, style) => { if (style) { - Object.keys(style).forEach((key) => { + Object.keys(style).forEach(key => { cell[key] = style[key]; }); } @@ -200,7 +200,7 @@ class Table { assignStyle(cell, style); }); } - table.rows.forEach((data) => { + table.rows.forEach(data => { const r = worksheet.getRow(row + count++); data.forEach((value, j) => { const cell = r.getCell(col + j); @@ -245,7 +245,7 @@ class Table { cell.value = column.name; }); } - table.rows.forEach((data) => { + table.rows.forEach(data => { const r = worksheet.getRow(row + count++); data.forEach((value, j) => { const cell = r.getCell(col + j); @@ -379,7 +379,7 @@ class Table { this.cacheState(); this.table.columns.splice(colIndex, count); - this.table.rows.forEach((row) => { + this.table.rows.forEach(row => { row.splice(colIndex, count); }); } diff --git a/lib/doc/workbook.js b/lib/doc/workbook.js index a828b1259..98c42c0ea 100644 --- a/lib/doc/workbook.js +++ b/lib/doc/workbook.js @@ -51,7 +51,7 @@ class Workbook { console.warn(`Worksheet name ${name} exceeds 31 chars. This will be truncated`); } name = (name || `sheet${id}`).substring(0, 31); - if (this._worksheets.find((ws) => ws && ws.name.toLowerCase() === name.toLowerCase())) { + if (this._worksheets.find(ws => ws && ws.name.toLowerCase() === name.toLowerCase())) { throw new Error(`Worksheet name already exists: ${name}`); } @@ -109,7 +109,7 @@ class Workbook { return this._worksheets[id]; } if (typeof id === 'string') { - return this._worksheets.find((worksheet) => worksheet && worksheet.name === id); + return this._worksheets.find(worksheet => worksheet && worksheet.name === id); } return undefined; } @@ -123,7 +123,7 @@ class Workbook { } eachSheet(iteratee) { - this.worksheets.forEach((sheet) => { + this.worksheets.forEach(sheet => { iteratee(sheet, sheet.id); }); } @@ -156,8 +156,8 @@ class Workbook { created: this.created, modified: this.modified, properties: this.properties, - worksheets: this.worksheets.map((worksheet) => worksheet.model), - sheets: this.worksheets.map((ws) => ws.model).filter(Boolean), + worksheets: this.worksheets.map(worksheet => worksheet.model), + sheets: this.worksheets.map(ws => ws.model).filter(Boolean), definedNames: this._definedNames.model, views: this.views, company: this.company, @@ -196,9 +196,9 @@ class Workbook { this.properties = value.properties; this.calcProperties = value.calcProperties; this._worksheets = []; - value.worksheets.forEach((worksheetModel) => { + value.worksheets.forEach(worksheetModel => { const {id, name, state} = worksheetModel; - const orderNo = value.sheets && value.sheets.findIndex((ws) => ws.id === id); + const orderNo = value.sheets && value.sheets.findIndex(ws => ws.id === id); const worksheet = (this._worksheets[id] = new Worksheet({ id, name, diff --git a/lib/doc/worksheet.js b/lib/doc/worksheet.js index f738318d0..b1ca37852 100644 --- a/lib/doc/worksheet.js +++ b/lib/doc/worksheet.js @@ -135,7 +135,7 @@ class Worksheet { // Get the bounding range of the cells in this worksheet get dimensions() { const dimensions = new Range(); - this._rows.forEach((row) => { + this._rows.forEach(row => { if (row) { const rowDims = row.dimensions; if (rowDims) { @@ -166,7 +166,7 @@ class Worksheet { // construct Column objects let count = 1; const columns = (this._columns = []); - value.forEach((defn) => { + value.forEach(defn => { const column = new Column(this, count++, false); columns.push(column); column.defn = defn; @@ -219,7 +219,7 @@ class Worksheet { for (let i = 0; i < nRows; i++) { const rowArguments = [start, count]; // eslint-disable-next-line no-loop-func - inserts.forEach((insert) => { + inserts.forEach(insert => { rowArguments.push(insert[i] || null); }); const row = this.getRow(i + 1); @@ -228,7 +228,7 @@ class Worksheet { } } else { // nothing to insert, so just splice all rows - this._rows.forEach((r) => { + this._rows.forEach(r => { if (r) { r.splice(start, count); } @@ -258,7 +258,7 @@ class Worksheet { get columnCount() { let maxCount = 0; - this.eachRow((row) => { + this.eachRow(row => { maxCount = Math.max(maxCount, row.cellCount); }); return maxCount; @@ -268,7 +268,7 @@ class Worksheet { // performance nightmare - for each row, counts all the columns used const counts = []; let count = 0; - this.eachRow((row) => { + this.eachRow(row => { row.eachCell(({col}) => { if (!counts[col]) { counts[col] = true; @@ -359,7 +359,7 @@ class Worksheet { addRows(value, style = 'n') { const rows = []; - value.forEach((row) => { + value.forEach(row => { rows.push(this.addRow(row, style)); }); return rows; @@ -493,7 +493,7 @@ class Worksheet { iteratee(this.getRow(i), i); } } else { - this._rows.forEach((row) => { + this._rows.forEach(row => { if (row && row.hasValues) { iteratee(row, row.number); } @@ -504,7 +504,7 @@ class Worksheet { // return all rows as sparse array getSheetValues() { const rows = []; - this._rows.forEach((row) => { + this._rows.forEach(row => { if (row) { rows[row.number] = row.values; } @@ -545,7 +545,7 @@ class Worksheet { _mergeCellsInternal(dimensions, ignoreStyle) { // check cells aren't already merged - _.each(this._merges, (merge) => { + _.each(this._merges, merge => { if (merge.intersects(dimensions)) { throw new Error('Cannot merge already merged cells'); } @@ -666,7 +666,7 @@ class Worksheet { } getImages() { - return this._media.filter((m) => m.type === 'image'); + return this._media.filter(m => m.type === 'image'); } addBackgroundImage(imageId) { @@ -678,7 +678,7 @@ class Worksheet { } getBackgroundImageId() { - const image = this._media.find((m) => m.type === 'background'); + const image = this._media.find(m => m.type === 'background'); return image && image.imageId; } @@ -687,7 +687,7 @@ class Worksheet { protect(password, options) { // TODO: make this function truly async // perhaps marshal to worker thread or something - return new Promise((resolve) => { + return new Promise(resolve => { this.sheetProtection = { sheet: true, }; @@ -780,9 +780,9 @@ class Worksheet { rowBreaks: this.rowBreaks, views: this.views, autoFilter: this.autoFilter, - media: this._media.map((medium) => medium.model), + media: this._media.map(medium => medium.model), sheetProtection: this.sheetProtection, - tables: Object.values(this.tables).map((table) => table.model), + tables: Object.values(this.tables).map(table => table.model), conditionalFormattings: this.conditionalFormattings, }; @@ -794,7 +794,7 @@ class Worksheet { // Rows const rows = (model.rows = []); const dimensions = (model.dimensions = new Range()); - this._rows.forEach((row) => { + this._rows.forEach(row => { const rowModel = row && row.model; if (rowModel) { dimensions.expand(rowModel.number, rowModel.min, rowModel.number, rowModel.max); @@ -805,7 +805,7 @@ class Worksheet { // ========================================================== // Merges model.merges = []; - _.each(this._merges, (merge) => { + _.each(this._merges, merge => { model.merges.push(merge.range); }); @@ -814,7 +814,7 @@ class Worksheet { _parseRows(model) { this._rows = []; - model.rows.forEach((rowModel) => { + model.rows.forEach(rowModel => { const row = new Row(this, rowModel.number); this._rows[row.number - 1] = row; row.model = rowModel; @@ -822,7 +822,7 @@ class Worksheet { } _parseMergeCells(model) { - _.each(model.mergeCells, (merge) => { + _.each(model.mergeCells, merge => { // Do not merge styles when importing an Excel file // since each cell may have different styles intentionally. this.mergeCellsWithoutStyle(merge); @@ -841,7 +841,7 @@ class Worksheet { this.headerFooter = value.headerFooter; this.views = value.views; this.autoFilter = value.autoFilter; - this._media = value.media.map((medium) => new Image(this, medium)); + this._media = value.media.map(medium => new Image(this, medium)); this.sheetProtection = value.sheetProtection; this.tables = value.tables.reduce((tables, table) => { const t = new Table(); diff --git a/lib/exceljs.bare.js b/lib/exceljs.bare.js index 922831efc..9f00471f8 100644 --- a/lib/exceljs.bare.js +++ b/lib/exceljs.bare.js @@ -6,7 +6,7 @@ const ExcelJS = { // Object.assign mono-fill const Enums = require('./doc/enums'); -Object.keys(Enums).forEach((key) => { +Object.keys(Enums).forEach(key => { ExcelJS[key] = Enums[key]; }); diff --git a/lib/exceljs.browser.js b/lib/exceljs.browser.js index aecd27422..3a3d631dc 100644 --- a/lib/exceljs.browser.js +++ b/lib/exceljs.browser.js @@ -13,7 +13,7 @@ const ExcelJS = { // Object.assign mono-fill const Enums = require('./doc/enums'); -Object.keys(Enums).forEach((key) => { +Object.keys(Enums).forEach(key => { ExcelJS[key] = Enums[key]; }); diff --git a/lib/stream/xlsx/sheet-comments-writer.js b/lib/stream/xlsx/sheet-comments-writer.js index fb86ea7fd..e241e9add 100644 --- a/lib/stream/xlsx/sheet-comments-writer.js +++ b/lib/stream/xlsx/sheet-comments-writer.js @@ -98,11 +98,11 @@ class SheetCommentsWriter { this.startedData = true; } - comments.forEach((item) => { + comments.forEach(item => { item.refAddress = colCache.decodeAddress(item.ref); }); - comments.forEach((comment) => { + comments.forEach(comment => { this._writeComment(comment, this.count); this.count += 1; }); diff --git a/lib/stream/xlsx/workbook-writer.js b/lib/stream/xlsx/workbook-writer.js index 31eb056e7..6816c58d6 100644 --- a/lib/stream/xlsx/workbook-writer.js +++ b/lib/stream/xlsx/workbook-writer.js @@ -77,7 +77,7 @@ class WorkbookWriter { _commitWorksheets() { const commitWorksheet = function(worksheet) { if (!worksheet.committed) { - return new Promise((resolve) => { + return new Promise(resolve => { worksheet.stream.on('zipped', () => { resolve(); }); @@ -172,27 +172,27 @@ class WorkbookWriter { return this._worksheets[id]; } if (typeof id === 'string') { - return this._worksheets.find((worksheet) => worksheet && worksheet.name === id); + return this._worksheets.find(worksheet => worksheet && worksheet.name === id); } return undefined; } addStyles() { - return new Promise((resolve) => { + return new Promise(resolve => { this.zip.append(this.styles.xml, {name: 'xl/styles.xml'}); resolve(); }); } addThemes() { - return new Promise((resolve) => { + return new Promise(resolve => { this.zip.append(theme1Xml, {name: 'xl/theme/theme1.xml'}); resolve(); }); } addOfficeRels() { - return new Promise((resolve) => { + return new Promise(resolve => { const xform = new RelationshipsXform(); const xml = xform.toXml([ {Id: 'rId1', Type: RelType.OfficeDocument, Target: 'xl/workbook.xml'}, @@ -205,7 +205,7 @@ class WorkbookWriter { } addContentTypes() { - return new Promise((resolve) => { + return new Promise(resolve => { const model = { worksheets: this._worksheets.filter(Boolean), sharedStrings: this.sharedStrings, @@ -221,7 +221,7 @@ class WorkbookWriter { addMedia() { return Promise.all( - this.media.map((medium) => { + this.media.map(medium => { if (medium.type === 'image') { const filename = `xl/media/${medium.name}`; if (medium.filename) { @@ -242,7 +242,7 @@ class WorkbookWriter { } addApp() { - return new Promise((resolve) => { + return new Promise(resolve => { const model = { worksheets: this._worksheets.filter(Boolean), }; @@ -254,7 +254,7 @@ class WorkbookWriter { } addCore() { - return new Promise((resolve) => { + return new Promise(resolve => { const coreXform = new CoreXform(); const xml = coreXform.toXml(this); this.zip.append(xml, {name: 'docProps/core.xml'}); @@ -264,7 +264,7 @@ class WorkbookWriter { addSharedStrings() { if (this.sharedStrings.count) { - return new Promise((resolve) => { + return new Promise(resolve => { const sharedStringsXform = new SharedStringsXform(); const xml = sharedStringsXform.toXml(this.sharedStrings); this.zip.append(xml, {name: '/xl/sharedStrings.xml'}); @@ -283,13 +283,13 @@ class WorkbookWriter { if (this.sharedStrings.count) { relationships.push({Id: `rId${count++}`, Type: RelType.SharedStrings, Target: 'sharedStrings.xml'}); } - this._worksheets.forEach((worksheet) => { + this._worksheets.forEach(worksheet => { if (worksheet) { worksheet.rId = `rId${count++}`; relationships.push({Id: worksheet.rId, Type: RelType.Worksheet, Target: `worksheets/sheet${worksheet.id}.xml`}); } }); - return new Promise((resolve) => { + return new Promise(resolve => { const xform = new RelationshipsXform(); const xml = xform.toXml(relationships); this.zip.append(xml, {name: '/xl/_rels/workbook.xml.rels'}); @@ -307,7 +307,7 @@ class WorkbookWriter { calcProperties: {}, }; - return new Promise((resolve) => { + return new Promise(resolve => { const xform = new WorkbookXform(); xform.prepare(model); zip.append(xform.toXml(model), {name: '/xl/workbook.xml'}); diff --git a/lib/stream/xlsx/worksheet-writer.js b/lib/stream/xlsx/worksheet-writer.js index ea34aa8fb..47a199c62 100644 --- a/lib/stream/xlsx/worksheet-writer.js +++ b/lib/stream/xlsx/worksheet-writer.js @@ -209,7 +209,7 @@ class WorksheetWriter { return; } // commit all rows - this._rows.forEach((cRow) => { + this._rows.forEach(cRow => { if (cRow) { // write the row to the stream this._writeRow(cRow); @@ -282,7 +282,7 @@ class WorksheetWriter { // construct Column objects let count = 1; const columns = (this._columns = []); - value.forEach((defn) => { + value.forEach(defn => { const column = new Column(this, count++, false); columns.push(column); column.defn = defn; @@ -346,7 +346,7 @@ class WorksheetWriter { iteratee(this.getRow(i), i); } } else { - this._rows.forEach((row) => { + this._rows.forEach(row => { if (row.hasValues) { iteratee(row, row.number); } @@ -425,7 +425,7 @@ class WorksheetWriter { const dimensions = new Dimensions(cells); // check cells aren't already merged - this._merges.forEach((merge) => { + this._merges.forEach(merge => { if (merge.intersects(dimensions)) { throw new Error('Cannot merge already merged cells'); } @@ -581,7 +581,7 @@ class WorksheetWriter { if (this._merges.length) { xmlBuffer.reset(); xmlBuffer.addText(``); - this._merges.forEach((merge) => { + this._merges.forEach(merge => { xmlBuffer.addText(``); }); xmlBuffer.addText(''); diff --git a/lib/utils/cell-matrix.js b/lib/utils/cell-matrix.js index 92ec91b40..121b5141d 100644 --- a/lib/utils/cell-matrix.js +++ b/lib/utils/cell-matrix.js @@ -96,7 +96,7 @@ class CellMatrix { map(callback) { const results = []; - this.forEach((cell) => { + this.forEach(cell => { results.push(callback(cell)); }); return results; @@ -153,7 +153,7 @@ class CellMatrix { for (let i = 0; i < numInsert; i++) { inserts.push(null); } - _.each(sheet, (row) => { + _.each(sheet, row => { row.splice(start, numDelete, ...inserts); }); } diff --git a/lib/utils/iterate-stream.js b/lib/utils/iterate-stream.js index aa8d62597..08b974e9a 100644 --- a/lib/utils/iterate-stream.js +++ b/lib/utils/iterate-stream.js @@ -1,9 +1,9 @@ module.exports = async function* iterateStream(stream) { const contents = []; - stream.on('data', (data) => contents.push(data)); + stream.on('data', data => contents.push(data)); let resolveStreamEndedPromise; - const streamEndedPromise = new Promise((resolve) => (resolveStreamEndedPromise = resolve)); + const streamEndedPromise = new Promise(resolve => (resolveStreamEndedPromise = resolve)); let ended = false; stream.on('end', () => { @@ -12,7 +12,7 @@ module.exports = async function* iterateStream(stream) { }); let error = false; - stream.on('error', (err) => { + stream.on('error', err => { error = err; resolveStreamEndedPromise(); }); @@ -34,7 +34,7 @@ module.exports = async function* iterateStream(stream) { function once(eventEmitter, type) { // TODO: Use require('events').once when node v10 is dropped - return new Promise((resolve) => { + return new Promise(resolve => { let fired = false; const handler = () => { if (!fired) { diff --git a/lib/utils/parse-sax.js b/lib/utils/parse-sax.js index 474a8d998..d3a53a497 100644 --- a/lib/utils/parse-sax.js +++ b/lib/utils/parse-sax.js @@ -9,13 +9,13 @@ module.exports = async function* (iterable) { } const saxesParser = new SaxesParser(); let error; - saxesParser.on('error', (err) => { + saxesParser.on('error', err => { error = err; }); let events = []; - saxesParser.on('opentag', (value) => events.push({eventType: 'opentag', value})); - saxesParser.on('text', (value) => events.push({eventType: 'text', value})); - saxesParser.on('closetag', (value) => events.push({eventType: 'closetag', value})); + saxesParser.on('opentag', value => events.push({eventType: 'opentag', value})); + saxesParser.on('text', value => events.push({eventType: 'text', value})); + saxesParser.on('closetag', value => events.push({eventType: 'closetag', value})); for await (const chunk of iterable) { saxesParser.write(chunk.toString()); // saxesParser.write and saxesParser.on() are synchronous, diff --git a/lib/utils/stream-base64.js b/lib/utils/stream-base64.js index 249ea643f..b73002081 100644 --- a/lib/utils/stream-base64.js +++ b/lib/utils/stream-base64.js @@ -54,7 +54,7 @@ class StreamBase64 extends Stream.Duplex { unpipe(destination) { // remove destination from pipe list - this.pipes = this.pipes.filter((pipe) => pipe !== destination); + this.pipes = this.pipes.filter(pipe => pipe !== destination); } unshift(/* chunk */) { diff --git a/lib/utils/stream-buf.js b/lib/utils/stream-buf.js index b31eb75b9..90a46b28a 100644 --- a/lib/utils/stream-buf.js +++ b/lib/utils/stream-buf.js @@ -176,7 +176,7 @@ utils.inherits(StreamBuf, Stream.Duplex, { case 1: return this.buffers[0].toBuffer(); default: - return Buffer.concat(this.buffers.map((rwBuf) => rwBuf.toBuffer())); + return Buffer.concat(this.buffers.map(rwBuf => rwBuf.toBuffer())); } }, @@ -201,7 +201,7 @@ utils.inherits(StreamBuf, Stream.Duplex, { async _pipe(chunk) { const write = function(pipe) { - return new Promise((resolve) => { + return new Promise(resolve => { pipe.write(chunk.toBuffer(), () => { resolve(); }); @@ -281,12 +281,12 @@ utils.inherits(StreamBuf, Stream.Duplex, { this._flush(); }, end(chunk, encoding, callback) { - const writeComplete = (error) => { + const writeComplete = error => { if (error) { callback(error); } else { this._flush(); - this.pipes.forEach((pipe) => { + this.pipes.forEach(pipe => { pipe.end(); }); this.emit('finish'); @@ -322,7 +322,7 @@ utils.inherits(StreamBuf, Stream.Duplex, { return Buffer.concat(buffers); } - buffers = this.buffers.map((buf) => buf.toBuffer()).filter(Boolean); + buffers = this.buffers.map(buf => buf.toBuffer()).filter(Boolean); this.buffers = []; return Buffer.concat(buffers); }, @@ -348,7 +348,7 @@ utils.inherits(StreamBuf, Stream.Duplex, { }, unpipe(destination) { // remove destination from pipe list - this.pipes = this.pipes.filter((pipe) => pipe !== destination); + this.pipes = this.pipes.filter(pipe => pipe !== destination); }, unshift(/* chunk */) { // some numpty has read some data that's not for them and they want to put it back! diff --git a/lib/utils/under-dash.js b/lib/utils/under-dash.js index 89ca2c92a..150e1d2a3 100644 --- a/lib/utils/under-dash.js +++ b/lib/utils/under-dash.js @@ -6,7 +6,7 @@ const _ = { if (Array.isArray(obj)) { obj.forEach(cb); } else { - Object.keys(obj).forEach((key) => { + Object.keys(obj).forEach(key => { cb(obj[key], key); }); } @@ -18,7 +18,7 @@ const _ = { if (Array.isArray(obj)) { return obj.some(cb); } - return Object.keys(obj).some((key) => cb(obj[key], key)); + return Object.keys(obj).some(key => cb(obj[key], key)); } return false; }, @@ -28,7 +28,7 @@ const _ = { if (Array.isArray(obj)) { return obj.every(cb); } - return Object.keys(obj).every((key) => cb(obj[key], key)); + return Object.keys(obj).every(key => cb(obj[key], key)); } return true; }, @@ -38,7 +38,7 @@ const _ = { if (Array.isArray(obj)) { return obj.map(cb); } - return Object.keys(obj).map((key) => cb(obj[key], key)); + return Object.keys(obj).map(key => cb(obj[key], key)); } return []; }, diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 63c7c5a9e..f13669a87 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -11,7 +11,7 @@ const inherits = function(cls, superCtor, statics, prototype) { } if (statics) { - Object.keys(statics).forEach((i) => { + Object.keys(statics).forEach(i => { Object.defineProperty(cls, i, Object.getOwnPropertyDescriptor(statics, i)); }); } @@ -25,7 +25,7 @@ const inherits = function(cls, superCtor, statics, prototype) { }, }; if (prototype) { - Object.keys(prototype).forEach((i) => { + Object.keys(prototype).forEach(i => { properties[i] = Object.getOwnPropertyDescriptor(prototype, i); }); } @@ -36,7 +36,7 @@ const inherits = function(cls, superCtor, statics, prototype) { const utils = { nop() {}, promiseImmediate(value) { - return new Promise((resolve) => { + return new Promise(resolve => { if (global.setImmediate) { setImmediate(() => { resolve(value); @@ -70,7 +70,7 @@ const utils = { }, xmlEncode(text) { // eslint-disable-next-line no-control-regex - return text.replace(/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/g, (c) => { + return text.replace(/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/g, c => { switch (c) { case '<': return '<'; @@ -88,7 +88,7 @@ const utils = { }); }, xmlDecode(text) { - return text.replace(/&([a-z]*);/, (c) => { + return text.replace(/&([a-z]*);/, c => { switch (c) { case '<': return '<'; @@ -125,8 +125,8 @@ const utils = { fs: { exists(path) { - return new Promise((resolve) => { - fs.access(path, fs.constants.F_OK, (err) => { + return new Promise(resolve => { + fs.access(path, fs.constants.F_OK, err => { resolve(!err); }); }); diff --git a/lib/xlsx/xform/base-xform.js b/lib/xlsx/xform/base-xform.js index 6e4efa0e3..cb48cfa09 100644 --- a/lib/xlsx/xform/base-xform.js +++ b/lib/xlsx/xform/base-xform.js @@ -41,7 +41,7 @@ class BaseXform { // if we have a map - reset them too if (this.map) { - Object.values(this.map).forEach((xform) => { + Object.values(this.map).forEach(xform => { if (xform instanceof BaseXform) { xform.reset(); } else if (xform.xform) { diff --git a/lib/xlsx/xform/book/defined-name-xform.js b/lib/xlsx/xform/book/defined-name-xform.js index 1beafd284..9ed8fec0d 100644 --- a/lib/xlsx/xform/book/defined-name-xform.js +++ b/lib/xlsx/xform/book/defined-name-xform.js @@ -56,7 +56,7 @@ function extractRanges(parsedText) { const ranges = []; let quotesOpened = false; let last = ''; - parsedText.split(',').forEach((item) => { + parsedText.split(',').forEach(item => { if (!item) { return; } diff --git a/lib/xlsx/xform/book/workbook-xform.js b/lib/xlsx/xform/book/workbook-xform.js index 418b848a5..2047d72c8 100644 --- a/lib/xlsx/xform/book/workbook-xform.js +++ b/lib/xlsx/xform/book/workbook-xform.js @@ -32,9 +32,9 @@ class WorkbookXform extends BaseXform { // collate all the print areas from all of the sheets and add them to the defined names const printAreas = []; let index = 0; // sheets is sparse array - calc index manually - model.sheets.forEach((sheet) => { + model.sheets.forEach(sheet => { if (sheet.pageSetup && sheet.pageSetup.printArea) { - sheet.pageSetup.printArea.split('&&').forEach((printArea) => { + sheet.pageSetup.printArea.split('&&').forEach(printArea => { const printAreaComponents = printArea.split(':'); const definedName = { name: '_xlnm.Print_Area', @@ -152,7 +152,7 @@ class WorkbookXform extends BaseXform { let worksheet; let index = 0; - (model.sheets || []).forEach((sheet) => { + (model.sheets || []).forEach(sheet => { const rel = rels[sheet.rId]; if (!rel) { return; @@ -175,7 +175,7 @@ class WorkbookXform extends BaseXform { // reconcile print areas const definedNames = []; - _.each(model.definedNames, (definedName) => { + _.each(model.definedNames, definedName => { if (definedName.name === '_xlnm.Print_Area') { worksheet = worksheets[definedName.localSheetId]; if (worksheet) { diff --git a/lib/xlsx/xform/comment/comment-xform.js b/lib/xlsx/xform/comment/comment-xform.js index 59b49c77a..16363bfea 100644 --- a/lib/xlsx/xform/comment/comment-xform.js +++ b/lib/xlsx/xform/comment/comment-xform.js @@ -51,7 +51,7 @@ utils.inherits(CommentXform, BaseXform, { }); xmlStream.openNode('text'); if (model && model.note && model.note.texts) { - model.note.texts.forEach((text) => { + model.note.texts.forEach(text => { this.richTextXform.render(xmlStream, text); }); } diff --git a/lib/xlsx/xform/comment/comments-xform.js b/lib/xlsx/xform/comment/comments-xform.js index b3ca65b7f..c301bb00e 100644 --- a/lib/xlsx/xform/comment/comments-xform.js +++ b/lib/xlsx/xform/comment/comments-xform.js @@ -32,7 +32,7 @@ utils.inherits( // comments xmlStream.openNode('commentList'); - model.comments.forEach((comment) => { + model.comments.forEach(comment => { this.map.comment.render(xmlStream, comment); }); xmlStream.closeNode(); diff --git a/lib/xlsx/xform/comment/vml-notes-xform.js b/lib/xlsx/xform/comment/vml-notes-xform.js index e8dceeff1..28fe95474 100644 --- a/lib/xlsx/xform/comment/vml-notes-xform.js +++ b/lib/xlsx/xform/comment/vml-notes-xform.js @@ -83,7 +83,7 @@ class VmlNotesXform extends BaseXform { } reconcile(model, options) { - model.anchors.forEach((anchor) => { + model.anchors.forEach(anchor => { if (anchor.br) { this.map['xdr:twoCellAnchor'].reconcile(anchor, options); } else { diff --git a/lib/xlsx/xform/comment/vml-textbox-xform.js b/lib/xlsx/xform/comment/vml-textbox-xform.js index a664dc86c..95f28d934 100644 --- a/lib/xlsx/xform/comment/vml-textbox-xform.js +++ b/lib/xlsx/xform/comment/vml-textbox-xform.js @@ -10,7 +10,7 @@ class VmlTextboxXform extends BaseXform { } reverseConversionUnit(inset) { - return (inset || '').split(',').map((margin) => { + return (inset || '').split(',').map(margin => { return Number(parseFloat(this.conversionUnit(parseFloat(margin), 0.1, '')).toFixed(2)); }); } @@ -23,7 +23,7 @@ class VmlTextboxXform extends BaseXform { let {inset} = model.note && model.note.margins; if (Array.isArray(inset)) { inset = inset - .map((margin) => { + .map(margin => { return this.conversionUnit(margin, 10, 'mm'); }) .join(','); diff --git a/lib/xlsx/xform/core/app-titles-of-parts-xform.js b/lib/xlsx/xform/core/app-titles-of-parts-xform.js index 06eac551c..e276a6fef 100644 --- a/lib/xlsx/xform/core/app-titles-of-parts-xform.js +++ b/lib/xlsx/xform/core/app-titles-of-parts-xform.js @@ -5,7 +5,7 @@ class AppTitlesOfPartsXform extends BaseXform { xmlStream.openNode('TitlesOfParts'); xmlStream.openNode('vt:vector', {size: model.length, baseType: 'lpstr'}); - model.forEach((sheet) => { + model.forEach(sheet => { xmlStream.leafNode('vt:lpstr', undefined, sheet.name); }); diff --git a/lib/xlsx/xform/core/content-types-xform.js b/lib/xlsx/xform/core/content-types-xform.js index 98b0d1ab9..d3babcf61 100644 --- a/lib/xlsx/xform/core/content-types-xform.js +++ b/lib/xlsx/xform/core/content-types-xform.js @@ -11,7 +11,7 @@ class ContentTypesXform extends BaseXform { xmlStream.openNode('Types', ContentTypesXform.PROPERTY_ATTRIBUTES); const mediaHash = {}; - (model.media || []).forEach((medium) => { + (model.media || []).forEach(medium => { if (medium.type === 'image') { const imageType = medium.extension; if (!mediaHash[imageType]) { @@ -29,7 +29,7 @@ class ContentTypesXform extends BaseXform { ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml', }); - model.worksheets.forEach((worksheet) => { + model.worksheets.forEach(worksheet => { const name = `/xl/worksheets/sheet${worksheet.id}.xml`; xmlStream.leafNode('Override', {PartName: name, ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'}); }); @@ -46,7 +46,7 @@ class ContentTypesXform extends BaseXform { } if (model.tables) { - model.tables.forEach((table) => { + model.tables.forEach(table => { xmlStream.leafNode('Override', { PartName: `/xl/tables/${table.target}`, ContentType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml', @@ -55,7 +55,7 @@ class ContentTypesXform extends BaseXform { } if (model.drawings) { - model.drawings.forEach((drawing) => { + model.drawings.forEach(drawing => { xmlStream.leafNode('Override', { PartName: `/xl/drawings/${drawing.name}.xml`, ContentType: 'application/vnd.openxmlformats-officedocument.drawing+xml', diff --git a/lib/xlsx/xform/core/relationships-xform.js b/lib/xlsx/xform/core/relationships-xform.js index a2ce46642..ead7227d4 100644 --- a/lib/xlsx/xform/core/relationships-xform.js +++ b/lib/xlsx/xform/core/relationships-xform.js @@ -17,7 +17,7 @@ class RelationshipsXform extends BaseXform { xmlStream.openXml(XmlStream.StdDocAttributes); xmlStream.openNode('Relationships', RelationshipsXform.RELATIONSHIPS_ATTRIBUTES); - model.forEach((relationship) => { + model.forEach(relationship => { this.map.Relationship.render(xmlStream, relationship); }); diff --git a/lib/xlsx/xform/drawing/drawing-xform.js b/lib/xlsx/xform/drawing/drawing-xform.js index 1f782cf71..6bc4c43d8 100644 --- a/lib/xlsx/xform/drawing/drawing-xform.js +++ b/lib/xlsx/xform/drawing/drawing-xform.js @@ -37,7 +37,7 @@ class DrawingXform extends BaseXform { xmlStream.openXml(XmlStream.StdDocAttributes); xmlStream.openNode(this.tag, DrawingXform.DRAWING_ATTRIBUTES); - model.anchors.forEach((item) => { + model.anchors.forEach(item => { const anchor = this.map[item.anchorType]; anchor.render(xmlStream, item); }); @@ -91,7 +91,7 @@ class DrawingXform extends BaseXform { } reconcile(model, options) { - model.anchors.forEach((anchor) => { + model.anchors.forEach(anchor => { if (anchor.br) { this.map['xdr:twoCellAnchor'].reconcile(anchor, options); } else { diff --git a/lib/xlsx/xform/list-xform.js b/lib/xlsx/xform/list-xform.js index dac28904d..aeac91f4e 100644 --- a/lib/xlsx/xform/list-xform.js +++ b/lib/xlsx/xform/list-xform.js @@ -85,7 +85,7 @@ class ListXform extends BaseXform { reconcile(model, options) { if (model) { const {childXform} = this; - model.forEach((childModel) => { + model.forEach(childModel => { childXform.reconcile(childModel, options); }); } diff --git a/lib/xlsx/xform/sheet/cell-xform.js b/lib/xlsx/xform/sheet/cell-xform.js index 7fe3cedfd..2e78bf36c 100644 --- a/lib/xlsx/xform/sheet/cell-xform.js +++ b/lib/xlsx/xform/sheet/cell-xform.js @@ -233,7 +233,7 @@ class CellXform extends BaseXform { } else if (model.value && model.value.richText) { xmlStream.addAttribute('t', 'inlineStr'); xmlStream.openNode('is'); - model.value.richText.forEach((text) => { + model.value.richText.forEach(text => { this.richTextXForm.render(xmlStream, text); }); xmlStream.closeNode('is'); diff --git a/lib/xlsx/xform/sheet/cf-ext/conditional-formatting-ext-xform.js b/lib/xlsx/xform/sheet/cf-ext/conditional-formatting-ext-xform.js index 8043099be..d0e9c3bc0 100644 --- a/lib/xlsx/xform/sheet/cf-ext/conditional-formatting-ext-xform.js +++ b/lib/xlsx/xform/sheet/cf-ext/conditional-formatting-ext-xform.js @@ -18,7 +18,7 @@ class ConditionalFormattingExtXform extends CompositeXform { } prepare(model, options) { - model.rules.forEach((rule) => { + model.rules.forEach(rule => { this.cfRule.prepare(rule, options); }); } @@ -32,7 +32,7 @@ class ConditionalFormattingExtXform extends CompositeXform { 'xmlns:xm': 'http://schemas.microsoft.com/office/excel/2006/main', }); - model.rules.filter(CfRuleExtXform.isExt).forEach((rule) => this.cfRule.render(xmlStream, rule)); + model.rules.filter(CfRuleExtXform.isExt).forEach(rule => this.cfRule.render(xmlStream, rule)); // for some odd reason, Excel needs the node to be after the rules this.sqRef.render(xmlStream, model.ref); diff --git a/lib/xlsx/xform/sheet/cf-ext/conditional-formattings-ext-xform.js b/lib/xlsx/xform/sheet/cf-ext/conditional-formattings-ext-xform.js index aad91fa64..77d32b118 100644 --- a/lib/xlsx/xform/sheet/cf-ext/conditional-formattings-ext-xform.js +++ b/lib/xlsx/xform/sheet/cf-ext/conditional-formattings-ext-xform.js @@ -18,13 +18,13 @@ class ConditionalFormattingsExtXform extends CompositeXform { hasContent(model) { if (model.hasExtContent === undefined) { - model.hasExtContent = model.some((cf) => cf.rules.some(CfRuleExtXform.isExt)); + model.hasExtContent = model.some(cf => cf.rules.some(CfRuleExtXform.isExt)); } return model.hasExtContent; } prepare(model, options) { - model.forEach((cf) => { + model.forEach(cf => { this.cfXform.prepare(cf, options); }); } @@ -32,7 +32,7 @@ class ConditionalFormattingsExtXform extends CompositeXform { render(xmlStream, model) { if (this.hasContent(model)) { xmlStream.openNode(this.tag); - model.forEach((cf) => this.cfXform.render(xmlStream, cf)); + model.forEach(cf => this.cfXform.render(xmlStream, cf)); xmlStream.closeNode(); } } diff --git a/lib/xlsx/xform/sheet/cf-ext/databar-ext-xform.js b/lib/xlsx/xform/sheet/cf-ext/databar-ext-xform.js index 47c537fc9..05feeb3e6 100644 --- a/lib/xlsx/xform/sheet/cf-ext/databar-ext-xform.js +++ b/lib/xlsx/xform/sheet/cf-ext/databar-ext-xform.js @@ -39,7 +39,7 @@ class DatabarExtXform extends CompositeXform { direction: BaseXform.toAttribute(model.direction, 'leftToRight'), }); - model.cfvo.forEach((cfvo) => { + model.cfvo.forEach(cfvo => { this.cfvoXform.render(xmlStream, cfvo); }); diff --git a/lib/xlsx/xform/sheet/cf-ext/icon-set-ext-xform.js b/lib/xlsx/xform/sheet/cf-ext/icon-set-ext-xform.js index 318a323ac..ef0e16d30 100644 --- a/lib/xlsx/xform/sheet/cf-ext/icon-set-ext-xform.js +++ b/lib/xlsx/xform/sheet/cf-ext/icon-set-ext-xform.js @@ -26,7 +26,7 @@ class IconSetExtXform extends CompositeXform { custom: BaseXform.toBoolAttribute(model.icons, false), }); - model.cfvo.forEach((cfvo) => { + model.cfvo.forEach(cfvo => { this.cfvoXform.render(xmlStream, cfvo); }); diff --git a/lib/xlsx/xform/sheet/cf/cf-rule-xform.js b/lib/xlsx/xform/sheet/cf/cf-rule-xform.js index 6cb20235c..22b3e44ec 100644 --- a/lib/xlsx/xform/sheet/cf/cf-rule-xform.js +++ b/lib/xlsx/xform/sheet/cf/cf-rule-xform.js @@ -15,7 +15,7 @@ const extIcons = { '5Boxes': true, }; -const getTextFormula = (model) => { +const getTextFormula = model => { if (model.formulae && model.formulae[0]) { return model.formulae[0]; } @@ -38,7 +38,7 @@ const getTextFormula = (model) => { } }; -const getTimePeriodFormula = (model) => { +const getTimePeriodFormula = model => { if (model.formulae && model.formulae[0]) { return model.formulae[0]; } @@ -71,7 +71,7 @@ const getTimePeriodFormula = (model) => { } }; -const opType = (attributes) => { +const opType = attributes => { const {type, operator} = attributes; switch (type) { case 'containsText': @@ -168,7 +168,7 @@ class CfRuleXform extends CompositeXform { operator: model.operator, }); - model.formulae.forEach((formula) => { + model.formulae.forEach(formula => { this.formulaXform.render(xmlStream, formula); }); diff --git a/lib/xlsx/xform/sheet/cf/color-scale-xform.js b/lib/xlsx/xform/sheet/cf/color-scale-xform.js index c636ce11f..66293068c 100644 --- a/lib/xlsx/xform/sheet/cf/color-scale-xform.js +++ b/lib/xlsx/xform/sheet/cf/color-scale-xform.js @@ -20,10 +20,10 @@ class ColorScaleXform extends CompositeXform { render(xmlStream, model) { xmlStream.openNode(this.tag); - model.cfvo.forEach((cfvo) => { + model.cfvo.forEach(cfvo => { this.cfvoXform.render(xmlStream, cfvo); }); - model.color.forEach((color) => { + model.color.forEach(color => { this.colorXform.render(xmlStream, color); }); diff --git a/lib/xlsx/xform/sheet/cf/conditional-formatting-xform.js b/lib/xlsx/xform/sheet/cf/conditional-formatting-xform.js index e48a26145..ae41ec86d 100644 --- a/lib/xlsx/xform/sheet/cf/conditional-formatting-xform.js +++ b/lib/xlsx/xform/sheet/cf/conditional-formatting-xform.js @@ -23,7 +23,7 @@ class ConditionalFormattingXform extends CompositeXform { xmlStream.openNode(this.tag, {sqref: model.ref}); - model.rules.forEach((rule) => { + model.rules.forEach(rule => { if (CfRuleXform.isPrimitive(rule)) { rule.ref = model.ref; this.map.cfRule.render(xmlStream, rule); diff --git a/lib/xlsx/xform/sheet/cf/conditional-formattings-xform.js b/lib/xlsx/xform/sheet/cf/conditional-formattings-xform.js index 7051dc95c..11756865c 100644 --- a/lib/xlsx/xform/sheet/cf/conditional-formattings-xform.js +++ b/lib/xlsx/xform/sheet/cf/conditional-formattings-xform.js @@ -19,9 +19,9 @@ class ConditionalFormattingsXform extends BaseXform { prepare(model, options) { // ensure each rule has a priority value - let nextPriority = model.reduce((p, cf) => Math.max(p, ...cf.rules.map((rule) => rule.priority || 0)), 1); - model.forEach((cf) => { - cf.rules.forEach((rule) => { + let nextPriority = model.reduce((p, cf) => Math.max(p, ...cf.rules.map(rule => rule.priority || 0)), 1); + model.forEach(cf => { + cf.rules.forEach(rule => { if (!rule.priority) { rule.priority = nextPriority++; } @@ -34,7 +34,7 @@ class ConditionalFormattingsXform extends BaseXform { } render(xmlStream, model) { - model.forEach((cf) => { + model.forEach(cf => { this.cfXform.render(xmlStream, cf); }); } @@ -75,8 +75,8 @@ class ConditionalFormattingsXform extends BaseXform { } reconcile(model, options) { - model.forEach((cf) => { - cf.rules.forEach((rule) => { + model.forEach(cf => { + cf.rules.forEach(rule => { if (rule.dxfId !== undefined) { rule.style = options.styles.getDxfStyle(rule.dxfId); delete rule.dxfId; diff --git a/lib/xlsx/xform/sheet/cf/databar-xform.js b/lib/xlsx/xform/sheet/cf/databar-xform.js index 7f24c431a..3cc13b611 100644 --- a/lib/xlsx/xform/sheet/cf/databar-xform.js +++ b/lib/xlsx/xform/sheet/cf/databar-xform.js @@ -20,7 +20,7 @@ class DatabarXform extends CompositeXform { render(xmlStream, model) { xmlStream.openNode(this.tag); - model.cfvo.forEach((cfvo) => { + model.cfvo.forEach(cfvo => { this.cfvoXform.render(xmlStream, cfvo); }); this.colorXform.render(xmlStream, model.color); diff --git a/lib/xlsx/xform/sheet/cf/icon-set-xform.js b/lib/xlsx/xform/sheet/cf/icon-set-xform.js index d529bc605..cd7d4abfc 100644 --- a/lib/xlsx/xform/sheet/cf/icon-set-xform.js +++ b/lib/xlsx/xform/sheet/cf/icon-set-xform.js @@ -23,7 +23,7 @@ class IconSetXform extends CompositeXform { showValue: BaseXform.toBoolAttribute(model.showValue, true), }); - model.cfvo.forEach((cfvo) => { + model.cfvo.forEach(cfvo => { this.cfvoXform.render(xmlStream, cfvo); }); diff --git a/lib/xlsx/xform/sheet/data-validations-xform.js b/lib/xlsx/xform/sheet/data-validations-xform.js index 1f2c82b68..df69f7dc1 100644 --- a/lib/xlsx/xform/sheet/data-validations-xform.js +++ b/lib/xlsx/xform/sheet/data-validations-xform.js @@ -49,7 +49,7 @@ function optimiseDataValidations(model) { return true; }; return dvList - .map((dv) => { + .map(dv => { if (!dv.marked) { const addr = colCache.decodeAddress(dv.address); @@ -104,7 +104,7 @@ class DataValidationsXform extends BaseXform { if (optimizedModel.length) { xmlStream.openNode('dataValidations', {count: optimizedModel.length}); - optimizedModel.forEach((value) => { + optimizedModel.forEach(value => { xmlStream.openNode('dataValidation'); if (value.type !== 'any') { @@ -216,10 +216,10 @@ class DataValidationsXform extends BaseXform { } // The four known cases: 1. E4:L9 N4:U9 2.E4 L9 3. N4:U9 4. E4 const list = this._address.split(/\s+/g) || []; - list.forEach((addr) => { + list.forEach(addr => { if (addr.includes(':')) { const range = new Range(addr); - range.forEachAddress((address) => { + range.forEachAddress(address => { this.model[address] = this._dataValidation; }); } else { diff --git a/lib/xlsx/xform/sheet/merges.js b/lib/xlsx/xform/sheet/merges.js index 0868e8ff2..c885375b1 100644 --- a/lib/xlsx/xform/sheet/merges.js +++ b/lib/xlsx/xform/sheet/merges.js @@ -21,12 +21,12 @@ class Merges { } get mergeCells() { - return _.map(this.merges, (merge) => merge.range); + return _.map(this.merges, merge => merge.range); } reconcile(mergeCells, rows) { // reconcile merge list with merge cells - _.each(mergeCells, (merge) => { + _.each(mergeCells, merge => { const dimensions = colCache.decode(merge); for (let i = dimensions.top; i <= dimensions.bottom; i++) { const row = rows[i - 1]; diff --git a/lib/xlsx/xform/sheet/outline-properties-xform.js b/lib/xlsx/xform/sheet/outline-properties-xform.js index bcd9d91cd..b494c2490 100644 --- a/lib/xlsx/xform/sheet/outline-properties-xform.js +++ b/lib/xlsx/xform/sheet/outline-properties-xform.js @@ -1,6 +1,6 @@ const BaseXform = require('../base-xform'); -const isDefined = (attr) => typeof attr !== 'undefined'; +const isDefined = attr => typeof attr !== 'undefined'; class OutlinePropertiesXform extends BaseXform { get tag() { diff --git a/lib/xlsx/xform/sheet/page-margins-xform.js b/lib/xlsx/xform/sheet/page-margins-xform.js index a13a083e8..4b221e181 100644 --- a/lib/xlsx/xform/sheet/page-margins-xform.js +++ b/lib/xlsx/xform/sheet/page-margins-xform.js @@ -16,7 +16,7 @@ class PageMarginsXform extends BaseXform { header: model.header, footer: model.footer, }; - if (_.some(attributes, (value) => value !== undefined)) { + if (_.some(attributes, value => value !== undefined)) { xmlStream.leafNode(this.tag, attributes); } } diff --git a/lib/xlsx/xform/sheet/page-setup-xform.js b/lib/xlsx/xform/sheet/page-setup-xform.js index 5e6ba0544..034fe69b7 100644 --- a/lib/xlsx/xform/sheet/page-setup-xform.js +++ b/lib/xlsx/xform/sheet/page-setup-xform.js @@ -60,7 +60,7 @@ class PageSetupXform extends BaseXform { usePrinterDefaults: booleanToXml(model.usePrinterDefaults), copies: model.copies, }; - if (_.some(attributes, (value) => value !== undefined)) { + if (_.some(attributes, value => value !== undefined)) { xmlStream.leafNode(this.tag, attributes); } } diff --git a/lib/xlsx/xform/sheet/print-options-xform.js b/lib/xlsx/xform/sheet/print-options-xform.js index 22113a99a..d9a7d087a 100644 --- a/lib/xlsx/xform/sheet/print-options-xform.js +++ b/lib/xlsx/xform/sheet/print-options-xform.js @@ -18,7 +18,7 @@ class PrintOptionsXform extends BaseXform { horizontalCentered: booleanToXml(model.horizontalCentered), verticalCentered: booleanToXml(model.verticalCentered), }; - if (_.some(attributes, (value) => value !== undefined)) { + if (_.some(attributes, value => value !== undefined)) { xmlStream.leafNode(this.tag, attributes); } } diff --git a/lib/xlsx/xform/sheet/row-breaks-xform.js b/lib/xlsx/xform/sheet/row-breaks-xform.js index e8c907765..cc01008a8 100644 --- a/lib/xlsx/xform/sheet/row-breaks-xform.js +++ b/lib/xlsx/xform/sheet/row-breaks-xform.js @@ -25,7 +25,7 @@ class RowBreaksXform extends ListXform { } const {childXform} = this; - model.forEach((childModel) => { + model.forEach(childModel => { childXform.render(xmlStream, childModel); }); diff --git a/lib/xlsx/xform/sheet/row-xform.js b/lib/xlsx/xform/sheet/row-xform.js index 5a142af38..c278839f1 100644 --- a/lib/xlsx/xform/sheet/row-xform.js +++ b/lib/xlsx/xform/sheet/row-xform.js @@ -22,7 +22,7 @@ class RowXform extends BaseXform { model.styleId = styleId; } const cellXform = this.map.c; - model.cells.forEach((cellModel) => { + model.cells.forEach(cellModel => { cellXform.prepare(cellModel, options); }); } @@ -53,7 +53,7 @@ class RowXform extends BaseXform { } const cellXform = this.map.c; - model.cells.forEach((cellModel) => { + model.cells.forEach(cellModel => { cellXform.render(xmlStream, cellModel, options); }); @@ -67,7 +67,7 @@ class RowXform extends BaseXform { } if (node.name === 'row') { this.numRowsSeen += 1; - const spans = node.attributes.spans ? node.attributes.spans.split(':').map((span) => parseInt(span, 10)) : [undefined, undefined]; + const spans = node.attributes.spans ? node.attributes.spans.split(':').map(span => parseInt(span, 10)) : [undefined, undefined]; const model = (this.model = { number: parseInt(node.attributes.r, 10), min: spans[0], @@ -130,7 +130,7 @@ class RowXform extends BaseXform { } const cellXform = this.map.c; - model.cells.forEach((cellModel) => { + model.cells.forEach(cellModel => { cellXform.reconcile(cellModel, options); }); } diff --git a/lib/xlsx/xform/sheet/sheet-format-properties-xform.js b/lib/xlsx/xform/sheet/sheet-format-properties-xform.js index 12b3ae584..7ffae26df 100644 --- a/lib/xlsx/xform/sheet/sheet-format-properties-xform.js +++ b/lib/xlsx/xform/sheet/sheet-format-properties-xform.js @@ -23,7 +23,7 @@ class SheetFormatPropertiesXform extends BaseXform { attributes.customHeight = '1'; } - if (_.some(attributes, (value) => value !== undefined)) { + if (_.some(attributes, value => value !== undefined)) { xmlStream.leafNode('sheetFormatPr', attributes); } } diff --git a/lib/xlsx/xform/sheet/sheet-protection-xform.js b/lib/xlsx/xform/sheet/sheet-protection-xform.js index 5ce842ba6..17722502a 100644 --- a/lib/xlsx/xform/sheet/sheet-protection-xform.js +++ b/lib/xlsx/xform/sheet/sheet-protection-xform.js @@ -40,7 +40,7 @@ class SheetProtectionXform extends BaseXform { attributes.objects = booleanToXml(model.objects === false, '1'); attributes.scenarios = booleanToXml(model.scenarios === false, '1'); } - if (_.some(attributes, (value) => value !== undefined)) { + if (_.some(attributes, value => value !== undefined)) { xmlStream.leafNode(this.tag, attributes); } } diff --git a/lib/xlsx/xform/sheet/worksheet-xform.js b/lib/xlsx/xform/sheet/worksheet-xform.js index 2990c838f..bf68ab725 100644 --- a/lib/xlsx/xform/sheet/worksheet-xform.js +++ b/lib/xlsx/xform/sheet/worksheet-xform.js @@ -32,7 +32,7 @@ const ConditionalFormattingsXform = require('./cf/conditional-formattings-xform' const ExtListXform = require('./ext-lst-xform'); const mergeRule = (rule, extRule) => { - Object.keys(extRule).forEach((key) => { + Object.keys(extRule).forEach(key => { const value = rule[key]; const extValue = extRule[key]; if (value === undefined && extValue !== undefined) { @@ -55,9 +55,9 @@ const mergeConditionalFormattings = (model, extModel) => { // index model rules by x14Id const cfMap = {}; const ruleMap = {}; - model.forEach((cf) => { + model.forEach(cf => { cfMap[cf.ref] = cf; - cf.rules.forEach((rule) => { + cf.rules.forEach(rule => { const {x14Id} = rule; if (x14Id) { ruleMap[x14Id] = rule; @@ -65,8 +65,8 @@ const mergeConditionalFormattings = (model, extModel) => { }); }); - extModel.forEach((extCf) => { - extCf.rules.forEach((extRule) => { + extModel.forEach(extCf => { + extCf.rules.forEach(extRule => { const rule = ruleMap[extRule.x14Id]; if (rule) { // merge with matching rule @@ -144,7 +144,7 @@ class WorkSheetXform extends BaseXform { return `rId${r.length + 1}`; } - model.hyperlinks.forEach((hyperlink) => { + model.hyperlinks.forEach(hyperlink => { const rId = nextRid(rels); hyperlink.rId = rId; rels.push({ @@ -170,7 +170,7 @@ class WorkSheetXform extends BaseXform { }; rels.push(vmlDrawing); - model.comments.forEach((item) => { + model.comments.forEach(item => { item.refAddress = colCache.decodeAddress(item.ref); }); @@ -182,7 +182,7 @@ class WorkSheetXform extends BaseXform { const drawingRelsHash = []; let bookImage; - model.media.forEach((medium) => { + model.media.forEach(medium => { if (medium.type === 'background') { const rId = nextRid(rels); bookImage = options.media[medium.imageId]; @@ -249,7 +249,7 @@ class WorkSheetXform extends BaseXform { }); // prepare tables - model.tables.forEach((table) => { + model.tables.forEach(table => { // relationships const rId = nextRid(rels); table.rId = rId; @@ -260,7 +260,7 @@ class WorkSheetXform extends BaseXform { }); // dynamic styles - table.columns.forEach((column) => { + table.columns.forEach(column => { const {style} = column; if (style) { column.dxfId = options.styles.addDxfStyle(style); @@ -334,7 +334,7 @@ class WorkSheetXform extends BaseXform { if (model.rels) { // add a node for each comment - model.rels.forEach((rel) => { + model.rels.forEach(rel => { if (rel.Type === RelType.VmlDrawing) { xmlStream.leafNode('legacyDrawing', {'r:id': rel.Id}); } @@ -351,7 +351,7 @@ class WorkSheetXform extends BaseXform { } if (node.name === 'worksheet') { - _.each(this.map, (xform) => { + _.each(this.map, xform => { xform.reset(); }); return true; @@ -460,7 +460,7 @@ class WorkSheetXform extends BaseXform { // compact the rows and cells model.rows = (model.rows && model.rows.filter(Boolean)) || []; - model.rows.forEach((row) => { + model.rows.forEach(row => { row.cells = (row.cells && row.cells.filter(Boolean)) || []; }); @@ -475,7 +475,7 @@ class WorkSheetXform extends BaseXform { if (match) { const drawingName = match[1]; const drawing = options.drawings[drawingName]; - drawing.anchors.forEach((anchor) => { + drawing.anchors.forEach(anchor => { if (anchor.medium) { const image = { type: 'image', @@ -501,7 +501,7 @@ class WorkSheetXform extends BaseXform { } } - model.tables = (model.tables || []).map((tablePart) => { + model.tables = (model.tables || []).map(tablePart => { const rel = rels[tablePart.rId]; return options.tables[rel.Target]; }); diff --git a/lib/xlsx/xform/static-xform.js b/lib/xlsx/xform/static-xform.js index 5c52ac1a4..1bb1ef6fa 100644 --- a/lib/xlsx/xform/static-xform.js +++ b/lib/xlsx/xform/static-xform.js @@ -13,7 +13,7 @@ const XmlStream = require('../../utils/xml-stream'); function build(xmlStream, model) { xmlStream.openNode(model.tag, model.$); if (model.c) { - model.c.forEach((child) => { + model.c.forEach(child => { build(xmlStream, child); }); } diff --git a/lib/xlsx/xform/strings/phonetic-text-xform.js b/lib/xlsx/xform/strings/phonetic-text-xform.js index d8b254573..fdd20588e 100644 --- a/lib/xlsx/xform/strings/phonetic-text-xform.js +++ b/lib/xlsx/xform/strings/phonetic-text-xform.js @@ -28,7 +28,7 @@ class PhoneticTextXform extends BaseXform { }); if (model && model.hasOwnProperty('richText') && model.richText) { const {r} = this.map; - model.richText.forEach((text) => { + model.richText.forEach(text => { r.render(xmlStream, text); }); } else if (model) { diff --git a/lib/xlsx/xform/strings/shared-string-xform.js b/lib/xlsx/xform/strings/shared-string-xform.js index 2ba7c5b3c..e23cfde7f 100644 --- a/lib/xlsx/xform/strings/shared-string-xform.js +++ b/lib/xlsx/xform/strings/shared-string-xform.js @@ -32,7 +32,7 @@ class SharedStringXform extends BaseXform { xmlStream.openNode(this.tag); if (model && model.hasOwnProperty('richText') && model.richText) { if (model.richText.length) { - model.richText.forEach((text) => { + model.richText.forEach(text => { this.map.r.render(xmlStream, text); }); } else { diff --git a/lib/xlsx/xform/strings/shared-strings-xform.js b/lib/xlsx/xform/strings/shared-strings-xform.js index 79ccea7a6..0777b68d0 100644 --- a/lib/xlsx/xform/strings/shared-strings-xform.js +++ b/lib/xlsx/xform/strings/shared-strings-xform.js @@ -77,7 +77,7 @@ class SharedStringsXform extends BaseXform { }); const sx = this.sharedStringXform; - model.values.forEach((sharedString) => { + model.values.forEach(sharedString => { sx.render(xmlStream, sharedString); }); xmlStream.closeNode(); diff --git a/lib/xlsx/xform/style/fill-xform.js b/lib/xlsx/xform/style/fill-xform.js index c25238754..007d03115 100644 --- a/lib/xlsx/xform/style/fill-xform.js +++ b/lib/xlsx/xform/style/fill-xform.js @@ -191,7 +191,7 @@ class GradientFillXform extends BaseXform { } const stopXform = this.map.stop; - model.stops.forEach((stopModel) => { + model.stops.forEach(stopModel => { stopXform.render(xmlStream, stopModel); }); diff --git a/lib/xlsx/xform/style/styles-xform.js b/lib/xlsx/xform/style/styles-xform.js index 78b39be25..6380c12f7 100644 --- a/lib/xlsx/xform/style/styles-xform.js +++ b/lib/xlsx/xform/style/styles-xform.js @@ -98,7 +98,7 @@ class StylesXform extends BaseXform { // model has been built by style manager role (contains xml) if (model.numFmts && model.numFmts.length) { xmlStream.openNode('numFmts', {count: model.numFmts.length}); - model.numFmts.forEach((numFmtXml) => { + model.numFmts.forEach(numFmtXml => { xmlStream.writeXml(numFmtXml); }); xmlStream.closeNode(); @@ -109,19 +109,19 @@ class StylesXform extends BaseXform { this._addFont({size: 11, color: {theme: 1}, name: 'Calibri', family: 2, scheme: 'minor'}); } xmlStream.openNode('fonts', {count: model.fonts.length, 'x14ac:knownFonts': 1}); - model.fonts.forEach((fontXml) => { + model.fonts.forEach(fontXml => { xmlStream.writeXml(fontXml); }); xmlStream.closeNode(); xmlStream.openNode('fills', {count: model.fills.length}); - model.fills.forEach((fillXml) => { + model.fills.forEach(fillXml => { xmlStream.writeXml(fillXml); }); xmlStream.closeNode(); xmlStream.openNode('borders', {count: model.borders.length}); - model.borders.forEach((borderXml) => { + model.borders.forEach(borderXml => { xmlStream.writeXml(borderXml); }); xmlStream.closeNode(); @@ -129,7 +129,7 @@ class StylesXform extends BaseXform { this.map.cellStyleXfs.render(xmlStream, [{numFmtId: 0, fontId: 0, fillId: 0, borderId: 0, xfId: 0}]); xmlStream.openNode('cellXfs', {count: model.styles.length}); - model.styles.forEach((styleXml) => { + model.styles.forEach(styleXml => { xmlStream.writeXml(styleXml); }); xmlStream.closeNode(); @@ -206,7 +206,7 @@ class StylesXform extends BaseXform { }; if (this.model.numFmts) { const numFmtIndex = this.index.numFmt; - this.model.numFmts.forEach((numFmt) => { + this.model.numFmts.forEach(numFmt => { numFmtIndex[numFmt.id] = numFmt.formatCode; }); } diff --git a/lib/xlsx/xform/table/auto-filter-xform.js b/lib/xlsx/xform/table/auto-filter-xform.js index 837612915..0c0230b83 100644 --- a/lib/xlsx/xform/table/auto-filter-xform.js +++ b/lib/xlsx/xform/table/auto-filter-xform.js @@ -24,7 +24,7 @@ class AutoFilterXform extends BaseXform { render(xmlStream, model) { xmlStream.openNode(this.tag, {ref: model.autoFilterRef}); - model.columns.forEach((column) => { + model.columns.forEach(column => { this.map.filterColumn.render(xmlStream, column); }); diff --git a/lib/xlsx/xform/table/table-xform.js b/lib/xlsx/xform/table/table-xform.js index 0c2f4d4e3..002fbda92 100644 --- a/lib/xlsx/xform/table/table-xform.js +++ b/lib/xlsx/xform/table/table-xform.js @@ -111,7 +111,7 @@ class TableXform extends BaseXform { reconcile(model, options) { // fetch the dfxs from styles - model.columns.forEach((column) => { + model.columns.forEach(column => { if (column.dxfId !== undefined) { column.style = options.styles.getDxfStyle(column.dxfId); } diff --git a/lib/xlsx/xlsx.js b/lib/xlsx/xlsx.js index 9138dba33..c9c9d411d 100644 --- a/lib/xlsx/xlsx.js +++ b/lib/xlsx/xlsx.js @@ -88,7 +88,7 @@ class XLSX { media: model.media, mediaIndex: model.mediaIndex, }; - Object.keys(model.drawings).forEach((name) => { + Object.keys(model.drawings).forEach(name => { const drawing = model.drawings[name]; const drawingRel = model.drawingRels[name]; if (drawingRel) { @@ -96,7 +96,7 @@ class XLSX { o[rel.Id] = rel; return o; }, {}); - (drawing.anchors || []).forEach((anchor) => { + (drawing.anchors || []).forEach(anchor => { const hyperlinks = anchor.picture && anchor.picture.hyperlinks; if (hyperlinks && drawingOptions.rels[hyperlinks.rId]) { hyperlinks.hyperlink = drawingOptions.rels[hyperlinks.rId].Target; @@ -111,7 +111,7 @@ class XLSX { const tableOptions = { styles: model.styles, }; - Object.values(model.tables).forEach((table) => { + Object.values(model.tables).forEach(table => { tableXform.reconcile(table, tableOptions); }); @@ -126,7 +126,7 @@ class XLSX { tables: model.tables, vmlDrawings: model.vmlDrawings, }; - model.worksheets.forEach((worksheet) => { + model.worksheets.forEach(worksheet => { worksheet.relationships = model.worksheetRels[worksheet.sheetNo]; worksheetXform.reconcile(worksheet, sheetOptions); }); @@ -191,7 +191,7 @@ class XLSX { model.media.push(medium); resolve(); }); - entry.on('error', (error) => { + entry.on('error', error => { reject(error); }); entry.pipe(streamBuf); @@ -401,7 +401,7 @@ class XLSX { async addMedia(zip, model) { await Promise.all( - model.media.map(async (medium) => { + model.media.map(async medium => { if (medium.type === 'image') { const filename = `xl/media/${medium.name}.${medium.extension}`; if (medium.filename) { @@ -426,7 +426,7 @@ class XLSX { const drawingXform = new DrawingXform(); const relsXform = new RelationshipsXform(); - model.worksheets.forEach((worksheet) => { + model.worksheets.forEach(worksheet => { const {drawing} = worksheet; if (drawing) { drawingXform.prepare(drawing, {}); @@ -442,9 +442,9 @@ class XLSX { addTables(zip, model) { const tableXform = new TableXform(); - model.worksheets.forEach((worksheet) => { + model.worksheets.forEach(worksheet => { const {tables} = worksheet; - tables.forEach((table) => { + tables.forEach(table => { tableXform.prepare(table, {}); const tableXml = tableXform.toXml(table); zip.append(tableXml, {name: `xl/tables/${table.target}`}); @@ -471,7 +471,7 @@ class XLSX { async addThemes(zip, model) { const themes = model.themes || {theme1: theme1Xml}; - Object.keys(themes).forEach((name) => { + Object.keys(themes).forEach(name => { const xml = themes[name]; const path = `xl/theme/${name}.xml`; zip.append(xml, {name: path}); @@ -497,7 +497,7 @@ class XLSX { if (model.sharedStrings.count) { relationships.push({Id: `rId${count++}`, Type: XLSX.RelType.SharedStrings, Target: 'sharedStrings.xml'}); } - model.worksheets.forEach((worksheet) => { + model.worksheets.forEach(worksheet => { worksheet.rId = `rId${count++}`; relationships.push({Id: worksheet.rId, Type: XLSX.RelType.Worksheet, Target: `worksheets/sheet${worksheet.id}.xml`}); }); @@ -532,7 +532,7 @@ class XLSX { const vmlNotesXform = new VmlNotesXform(); // write sheets - model.worksheets.forEach((worksheet) => { + model.worksheets.forEach(worksheet => { let xmlStream = new XmlStream(); worksheetXform.render(xmlStream, worksheet); zip.append(xmlStream.xml, {name: `xl/worksheets/sheet${worksheet.id}.xml`}); @@ -598,9 +598,9 @@ class XLSX { worksheetOptions.commentRefs = model.commentRefs = []; let tableCount = 0; model.tables = []; - model.worksheets.forEach((worksheet) => { + model.worksheets.forEach(worksheet => { // assign unique filenames to tables - worksheet.tables.forEach((table) => { + worksheet.tables.forEach(table => { tableCount++; table.target = `table${tableCount}.xml`; table.id = tableCount; @@ -643,7 +643,7 @@ class XLSX { stream.on('finish', () => { resolve(); }); - stream.on('error', (error) => { + stream.on('error', error => { reject(error); }); diff --git a/spec/browser/exceljs.spec.js b/spec/browser/exceljs.spec.js index ec53d130c..ce7c21e0a 100644 --- a/spec/browser/exceljs.spec.js +++ b/spec/browser/exceljs.spec.js @@ -13,7 +13,7 @@ function unexpectedError(done) { } describe('ExcelJS', () => { - it('should read and write xlsx via binary buffer', (done) => { + it('should read and write xlsx via binary buffer', done => { const wb = new ExcelJS.Workbook(); const ws = wb.addWorksheet('blort'); @@ -22,7 +22,7 @@ describe('ExcelJS', () => { wb.xlsx .writeBuffer() - .then((buffer) => { + .then(buffer => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.load(buffer).then(() => { const ws2 = wb2.getWorksheet('blort'); @@ -33,12 +33,12 @@ describe('ExcelJS', () => { done(); }); }) - .catch((error) => { + .catch(error => { throw error; }) .catch(unexpectedError(done)); }); - it('should read and write xlsx via base64 buffer', (done) => { + it('should read and write xlsx via base64 buffer', done => { const options = { base64: true, }; @@ -50,7 +50,7 @@ describe('ExcelJS', () => { wb.xlsx .writeBuffer(options) - .then((buffer) => { + .then(buffer => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.load(buffer.toString('base64'), options).then(() => { const ws2 = wb2.getWorksheet('blort'); @@ -61,12 +61,12 @@ describe('ExcelJS', () => { done(); }); }) - .catch((error) => { + .catch(error => { throw error; }) .catch(unexpectedError(done)); }); - it('should write csv via buffer', (done) => { + it('should write csv via buffer', done => { const wb = new ExcelJS.Workbook(); const ws = wb.addWorksheet('blort'); @@ -77,13 +77,13 @@ describe('ExcelJS', () => { wb.csv .writeBuffer() - .then((buffer) => { + .then(buffer => { expect(buffer.toString()).toEqual( '"Hello, World!",What time is it?\n7,12pm' ); done(); }) - .catch((error) => { + .catch(error => { throw error; }) .catch(unexpectedError(done)); diff --git a/spec/integration/issues/issue-1328-xlsx-worksheet-reader-date.spec.js b/spec/integration/issues/issue-1328-xlsx-worksheet-reader-date.spec.js index 4dcd50b3d..acfa4da74 100644 --- a/spec/integration/issues/issue-1328-xlsx-worksheet-reader-date.spec.js +++ b/spec/integration/issues/issue-1328-xlsx-worksheet-reader-date.spec.js @@ -17,8 +17,8 @@ describe('github issues: Date field with cache style', () => { } ); workbookReader.read(); - workbookReader.on('worksheet', (worksheet) => - worksheet.on('row', (row) => rows.push(row.values[1])) + workbookReader.on('worksheet', worksheet => + worksheet.on('row', row => rows.push(row.values[1])) ); workbookReader.on('end', resolve); workbookReader.on('error', reject); diff --git a/spec/integration/issues/issue-219-1904-dates.spec.js b/spec/integration/issues/issue-219-1904-dates.spec.js index 5a339a1d4..f9861063c 100644 --- a/spec/integration/issues/issue-219-1904-dates.spec.js +++ b/spec/integration/issues/issue-219-1904-dates.spec.js @@ -27,7 +27,7 @@ describe('github issues', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { expect(wb2.properties.date1904).to.equal(true); const ws2 = wb2.getWorksheet('Sheet1'); diff --git a/spec/integration/issues/issue-234-vertical-tab-char.spec.js b/spec/integration/issues/issue-234-vertical-tab-char.spec.js index f4bb90d42..c1e2cbd46 100644 --- a/spec/integration/issues/issue-234-vertical-tab-char.spec.js +++ b/spec/integration/issues/issue-234-vertical-tab-char.spec.js @@ -20,7 +20,7 @@ describe('github issues', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Sheet1'); expect(ws2.getCell('A1').value).to.equal('Hello, World!'); expect(ws2.getCell('A2').value).to.equal('Hello, World!'); diff --git a/spec/integration/issues/issue-257-sheet-order.spec.js b/spec/integration/issues/issue-257-sheet-order.spec.js index 44c2ee1b6..cb3e4556e 100644 --- a/spec/integration/issues/issue-257-sheet-order.spec.js +++ b/spec/integration/issues/issue-257-sheet-order.spec.js @@ -6,7 +6,7 @@ describe('github issues', () => { return wb.xlsx .readFile('./spec/integration/data/test-issue-257.xlsx') .then(() => { - expect(wb.worksheets.map((ws) => ws.name)).to.deep.equal([ + expect(wb.worksheets.map(ws => ws.name)).to.deep.equal([ 'First', 'Second', ]); diff --git a/spec/integration/issues/issue-275-hyperlink-query-param.spec.js b/spec/integration/issues/issue-275-hyperlink-query-param.spec.js index 0d52695d6..662414ae4 100644 --- a/spec/integration/issues/issue-275-hyperlink-query-param.spec.js +++ b/spec/integration/issues/issue-275-hyperlink-query-param.spec.js @@ -27,7 +27,7 @@ describe('github issues', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Sheet1'); expect(ws2.getCell('A1').value).to.deep.equal(hyperlink); }); diff --git a/spec/integration/issues/issue-623-borders-for-merged-cell.spec.js b/spec/integration/issues/issue-623-borders-for-merged-cell.spec.js index efce01008..073c87266 100644 --- a/spec/integration/issues/issue-623-borders-for-merged-cell.spec.js +++ b/spec/integration/issues/issue-623-borders-for-merged-cell.spec.js @@ -20,7 +20,7 @@ describe('github issues', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { // written file should have same borders const worksheet = wb2.getWorksheet(1); checkBorder(worksheet.getCell('B2'), ['left', 'top']); @@ -32,7 +32,7 @@ describe('github issues', () => { }); function checkBorder(cell, borders) { - borders.forEach((b) => { + borders.forEach(b => { expect(cell.style.border).to.have.property(b); }); } diff --git a/spec/integration/issues/issue-703-speciel-cell-file.spec.js b/spec/integration/issues/issue-703-speciel-cell-file.spec.js index 95267d339..cb7ead21c 100644 --- a/spec/integration/issues/issue-703-speciel-cell-file.spec.js +++ b/spec/integration/issues/issue-703-speciel-cell-file.spec.js @@ -32,7 +32,7 @@ describe('github issues', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Sheet1'); for (let i = 0; i < specialValues.length; i++) { const value = specialValues[i]; diff --git a/spec/integration/issues/issue-991-csv-read-dates.spec.js b/spec/integration/issues/issue-991-csv-read-dates.spec.js index 4b6236568..e2746c7b5 100644 --- a/spec/integration/issues/issue-991-csv-read-dates.spec.js +++ b/spec/integration/issues/issue-991-csv-read-dates.spec.js @@ -5,7 +5,7 @@ describe('github issues', () => { const wb = new ExcelJS.Workbook(); return wb.csv .readFile('./spec/integration/data/test-issue-991.csv') - .then((worksheet) => { + .then(worksheet => { expect(worksheet.getCell('A1').value.toString()).to.equal( new Date('2019-11-04T00:00:00').toString() ); diff --git a/spec/integration/pr/pr-896/test-pr-896.spec.js b/spec/integration/pr/pr-896/test-pr-896.spec.js index 89e778917..ee92bf20f 100644 --- a/spec/integration/pr/pr-896/test-pr-896.spec.js +++ b/spec/integration/pr/pr-896/test-pr-896.spec.js @@ -53,7 +53,7 @@ describe('pr related issues', () => { const wb2 = new Excel.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('sheet1'); expect(ws2).to.not.be.undefined(); expect(ws2.getCell('A1').value).to.deep.equal(TEST_VALUE); diff --git a/spec/integration/pr/test-pr-1431.spec.js b/spec/integration/pr/test-pr-1431.spec.js index 15fa9bb43..5c3708f92 100644 --- a/spec/integration/pr/test-pr-1431.spec.js +++ b/spec/integration/pr/test-pr-1431.spec.js @@ -35,8 +35,8 @@ describe('github issues', () => { } ); - workbookReader.on('worksheet', (worksheet) => - worksheet.on('row', (row) => { + workbookReader.on('worksheet', worksheet => + worksheet.on('row', row => { expect(row.values[1]).to.eql(rowData[0]); expect(row.values[2]).to.equal(rowData[1]); diff --git a/spec/integration/pr/test-pr-896.spec.js b/spec/integration/pr/test-pr-896.spec.js index 4d00ff1a1..7870c15c0 100644 --- a/spec/integration/pr/test-pr-896.spec.js +++ b/spec/integration/pr/test-pr-896.spec.js @@ -19,7 +19,7 @@ describe('pr related issues', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('foo'); expect(ws2.getCell('A1').value).to.equal(' leading'); expect(ws2.getCell('A1').note).to.equal(' leading'); @@ -43,7 +43,7 @@ describe('pr related issues', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('foo'); expect(ws2.getCell('A1').value).to.equal('Hello,\nWorld!'); expect(ws2.getCell('A1').note).to.equal('Later,\nAlligator!'); diff --git a/spec/integration/workbook-xlsx-reader.spec.js b/spec/integration/workbook-xlsx-reader.spec.js index 525731029..f6ad0a773 100644 --- a/spec/integration/workbook-xlsx-reader.spec.js +++ b/spec/integration/workbook-xlsx-reader.spec.js @@ -31,7 +31,7 @@ describe('WorkbookReader', () => { () => { throw new Error('Promise unexpectedly fulfilled'); }, - (err) => { + err => { expect(err.message).to.equal('Max row count (10) exceeded'); } ); @@ -46,7 +46,7 @@ describe('WorkbookReader', () => { () => { throw new Error('Promise unexpectedly fulfilled'); }, - (err) => { + err => { expect(err.message).to.equal('Max row count (100) exceeded'); } ); @@ -73,7 +73,7 @@ describe('WorkbookReader', () => { () => { throw new Error('Promise unexpectedly fulfilled'); }, - (err) => { + err => { expect(err.message).to.equal('Max column count (15) exceeded'); } ); @@ -88,7 +88,7 @@ describe('WorkbookReader', () => { () => { throw new Error('Promise unexpectedly fulfilled'); }, - (err) => { + err => { expect(err.message).to.equal('Max column count (10) exceeded'); } ); @@ -117,7 +117,7 @@ describe('WorkbookReader', () => { () => { throw new Error('Promise unexpectedly fulfilled'); }, - (err) => { + err => { expect(err.message).to.equal('Max row count (10) exceeded'); } ); @@ -274,7 +274,7 @@ describe('WorkbookReader', () => { () => { throw new Error('Promise unexpectedly fulfilled'); }, - (err) => { + err => { expect(err.message).to.equal( '3:1: text data outside of root node.' ); @@ -310,14 +310,14 @@ describe('WorkbookReader', () => { describe('with image`s tl anchor', () => { it('Should integer part of col equals nativeCol', function() { - this.worksheet.getImages().forEach((image) => { + this.worksheet.getImages().forEach(image => { expect(Math.floor(image.range.tl.col)).to.equal( image.range.tl.nativeCol ); }); }); it('Should integer part of row equals nativeRow', function() { - this.worksheet.getImages().forEach((image) => { + this.worksheet.getImages().forEach(image => { expect(Math.floor(image.range.tl.row)).to.equal( image.range.tl.nativeRow ); @@ -326,7 +326,7 @@ describe('WorkbookReader', () => { it('Should anchor width equals to column width when custom', function() { const ws = this.worksheet; - ws.getImages().forEach((image) => { + ws.getImages().forEach(image => { const col = ws.getColumn(image.range.tl.nativeCol + 1); if (col.isCustomWidth) { @@ -341,7 +341,7 @@ describe('WorkbookReader', () => { it('Should anchor height equals to row height', function() { const ws = this.worksheet; - ws.getImages().forEach((image) => { + ws.getImages().forEach(image => { const row = ws.getRow(image.range.tl.nativeRow + 1); if (row.height) { @@ -357,14 +357,14 @@ describe('WorkbookReader', () => { describe('with image`s br anchor', () => { it('Should integer part of col equals nativeCol', function() { - this.worksheet.getImages().forEach((image) => { + this.worksheet.getImages().forEach(image => { expect(Math.floor(image.range.br.col)).to.equal( image.range.br.nativeCol ); }); }); it('Should integer part of row equals nativeRow', function() { - this.worksheet.getImages().forEach((image) => { + this.worksheet.getImages().forEach(image => { expect(Math.floor(image.range.br.row)).to.equal( image.range.br.nativeRow ); @@ -373,7 +373,7 @@ describe('WorkbookReader', () => { it('Should anchor width equals to column width when custom', function() { const ws = this.worksheet; - ws.getImages().forEach((image) => { + ws.getImages().forEach(image => { const col = ws.getColumn(image.range.br.nativeCol + 1); if (col.isCustomWidth) { @@ -388,7 +388,7 @@ describe('WorkbookReader', () => { it('Should anchor height equals to row height', function() { const ws = this.worksheet; - ws.getImages().forEach((image) => { + ws.getImages().forEach(image => { const row = ws.getRow(image.range.br.nativeRow + 1); if (row.height) { diff --git a/spec/integration/workbook-xlsx-writer/workbook-xlsx-writer.spec.js b/spec/integration/workbook-xlsx-writer/workbook-xlsx-writer.spec.js index f35025375..6feb93aca 100644 --- a/spec/integration/workbook-xlsx-writer/workbook-xlsx-writer.spec.js +++ b/spec/integration/workbook-xlsx-writer/workbook-xlsx-writer.spec.js @@ -36,7 +36,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx'); }); }); @@ -64,7 +64,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Hello'); expect(ws2.getCell('A1').value).to.deep.equal({ formula: 'ROW()+COLUMN()', @@ -110,7 +110,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Hello'); expect(ws2.autoFilter).to.equal('A1:B1'); }); @@ -132,7 +132,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx', undefined, { checkStyles: false, }); @@ -173,10 +173,10 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('blort'); ['A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3'].forEach( - (address) => { + address => { expect(ws2.getCell(address).value).to.equal(address); } ); @@ -248,7 +248,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Hello'); expect(ws2.getCell('A1').value).to.deep.equal({ richText: [ @@ -285,7 +285,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { for (i = 1; i <= numSheets; i++) { const ws2 = wb2.getWorksheet(`sheet${i}`); expect(ws2).to.be.ok(); @@ -336,7 +336,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('blort'); expect(ws2.getCell('A1').name).to.equal('five'); @@ -366,7 +366,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('blort'); expect(ws2.getCell('A1').value).to.equal(xmlCharacters); }); @@ -386,7 +386,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx', ['dataValidations']); }); }); @@ -411,7 +411,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx', ['dataValidations']); }); }); @@ -584,7 +584,7 @@ describe('WorkbookWriter', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx', ['conditionalFormatting']); }); }); diff --git a/spec/integration/workbook/images.spec.js b/spec/integration/workbook/images.spec.js index ac26256c4..423293f7d 100644 --- a/spec/integration/workbook/images.spec.js +++ b/spec/integration/workbook/images.spec.js @@ -37,7 +37,7 @@ describe('Workbook', () => { return fsReadFileAsync(IMAGE_FILENAME); }) - .then((imageData) => { + .then(imageData => { const backgroundId2 = ws2.getBackgroundImageId(); const image = wb2.getImage(backgroundId2); @@ -81,7 +81,7 @@ describe('Workbook', () => { return fsReadFileAsync(IMAGE_FILENAME); }) - .then((imageData) => { + .then(imageData => { const images = ws2.getImages(); expect(images.length).to.equal(1); @@ -125,7 +125,7 @@ describe('Workbook', () => { return fsReadFileAsync(IMAGE_FILENAME); }) - .then((imageData) => { + .then(imageData => { const images = ws2.getImages(); expect(images.length).to.equal(1); @@ -166,7 +166,7 @@ describe('Workbook', () => { return fsReadFileAsync(IMAGE_FILENAME); }) - .then((imageData) => { + .then(imageData => { const images = ws2.getImages(); expect(images.length).to.equal(1); @@ -213,7 +213,7 @@ describe('Workbook', () => { return fsReadFileAsync(IMAGE_FILENAME); }) - .then((imageData) => { + .then(imageData => { const images = ws2.getImages(); expect(images.length).to.equal(1); @@ -271,7 +271,7 @@ describe('Workbook', () => { return fsReadFileAsync(IMAGE_FILENAME); }) - .then((imageData) => { + .then(imageData => { const images = ws2.getImages(); expect(images.length).to.equal(2); diff --git a/spec/integration/workbook/styles.spec.js b/spec/integration/workbook/styles.spec.js index 1762dce08..5d205fe15 100644 --- a/spec/integration/workbook/styles.spec.js +++ b/spec/integration/workbook/styles.spec.js @@ -47,10 +47,10 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('blort'); ['A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3'].forEach( - (address) => { + address => { expect(ws2.getCell(address).value).to.equal(address); } ); @@ -125,7 +125,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('blort'); expect(ws2.getCell('B4').fill).to.deep.equal( diff --git a/spec/integration/workbook/workbook.spec.js b/spec/integration/workbook/workbook.spec.js index fb56b0694..850147d0b 100644 --- a/spec/integration/workbook/workbook.spec.js +++ b/spec/integration/workbook/workbook.spec.js @@ -19,7 +19,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx'); }); }); @@ -40,7 +40,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx'); }); }); @@ -58,7 +58,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx'); }); }); @@ -79,7 +79,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx'); }); }); @@ -97,7 +97,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx'); }); }); @@ -120,7 +120,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { expect(wb2.getWorksheet('Hello, World!')).to.be.ok(); expect(wb2.getWorksheet('This & That')).to.be.ok(); }); @@ -140,7 +140,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { expect(wb2.creator).to.equal(wb.creator); expect(wb2.lastModifiedBy).to.equal(wb.lastModifiedBy); expect(wb2.created).to.equalDate(wb.created); @@ -167,7 +167,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('printHeader'); expect(ws2.pageSetup.printTitlesRow).to.equal('1:2'); expect(ws2.pageSetup.printTitlesColumn).to.be.undefined(); @@ -197,7 +197,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('printColumn'); expect(ws2.pageSetup.printTitlesRow).to.be.undefined(); expect(ws2.pageSetup.printTitlesColumn).to.equal('A:B'); @@ -242,7 +242,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('printHeaderAndColumn'); expect(ws2.pageSetup.printTitlesRow).to.equal('1:2'); expect(ws2.pageSetup.printTitlesColumn).to.equal('A:B'); @@ -262,7 +262,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Hello'); expect(ws2.getCell('A1').value).to.deep.equal({ formula: 'ROW()+COLUMN()', @@ -303,7 +303,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Hello'); expect(ws2.autoFilter).to.equal('A1:B1'); }); @@ -321,7 +321,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { expect(wb2.company).to.equal(wb.company); expect(wb2.manager).to.equal(wb.manager); }); @@ -342,7 +342,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { expect(wb2.title).to.equal(wb.title); expect(wb2.subject).to.equal(wb.subject); expect(wb2.keywords).to.equal(wb.keywords); @@ -364,7 +364,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { expect(wb2.language).to.equal(wb.language); expect(wb2.revision).to.equal(wb.revision); expect(wb2.contentStatus).to.equal(wb.contentStatus); @@ -383,7 +383,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('Hello'); expect(ws2.getCell('A1').value).to.equal('Foo'); @@ -403,7 +403,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx', ['dataValidations']); }); }); @@ -439,7 +439,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { for (i = 1; i <= numSheets; i++) { const ws2 = wb2.getWorksheet(`sheet${i}`); expect(ws2).to.be.ok(); @@ -459,7 +459,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.csv.readFile(TEST_CSV_FILE_NAME).then(() => wb2); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'csv'); }); }); @@ -495,7 +495,7 @@ describe('Workbook', () => { .readFile(TEST_CSV_FILE_NAME, readOptions) .then(() => wb2); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'csv', false, writeOptions); }); }); @@ -552,7 +552,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2a = wb2.getWorksheet('blort'); const ws2b = wb2.getWorksheet('foo'); @@ -635,7 +635,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('duplicateTest'); expect(ws2.getCell('A2').value).to.equal('OneInfo'); @@ -662,7 +662,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('duplicateTest'); expect(ws2.getCell('A1').value).to.equal('OneInfo'); @@ -687,7 +687,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('duplicateTest'); expect(ws2.getCell('A1').value).to.equal('OneInfo'); @@ -712,7 +712,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('duplicateTest'); expect(ws2.getCell('A1').value).to.equal('OneInfo'); @@ -739,7 +739,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('blort'); expect(ws2.getCell('B2').value).to.equal('B2'); @@ -776,7 +776,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('blort'); expect(ws2.getCell('B2').font).to.deep.equal( @@ -874,7 +874,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { testUtils.checkTestBook(wb2, 'xlsx', sheets, options); }); }); @@ -947,7 +947,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('frozen'); expect(ws2).to.be.ok(); expect(ws2.getCell('A1').value).to.equal('Let it Snow!'); @@ -1024,7 +1024,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { const ws2 = wb2.getWorksheet('split'); expect(ws2).to.be.ok(); expect(ws2.getCell('A1').value).to.equal('Do the splits!'); @@ -1092,7 +1092,7 @@ describe('Workbook', () => { const wb2 = new ExcelJS.Workbook(); return wb2.xlsx.readFile(TEST_XLSX_FILE_NAME); }) - .then((wb2) => { + .then(wb2 => { expect(wb2.views).to.deep.equal(wb.views); const ws1b = wb2.getWorksheet('one'); diff --git a/spec/integration/worksheet-xlsx-writer.spec.js b/spec/integration/worksheet-xlsx-writer.spec.js index 24a556a9c..38d743389 100644 --- a/spec/integration/worksheet-xlsx-writer.spec.js +++ b/spec/integration/worksheet-xlsx-writer.spec.js @@ -297,7 +297,7 @@ describe('WorksheetWriter', () => { row3[3] = 'Sam'; row3[5] = dateValue1; rows.push(row3); - rows.forEach((row) => { + rows.forEach(row => { if (row) { ws.addRow(row); } diff --git a/spec/integration/worksheet.spec.js b/spec/integration/worksheet.spec.js index ff07a2134..4a3756283 100644 --- a/spec/integration/worksheet.spec.js +++ b/spec/integration/worksheet.spec.js @@ -326,7 +326,7 @@ describe('Worksheet', () => { row3[3] = 'Sam'; row3[5] = dateValue1; rows.push(row3); - rows.forEach((row) => { + rows.forEach(row => { if (row) { ws.addRow(row); } @@ -500,7 +500,7 @@ describe('Worksheet', () => { row3[3] = 'Other Doe'; row3[5] = dateValue3; rows.push(row3); - rows.forEach((row) => { + rows.forEach(row => { if (row) { // insert on row 1 every time and thus finally reversed order ws.insertRow(1, row); @@ -1056,7 +1056,7 @@ describe('Worksheet', () => { it('Should not break when importing a .numbers file', () => new ExcelJS.Workbook().xlsx .readFile(path.resolve(__dirname, 'data', 'numbers.numbers')) - .then((workbook) => { + .then(workbook => { expect(workbook).to.have.property('worksheets'); expect(workbook.worksheets).to.have.length(0); })); @@ -1065,7 +1065,7 @@ describe('Worksheet', () => { it('Should not break when importing an Excel file that contains a chartsheet', () => new ExcelJS.Workbook().xlsx .readFile(path.resolve(__dirname, 'data', 'chart-sheet.xlsx')) - .then((workbook) => { + .then(workbook => { expect(workbook).to.have.property('worksheets'); expect(workbook.worksheets).to.have.length(1); })); @@ -1078,7 +1078,7 @@ describe('Worksheet', () => { ]; for (const file of fileList) { - it(`Should set hidden attribute correctly (${file})`, (done) => { + it(`Should set hidden attribute correctly (${file})`, done => { const wb = new ExcelJS.Workbook(); wb.xlsx .readFile( @@ -1103,7 +1103,7 @@ describe('Worksheet', () => { done(); }) - .catch((error) => { + .catch(error => { done(error); }); }); diff --git a/spec/unit/doc/defined-names.spec.js b/spec/unit/doc/defined-names.spec.js index 582c3c963..08111f614 100644 --- a/spec/unit/doc/defined-names.spec.js +++ b/spec/unit/doc/defined-names.spec.js @@ -77,8 +77,8 @@ describe('DefinedNames', () => { dn.add('horizontal!C1', 'horizontal'); dn.add('horizontal!D1', 'horizontal'); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { dn.add(`square!${col}${row}`, 'square'); }); }); diff --git a/spec/unit/doc/worksheet-table.spec.js b/spec/unit/doc/worksheet-table.spec.js index 9f69c6c3e..f87495279 100644 --- a/spec/unit/doc/worksheet-table.spec.js +++ b/spec/unit/doc/worksheet-table.spec.js @@ -157,7 +157,7 @@ describe('Worksheet', () => { table.removeColumns(1); table.commit(); - const newValues = values.map((rVals) => spliceArray(rVals, 1, 1)); + const newValues = values.map(rVals => spliceArray(rVals, 1, 1)); checkTable('A1', ws, newValues); }); diff --git a/spec/unit/doc/worksheet.values.spec.js b/spec/unit/doc/worksheet.values.spec.js index 3731dd48a..da6784db9 100644 --- a/spec/unit/doc/worksheet.values.spec.js +++ b/spec/unit/doc/worksheet.values.spec.js @@ -309,7 +309,7 @@ describe('Worksheet', () => { row3[3] = 'Sam'; row3[5] = dateValue1; rows.push(row3); - rows.forEach((row) => { + rows.forEach(row => { if (row) { ws.addRow(row); } @@ -572,7 +572,7 @@ describe('Worksheet', () => { {id: '123', name: 'Jack', dob: new Date(), age: 0}, {id: '124', name: 'Jill', dob: new Date(), age: 0}, ]; - values.forEach((value) => { + values.forEach(value => { ws.addRow(value); }); diff --git a/spec/unit/utils/stream-buf.spec.js b/spec/unit/utils/stream-buf.spec.js index d7cfe36bc..d51489013 100644 --- a/spec/unit/utils/stream-buf.spec.js +++ b/spec/unit/utils/stream-buf.spec.js @@ -27,7 +27,7 @@ describe('StreamBuf', () => { expect(chunk.toString('UTF8')).to.equal('Hello, World!'); }); - it('signals end', (done) => { + it('signals end', done => { const stream = new StreamBuf(); stream.on('finish', () => { done(); diff --git a/spec/unit/utils/utils.spec.js b/spec/unit/utils/utils.spec.js index 8b6b14aa4..53b7a6326 100644 --- a/spec/unit/utils/utils.spec.js +++ b/spec/unit/utils/utils.spec.js @@ -25,13 +25,13 @@ describe('utils', () => { }); }); describe('isDateFmt', () => { - ['yyyy-mm-dd'].forEach((fmt) => { + ['yyyy-mm-dd'].forEach(fmt => { it(`'${fmt}' a date`, () => { expect(utils.isDateFmt(fmt)).to.be.true(); }); }); - ['', '[Green]#,##0 ;[Red](#,##0)'].forEach((fmt) => { + ['', '[Green]#,##0 ;[Red](#,##0)'].forEach(fmt => { it(`'${fmt}' is not a date`, () => { expect(utils.isDateFmt(fmt)).to.be.false(); }); diff --git a/spec/unit/xlsx/xform/compy-xform.js b/spec/unit/xlsx/xform/compy-xform.js index 447904316..db3e98432 100644 --- a/spec/unit/xlsx/xform/compy-xform.js +++ b/spec/unit/xlsx/xform/compy-xform.js @@ -18,14 +18,14 @@ class CompyXform extends BaseXform { } prepare(model, options) { - this.children.forEach((child) => { + this.children.forEach(child => { child.xform.prepare(model[child.tag], options); }); } render(xmlStream, model) { xmlStream.openNode(this.tag, this.attrs); - this.children.forEach((child) => { + this.children.forEach(child => { child.xform.render(xmlStream, model[child.name]); }); xmlStream.closeNode(); @@ -68,7 +68,7 @@ class CompyXform extends BaseXform { } reconcile(model, options) { - this.children.forEach((child) => { + this.children.forEach(child => { child.xform.prepare(model[child.tag], options); }); } diff --git a/spec/unit/xlsx/xform/test-xform-helper.js b/spec/unit/xlsx/xform/test-xform-helper.js index 05312e491..8cadea8a4 100644 --- a/spec/unit/xlsx/xform/test-xform-helper.js +++ b/spec/unit/xlsx/xform/test-xform-helper.js @@ -23,7 +23,7 @@ function getExpectation(expectation, name) { const its = { prepare(expectation) { it('Prepare Model', () => - new Promise((resolve) => { + new Promise(resolve => { const model = getExpectation(expectation, 'initialModel'); const result = getExpectation(expectation, 'preparedModel'); @@ -36,7 +36,7 @@ const its = { render(expectation) { it('Render to XML', () => - new Promise((resolve) => { + new Promise(resolve => { const model = getExpectation(expectation, 'preparedModel'); const result = getExpectation(expectation, 'xml'); @@ -54,7 +54,7 @@ const its = { 'prepare-render': function(expectation) { // when implementation details get in the way of testing the prepared result it('Prepare and Render to XML', () => - new Promise((resolve) => { + new Promise(resolve => { const model = getExpectation(expectation, 'initialModel'); const result = getExpectation(expectation, 'xml'); @@ -71,7 +71,7 @@ const its = { renderIn(expectation) { it('Render in Composite to XML ', () => - new Promise((resolve) => { + new Promise(resolve => { const model = { pre: true, child: getExpectation(expectation, 'preparedModel'), @@ -136,7 +136,7 @@ const its = { stream.end(); xform .parse(parseSax(stream)) - .then((model) => { + .then(model => { // console.log('parsed Model', JSON.stringify(model)); // console.log('expected Model', JSON.stringify(result)); @@ -165,7 +165,7 @@ const its = { stream.end(); xform .parse(parseSax(stream)) - .then((model) => { + .then(model => { // eliminate the undefined const clone = cloneDeep(model, false); @@ -180,7 +180,7 @@ const its = { reconcile(expectation) { it('Reconcile Model', () => - new Promise((resolve) => { + new Promise(resolve => { const model = getExpectation(expectation, 'parsedModel'); const result = getExpectation(expectation, 'reconciledModel'); @@ -197,10 +197,10 @@ const its = { }; function testXform(expectations) { - each(expectations, (expectation) => { + each(expectations, expectation => { const tests = getExpectation(expectation, 'tests'); describe(expectation.title, () => { - each(tests, (test) => { + each(tests, test => { its[test](expectation); }); }); diff --git a/spec/utils/index.js b/spec/utils/index.js index 5fa9177ea..9cf3cb13b 100644 --- a/spec/utils/index.js +++ b/spec/utils/index.js @@ -67,7 +67,7 @@ module.exports = { {x: 1, y: 2, width: 10000, height: 20000, firstSheet: 0, activeTab: 0}, ]; - sheets.forEach((sheet) => { + sheets.forEach(sheet => { const testSheet = _.get(testSheets, sheet); testSheet.addSheet(workbook, options); }); @@ -95,7 +95,7 @@ module.exports = { ]); } - sheets.forEach((sheet) => { + sheets.forEach(sheet => { const testSheet = _.get(testSheets, sheet); testSheet.checkSheet(workbook, options); }); diff --git a/spec/utils/test-conditional-formatting-sheet.js b/spec/utils/test-conditional-formatting-sheet.js index 62e655957..2dea87319 100644 --- a/spec/utils/test-conditional-formatting-sheet.js +++ b/spec/utils/test-conditional-formatting-sheet.js @@ -8,7 +8,7 @@ const self = { addSheet(wb) { const ws = wb.addWorksheet('conditional-formatting'); const {types} = self.conditionalFormattings; - types.forEach((type) => { + types.forEach(type => { const conditionalFormatting = self.getConditionalFormatting(type); if (conditionalFormatting) { ws.addConditionalFormatting(conditionalFormatting); @@ -20,7 +20,7 @@ const self = { const ws = wb.getWorksheet('conditional-formatting'); expect(ws).to.not.be.undefined(); expect(ws.conditionalFormattings).to.not.be.undefined(); - (ws.conditionalFormattings && ws.conditionalFormattings).forEach((item) => { + (ws.conditionalFormattings && ws.conditionalFormattings).forEach(item => { const type = item.rules && item.rules[0].type; const conditionalFormatting = self.getConditionalFormatting(type); expect(item).to.have.property('ref'); diff --git a/spec/utils/test-data-validation-sheet.js b/spec/utils/test-data-validation-sheet.js index 88847d22c..4481ae9ea 100644 --- a/spec/utils/test-data-validation-sheet.js +++ b/spec/utils/test-data-validation-sheet.js @@ -85,7 +85,7 @@ const self = { }; // two rows of the same validation to test dataValidation optimisation - ['A22', 'A23'].forEach((address) => { + ['A22', 'A23'].forEach(address => { ws.getCell(address).value = tools.concatenateFormula('Five Numbers'); }); [ @@ -99,7 +99,7 @@ const self = { 'D23', 'E23', 'F23', - ].forEach((address) => { + ].forEach(address => { ws.getCell(address).dataValidation = JSON.parse( JSON.stringify(self.dataValidations.shared) ); @@ -159,7 +159,7 @@ const self = { 'D23', 'E23', 'F23', - ].forEach((address) => { + ].forEach(address => { expect(ws.getCell(address).dataValidation).to.deep.equal( self.dataValidations.shared ); diff --git a/spec/utils/test-spliced-sheet.js b/spec/utils/test-spliced-sheet.js index 02fd4b2c5..f08ee7c72 100644 --- a/spec/utils/test-spliced-sheet.js +++ b/spec/utils/test-spliced-sheet.js @@ -335,8 +335,8 @@ module.exports = { wsSquare.addRow(['3,1', '3,2', '3,3', '3,4']); wsSquare.addRow(['4,1', '4,2', '4,3', '4,4']); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { wsSquare.getCell(col + row).name = 'square'; }); }); @@ -349,8 +349,8 @@ module.exports = { wsSingles.getCell('D1').value = '1,4'; wsSingles.getCell('D4').value = '4,4'; - ['A', 'D'].forEach((col) => { - [1, 4].forEach((row) => { + ['A', 'D'].forEach(col => { + [1, 4].forEach(row => { wsSingles.getCell(col + row).name = `single-${col}${row}`; }); }); @@ -377,8 +377,8 @@ module.exports = { '4,4', ]); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3].forEach(row => { if (row === 3) { expect(wsSquare.getCell(col + row).name).to.be.undefined(); } else { @@ -407,8 +407,8 @@ module.exports = { wsSquare.addRow(['3,1', '3,2', '3,3', '3,4']); wsSquare.addRow(['4,1', '4,2', '4,3', '4,4']); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { wsSquare.getCell(col + row).name = 'square'; }); }); @@ -421,8 +421,8 @@ module.exports = { wsSingles.getCell('D1').value = '1,4'; wsSingles.getCell('D4').value = '4,4'; - ['A', 'D'].forEach((col) => { - [1, 4].forEach((row) => { + ['A', 'D'].forEach(col => { + [1, 4].forEach(row => { wsSingles.getCell(col + row).name = `single-${col}${row}`; }); }); @@ -470,8 +470,8 @@ module.exports = { '4,4', ]); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4, 5].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4, 5].forEach(row => { if (row === 3) { expect(wsSquare.getCell(col + row).name).to.be.undefined(); } else { @@ -506,8 +506,8 @@ module.exports = { wsSquare.addRow(['3,1', '3,2', '3,3', '3,4']); wsSquare.addRow(['4,1', '4,2', '4,3', '4,4']); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { wsSquare.getCell(col + row).name = 'square'; }); }); @@ -520,8 +520,8 @@ module.exports = { wsSingles.getCell('D1').value = '1,4'; wsSingles.getCell('D4').value = '4,4'; - ['A', 'D'].forEach((col) => { - [1, 4].forEach((row) => { + ['A', 'D'].forEach(col => { + [1, 4].forEach(row => { wsSingles.getCell(col + row).name = `single-${col}${row}`; }); }); @@ -562,8 +562,8 @@ module.exports = { '4,4', ]); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { if (row === 2) { expect(wsSquare.getCell(col + row).name).to.be.undefined(); } else { @@ -1028,8 +1028,8 @@ module.exports = { wsSquare.addRow(['3,1', '3,2', '3,3', '3,4']); wsSquare.addRow(['4,1', '4,2', '4,3', '4,4']); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { wsSquare.getCell(col + row).name = 'square'; }); }); @@ -1042,8 +1042,8 @@ module.exports = { wsSingles.getCell('D1').value = '1,4'; wsSingles.getCell('D4').value = '4,4'; - ['A', 'D'].forEach((col) => { - [1, 4].forEach((row) => { + ['A', 'D'].forEach(col => { + [1, 4].forEach(row => { wsSingles.getCell(col + row).name = `single-${col}${row}`; }); }); @@ -1060,8 +1060,8 @@ module.exports = { expect(wsSquare.getRow(3).values).to.deep.equal([, '3,1', '3,4']); expect(wsSquare.getRow(4).values).to.deep.equal([, '4,1', '4,4']); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3].forEach(row => { if (['C', 'D'].includes(col)) { expect(wsSquare.getCell(col + row).name).to.be.undefined(); } else { @@ -1090,8 +1090,8 @@ module.exports = { wsSquare.addRow(['3,1', '3,2', '3,3', '3,4']); wsSquare.addRow(['4,1', '4,2', '4,3', '4,4']); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { wsSquare.getCell(col + row).name = 'square'; }); }); @@ -1104,8 +1104,8 @@ module.exports = { wsSingles.getCell('D1').value = '1,4'; wsSingles.getCell('D4').value = '4,4'; - ['A', 'D'].forEach((col) => { - [1, 4].forEach((row) => { + ['A', 'D'].forEach(col => { + [1, 4].forEach(row => { wsSingles.getCell(col + row).name = `single-${col}${row}`; }); }); @@ -1150,8 +1150,8 @@ module.exports = { '4,4', ]); - ['A', 'B', 'C', 'D', 'E'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D', 'E'].forEach(col => { + [1, 2, 3, 4].forEach(row => { if (col === 'C') { expect(wsSquare.getCell(col + row).name).to.be.undefined(); } else { @@ -1194,8 +1194,8 @@ module.exports = { wsSquare.addRow(['3,1', '3,2', '3,3', '3,4']); wsSquare.addRow(['4,1', '4,2', '4,3', '4,4']); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { wsSquare.getCell(col + row).name = 'square'; }); }); @@ -1208,8 +1208,8 @@ module.exports = { wsSingles.getCell('D1').value = '1,4'; wsSingles.getCell('D4').value = '4,4'; - ['A', 'D'].forEach((col) => { - [1, 4].forEach((row) => { + ['A', 'D'].forEach(col => { + [1, 4].forEach(row => { wsSingles.getCell(col + row).name = `single-${col}${row}`; }); }); @@ -1250,8 +1250,8 @@ module.exports = { '4,4', ]); - ['A', 'B', 'C', 'D'].forEach((col) => { - [1, 2, 3, 4].forEach((row) => { + ['A', 'B', 'C', 'D'].forEach(col => { + [1, 2, 3, 4].forEach(row => { if (col === 'B') { expect(wsSquare.getCell(col + row).name).to.be.undefined(); } else { diff --git a/spec/utils/test-values-sheet.js b/spec/utils/test-values-sheet.js index 34ef805fa..2bbc45be3 100644 --- a/spec/utils/test-values-sheet.js +++ b/spec/utils/test-values-sheet.js @@ -358,7 +358,7 @@ const self = { formula: 'A9', result: 1, }); - ['B11', 'C11', 'D11', 'E11'].forEach((address) => { + ['B11', 'C11', 'D11', 'E11'].forEach(address => { expect(ws.getCell(address).value).to.equal(1); }); } diff --git a/spec/utils/test-workbook-reader.js b/spec/utils/test-workbook-reader.js index 111c0accf..4994701e6 100644 --- a/spec/utils/test-workbook-reader.js +++ b/spec/utils/test-workbook-reader.js @@ -31,10 +31,10 @@ module.exports = { return new Promise((resolve, reject) => { let rowCount = 0; - wb.on('worksheet', (ws) => { + wb.on('worksheet', ws => { // Sheet name stored in workbook. Not guaranteed here // expect(ws.name).to.equal('blort'); - ws.on('row', (row) => { + ws.on('row', row => { rowCount++; try { switch (row.number) { diff --git a/spec/utils/tools.js b/spec/utils/tools.js index afd67881c..5ac472fd3 100644 --- a/spec/utils/tools.js +++ b/spec/utils/tools.js @@ -23,7 +23,7 @@ const tools = { }, concatenateFormula(...args) { - const values = args.map((value) => `"${value}"`); + const values = args.map(value => `"${value}"`); return { formula: `CONCATENATE(${values.join(',')})`, }; diff --git a/test/test-a1.js b/test/test-a1.js index e910ace27..edb4ca7c4 100644 --- a/test/test-a1.js +++ b/test/test-a1.js @@ -16,6 +16,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-cf.js b/test/test-cf.js index 2c1ae37f9..a1e016161 100644 --- a/test/test-cf.js +++ b/test/test-cf.js @@ -654,6 +654,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-chart.js b/test/test-chart.js index ef81025ab..43201e6ea 100644 --- a/test/test-chart.js +++ b/test/test-chart.js @@ -49,6 +49,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-colour-cell.js b/test/test-colour-cell.js index a2f9f5242..ce308ebde 100644 --- a/test/test-colour-cell.js +++ b/test/test-colour-cell.js @@ -56,6 +56,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-comment-new.js b/test/test-comment-new.js index 8e979c41e..840439468 100644 --- a/test/test-comment-new.js +++ b/test/test-comment-new.js @@ -102,6 +102,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-comment-stream-writer.js b/test/test-comment-stream-writer.js index 30145b0ea..0693a9323 100644 --- a/test/test-comment-stream-writer.js +++ b/test/test-comment-stream-writer.js @@ -101,6 +101,6 @@ wb.commit() console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-comments.js b/test/test-comments.js index 5ceb64c3a..481bd5991 100644 --- a/test/test-comments.js +++ b/test/test-comments.js @@ -4,7 +4,7 @@ const wb = new Excel.Workbook(); wb.xlsx .readFile(require.resolve('./data/comments.xlsx')) .then(() => { - wb.worksheets.forEach((sheet) => { + wb.worksheets.forEach(sheet => { console.info(sheet.getCell('A1').model); sheet.getCell('B2').value = 'Zeb'; sheet.getCell('B2').comment = { diff --git a/test/test-copy.js b/test/test-copy.js index 6b1706756..c78399348 100644 --- a/test/test-copy.js +++ b/test/test-copy.js @@ -19,6 +19,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.error('Error', error.stack); }); diff --git a/test/test-default-height.js b/test/test-default-height.js index b968811d0..8c02cd89a 100644 --- a/test/test-default-height.js +++ b/test/test-default-height.js @@ -24,6 +24,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.error(error.stack); }); diff --git a/test/test-formula.js b/test/test-formula.js index bf8a6741a..a0abf43c1 100644 --- a/test/test-formula.js +++ b/test/test-formula.js @@ -30,7 +30,7 @@ ws.getCell('F4').value = {sharedFormula: 'F1', result: 4}; // function fill ws.getCell('H1').value = 1; -ws.fillFormula('H2:H20', 'H1+1', (row) => row); +ws.fillFormula('H2:H20', 'H1+1', row => row); // array formula @@ -51,6 +51,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-header-footer.js b/test/test-header-footer.js index 0cfb1caf1..d616f9afa 100644 --- a/test/test-header-footer.js +++ b/test/test-header-footer.js @@ -19,6 +19,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-hyperlink.js b/test/test-hyperlink.js index 059c919b5..704bcf18a 100644 --- a/test/test-hyperlink.js +++ b/test/test-hyperlink.js @@ -21,6 +21,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-image-one-cell-anchor.js b/test/test-image-one-cell-anchor.js index c4d65896e..6c21a2aad 100644 --- a/test/test-image-one-cell-anchor.js +++ b/test/test-image-one-cell-anchor.js @@ -37,6 +37,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.error(error.stack); }); diff --git a/test/test-image-oneCell.js b/test/test-image-oneCell.js index 551befae3..c7ccc9243 100644 --- a/test/test-image-oneCell.js +++ b/test/test-image-oneCell.js @@ -28,6 +28,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.error(error.stack); }); diff --git a/test/test-image-out.js b/test/test-image-out.js index 814e966fa..4333ee76a 100644 --- a/test/test-image-out.js +++ b/test/test-image-out.js @@ -37,6 +37,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.error(error.stack); }); diff --git a/test/test-image-stream-writer.js b/test/test-image-stream-writer.js index 01e53e2a2..5d0d3c093 100644 --- a/test/test-image-stream-writer.js +++ b/test/test-image-stream-writer.js @@ -23,6 +23,6 @@ wb.commit() console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-jszip.js b/test/test-jszip.js index 47fef58c9..5d5b70ece 100644 --- a/test/test-jszip.js +++ b/test/test-jszip.js @@ -10,11 +10,11 @@ const jsZip = new JSZip(); fsp .readFileAsync(filename) - .then((data) => { + .then(data => { console.log('data', data); return jsZip.loadAsync(data); }) - .then((zip) => { + .then(zip => { zip.forEach((path, entry) => { if (!entry.dir) { // console.log(path, entry) diff --git a/test/test-merge-align.js b/test/test-merge-align.js index fd3432461..743867ca4 100644 --- a/test/test-merge-align.js +++ b/test/test-merge-align.js @@ -24,6 +24,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-newline.js b/test/test-newline.js index f124ecd40..0e022f01f 100644 --- a/test/test-newline.js +++ b/test/test-newline.js @@ -23,6 +23,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/test-protection-spinCount.js b/test/test-protection-spinCount.js index de378d117..39f84278a 100644 --- a/test/test-protection-spinCount.js +++ b/test/test-protection-spinCount.js @@ -51,6 +51,6 @@ async function save() { } } -save().catch((error) => { +save().catch(error => { console.log(error.message); }); diff --git a/test/test-protection.js b/test/test-protection.js index f1500883e..51ebd5d26 100644 --- a/test/test-protection.js +++ b/test/test-protection.js @@ -27,6 +27,6 @@ async function save() { console.log('Time taken:', stopwatch.microseconds); } -save().catch((error) => { +save().catch(error => { console.log(error.message); }); diff --git a/test/test-table.js b/test/test-table.js index 07bb6abd3..f0401552d 100644 --- a/test/test-table.js +++ b/test/test-table.js @@ -66,6 +66,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testArray.js b/test/testArray.js index 16891e826..148974957 100644 --- a/test/testArray.js +++ b/test/testArray.js @@ -8,6 +8,6 @@ a[1] = 'one'; a[5] = 'five'; a[0] = 'zero'; -_.each(a, (i) => { +_.each(a, i => { console.log(i); }); diff --git a/test/testBigBookIn.js b/test/testBigBookIn.js index aba029ae1..35dd68f94 100644 --- a/test/testBigBookIn.js +++ b/test/testBigBookIn.js @@ -89,15 +89,15 @@ if (useStream) { console.log('reached end of stream'); }); wb.on('finished', report); - wb.on('worksheet', (worksheet) => { + wb.on('worksheet', worksheet => { worksheet.on('row', checkRow); }); - wb.on('hyperlinks', (hyperlinks) => { + wb.on('hyperlinks', hyperlinks => { hyperlinks.on('hyperlink', () => { hyperlinkCount++; }); }); - wb.on('entry', (entry) => { + wb.on('entry', entry => { console.log(JSON.stringify(entry)); }); switch (options.plan) { diff --git a/test/testBigBookOut.js b/test/testBigBookOut.js index 4a395f54c..ed9a4b29c 100644 --- a/test/testBigBookOut.js +++ b/test/testBigBookOut.js @@ -134,7 +134,7 @@ function allDone() { console.log(`Sums: ${colCount}`); console.log(`Time: ${stopwatch}`); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); } diff --git a/test/testBookFont.js b/test/testBookFont.js index 4df3499c7..79e9e9332 100644 --- a/test/testBookFont.js +++ b/test/testBookFont.js @@ -6,14 +6,14 @@ const workbook = new Workbook(); workbook.xlsx .readFile(filename) .then(() => { - workbook.eachSheet((worksheet) => { + workbook.eachSheet(worksheet => { console.log( `Sheet ${worksheet.id} - ${worksheet.name}, Dims=${JSON.stringify( worksheet.dimensions )}` ); - worksheet.eachRow((row) => { - row.eachCell((cell) => { + worksheet.eachRow(row => { + row.eachCell(cell => { if (cell.font.strike) { console.log(`Strikethrough: ${cell.value}`); } @@ -21,6 +21,6 @@ workbook.xlsx }); }); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testBookOut.js b/test/testBookOut.js index 4c557596c..74b3f0241 100644 --- a/test/testBookOut.js +++ b/test/testBookOut.js @@ -358,6 +358,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testBookOutS.js b/test/testBookOutS.js index 49e862459..2f323ab3e 100644 --- a/test/testBookOutS.js +++ b/test/testBookOutS.js @@ -289,6 +289,6 @@ wb.commit() .then(() => { console.log('Done.'); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testBookRead.js b/test/testBookRead.js index dd23afefe..492091474 100644 --- a/test/testBookRead.js +++ b/test/testBookRead.js @@ -6,7 +6,7 @@ const workbook = new Workbook(); workbook.xlsx .readFile(filename) .then(() => { - workbook.eachSheet((worksheet) => { + workbook.eachSheet(worksheet => { console.log( `Sheet ${worksheet.id} - ${worksheet.name}, Dims=${JSON.stringify( worksheet.dimensions @@ -14,6 +14,6 @@ workbook.xlsx ); }); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testCsvOut.js b/test/testCsvOut.js index eb24f43a6..2be90dc98 100644 --- a/test/testCsvOut.js +++ b/test/testCsvOut.js @@ -59,6 +59,6 @@ wb.csv .then(() => { console.log('Done.'); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testImageIn.js b/test/testImageIn.js index 367078ebb..da15ccdf0 100644 --- a/test/testImageIn.js +++ b/test/testImageIn.js @@ -19,6 +19,6 @@ wb.xlsx const {image} = ws.background; console.log('Media', image.name, image.type, image.buffer.length); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testMergedBorder.js b/test/testMergedBorder.js index 9998d4a8b..634cca36f 100644 --- a/test/testMergedBorder.js +++ b/test/testMergedBorder.js @@ -42,6 +42,6 @@ wb.xlsx .then(() => { console.log('Done.'); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testMultiplePrintAreaOut.js b/test/testMultiplePrintAreaOut.js index 0fa720cfc..b6728f051 100644 --- a/test/testMultiplePrintAreaOut.js +++ b/test/testMultiplePrintAreaOut.js @@ -35,6 +35,6 @@ wb.xlsx .then(() => { console.log('Done.'); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testPerformance.js b/test/testPerformance.js index 9b41cc2e6..eac5b2436 100644 --- a/test/testPerformance.js +++ b/test/testPerformance.js @@ -156,7 +156,7 @@ function runTests(options) { // run each test with a 10 second pause between (to let GC do its stuff) promise = promise.then(() => runTest(options) - .then((result) => { + .then(result => { results.push(result); }) .delay(sleepTime) @@ -180,13 +180,13 @@ function runTests(options) { let mainPromise = Promise.resolve(); // var mainPromise = execute(125, 'stream', 'plain', 'own'); -_.each(counts, (count) => { +_.each(counts, count => { mainPromise = mainPromise.then(() => { resultSheet.addRow().getCell('count').value = count; }); - _.each(workbooks, (workbook) => { - _.each(styles, (style) => { - _.each(strings, (str) => { + _.each(workbooks, workbook => { + _.each(styles, style => { + _.each(strings, str => { mainPromise = mainPromise.then( runTests({ count, @@ -208,7 +208,7 @@ mainPromise = mainPromise .then(() => { console.log('All Done'); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testPrintAreaOut.js b/test/testPrintAreaOut.js index eea8fea58..c5f0c8788 100644 --- a/test/testPrintAreaOut.js +++ b/test/testPrintAreaOut.js @@ -35,6 +35,6 @@ wb.xlsx .then(() => { console.log('Done.'); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testPrintColRowOut.js b/test/testPrintColRowOut.js index 8edf20016..ebfdb3878 100644 --- a/test/testPrintColRowOut.js +++ b/test/testPrintColRowOut.js @@ -41,6 +41,6 @@ wb.xlsx console.log('Done.'); console.log('Time taken:', micros); }) - .catch((error) => { + .catch(error => { console.log(error.message); }); diff --git a/test/testProcess.js b/test/testProcess.js index 8037af3da..1c311fc34 100644 --- a/test/testProcess.js +++ b/test/testProcess.js @@ -22,7 +22,7 @@ wb.xlsx .then(() => { console.log('Loaded', inputFile); - wb.eachSheet((sheet) => { + wb.eachSheet(sheet => { console.log(sheet.name); }); @@ -39,7 +39,7 @@ wb.xlsx .then(() => { assert(passed, 'Something went wrong', 'All tests passed!'); }) - .catch((error) => { + .catch(error => { console.error(error.message); console.error(error.stack); }); diff --git a/test/testSax2.js b/test/testSax2.js index d841aaec2..20ebe4d95 100644 --- a/test/testSax2.js +++ b/test/testSax2.js @@ -45,7 +45,7 @@ e.on('finished', () => { let row = null; let cell = null; -parser.on('opentag', (node) => { +parser.on('opentag', node => { // console.log('opentag ' + node.name); switch (node.name) { case 'row': { @@ -64,13 +64,13 @@ parser.on('opentag', (node) => { default: } }); -parser.on('text', (text) => { +parser.on('text', text => { // console.log('text ' + text); if (cell) { cell.value += text; } }); -parser.on('closetag', (name) => { +parser.on('closetag', name => { // console.log('closetag ' + name); switch (name) { case 'row': diff --git a/test/testSharedStrings.js b/test/testSharedStrings.js index 2c9216deb..69cc1ca6c 100644 --- a/test/testSharedStrings.js +++ b/test/testSharedStrings.js @@ -17,4 +17,4 @@ wb.xlsx .then(() => { console.log('done'); }) - .catch((e) => console.log(e)); + .catch(e => console.log(e)); diff --git a/test/testStringBuf.js b/test/testStringBuf.js index c93bdd720..1adc440a8 100644 --- a/test/testStringBuf.js +++ b/test/testStringBuf.js @@ -87,6 +87,6 @@ const results = {}; Promise.resolve(results) .then(testWrite) .then(testGrow) - .then((r) => { + .then(r => { console.log(JSON.stringify(r, null, ' ')); }); diff --git a/test/testStringtable.js b/test/testStringtable.js index 4ac07989c..96a93fae9 100644 --- a/test/testStringtable.js +++ b/test/testStringtable.js @@ -7,7 +7,7 @@ const filename = process.argv[2]; const st = new SharedStrings(null); const lst = ['Hello', 'Hello', 'World', 'Hello\nWorld!', 'Hello, "World!"']; -_.each(lst, (item) => { +_.each(lst, item => { st.add(item); }); diff --git a/test/testTemplate.js b/test/testTemplate.js index 875f4258a..2fdd7421d 100644 --- a/test/testTemplate.js +++ b/test/testTemplate.js @@ -3,7 +3,7 @@ const Excel = require('../excel'); const workbook = new Excel.Workbook(); workbook.xlsx .readFile('./out/template.xlsx') - .then((stream) => { + .then(stream => { const options = { useSharedStrings: true, useStyles: true, @@ -15,7 +15,7 @@ workbook.xlsx console.log('Done.'); }); }) - .catch((error) => { + .catch(error => { console.error(error.message); console.error(error.stack); }); diff --git a/test/testXlsxIn.js b/test/testXlsxIn.js index 1dc45250e..589263929 100644 --- a/test/testXlsxIn.js +++ b/test/testXlsxIn.js @@ -21,6 +21,6 @@ wb.xlsx console.log(id, sheet.name); }); }) - .catch((error) => { + .catch(error => { console.error('something went wrong', error.stack); }); diff --git a/test/utils/column-sum.js b/test/utils/column-sum.js index b58c5b029..6419c992f 100644 --- a/test/utils/column-sum.js +++ b/test/utils/column-sum.js @@ -4,14 +4,14 @@ const ColumnSum = (module.exports = function(columns) { this.columns = columns; this.sums = []; this.count = 0; - _.each(this.columns, (column) => { + _.each(this.columns, column => { this.sums[column] = 0; }); }); ColumnSum.prototype = { add(row) { - _.each(this.columns, (column) => { + _.each(this.columns, column => { this.sums[column] += row.getCell(column).value; }); this.count++; @@ -22,7 +22,7 @@ ColumnSum.prototype = { }, toAverages() { return this.sum - .map((value) => (value ? value / this.count : value)) + .map(value => (value ? value / this.count : value)) .join(', '); }, }; diff --git a/test/utils/utils.js b/test/utils/utils.js index c7586c244..7a30f2633 100644 --- a/test/utils/utils.js +++ b/test/utils/utils.js @@ -38,7 +38,7 @@ const main = { deferred.reject(err); } else { const promises = []; - _.each(files, (file) => { + _.each(files, file => { promises.push(remove(`${path}/${file}`)); }); @@ -46,7 +46,7 @@ const main = { .then(() => { deferred.resolve(); }) - .catch((error) => { + .catch(error => { deferred.reject(error); }); }