chriszarate/sheetrock

View on GitHub
src/lib/row.js

Summary

Maintainability
A
0 mins
Test Coverage
import { getCellValue } from './util';

export default class Row {
  constructor(number, cellsArray, labels) {
    this.num = number;
    this.cellsArray = cellsArray.map(getCellValue);
    this.labels = labels;
  }

  // Get an object with labels as keys.
  get cells() {
    const cellsObj = {};
    this.labels.forEach((label, index) => {
      cellsObj[label] = this.cellsArray[index];
    });
    return cellsObj;
  }
}