Skip to content

Commit

Permalink
Check array by Array.isArray()
Browse files Browse the repository at this point in the history
  • Loading branch information
lekhahuynh authored Aug 15, 2023
1 parent eb603ea commit ce8735e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class Workbook {
// Only substitute things for which we have a substitution
var substitution = _get(substitutions, placeholder.name, ''), newCellsInserted = 0;

if (placeholder.full && placeholder.type === "table" && substitution instanceof Array) {
if (placeholder.full && placeholder.type === "table" && (substitution instanceof Array || Array.isArray(substitution))) {
if (placeholder.subType === 'image' && drawing == null) {
if (rels) {
drawing = self.loadDrawing(sheet.root, sheet.filename, rels.root);
Expand Down Expand Up @@ -302,7 +302,7 @@ class Workbook {
cellsInserted += newCellsInserted;
self.pushRight(self.workbook, sheet.root, cell.attrib.r, newCellsInserted);
}
} else if (placeholder.full && placeholder.type === "normal" && substitution instanceof Array) {
} else if (placeholder.full && placeholder.type === "normal" && (substitution instanceof Array || Array.isArray(substitution))) {
appendCell = false; // don't double-insert cells
newCellsInserted = self.substituteArray(
cells, cell, substitution
Expand Down Expand Up @@ -744,7 +744,7 @@ class Workbook {
}

// Array -> new columns
if (placeholder.full && placeholder.type === "normal" && substitution instanceof Array) {
if (placeholder.full && placeholder.type === "normal" && (substitution instanceof Array || Array.isArray(substitution))) {
substitution.forEach(function (element, i) {
var newCol = col;
if (i > 0) {
Expand Down

0 comments on commit ce8735e

Please sign in to comment.