Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Error handling for cell row/col smaller than 1 #357

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions source/lib/cell/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ const Comment = require('../classes/comment');
// §18.3.1.4 c (Cell)
class Cell {
/**
* Create an Excel Cell
* @private
* @param {Number} row Row of cell.
* @param {Number} col Column of cell
*/
* Create an Excel Cell
* @private
* @param {Number} row Row of cell.
* @param {Number} col Column of cell
*/
constructor(row, col) {
if (row <= 0) throw 'Row parameter must not be zero or negative.';
if (col <= 0) throw 'Col parameter must not be zero or negative.';
this.r = `${utils.getExcelAlpha(col)}${row}`; // 'r' attribute
this.s = 0; // 's' attribute refering to style index
this.t = null; // 't' attribute stating Cell data type - §18.18.11 ST_CellType (Cell Type)
Expand Down Expand Up @@ -77,4 +79,3 @@ class Cell {
}

module.exports = Cell;