3 Object.defineProperty(exports, "__esModule", {
8 * @typedef {string} cell
12 * @typedef {cell[]} validateData~column
16 * @param {column[]} rows
17 * @returns {undefined}
19 exports.default = rows => {
20 if (!Array.isArray(rows)) {
21 throw new TypeError('Table data must be an array.');
24 if (rows.length === 0) {
25 throw new Error('Table must define at least one row.');
28 if (rows[0].length === 0) {
29 throw new Error('Table must define at least one column.');
32 const columnNumber = rows[0].length;
34 for (const cells of rows) {
35 if (!Array.isArray(cells)) {
36 throw new TypeError('Table row data must be an array.');
39 if (cells.length !== columnNumber) {
40 throw new Error('Table must have a consistent number of cells.');
43 // @todo Make an exception for newline characters.
44 // @see https://github.com/gajus/table/issues/9
45 for (const cell of cells) {
46 if (/[\u0001-\u001A]/.test(cell)) {
47 throw new Error('Table data must not contain control characters.');