3 Object.defineProperty(exports, "__esModule", {
6 exports.default = void 0;
9 * @typedef {string} cell
13 * @typedef {cell[]} validateData~column
17 * @param {column[]} rows
18 * @returns {undefined}
20 const validateTableData = rows => {
21 if (!Array.isArray(rows)) {
22 throw new TypeError('Table data must be an array.');
25 if (rows.length === 0) {
26 throw new Error('Table must define at least one row.');
29 if (rows[0].length === 0) {
30 throw new Error('Table must define at least one column.');
33 const columnNumber = rows[0].length;
35 for (const cells of rows) {
36 if (!Array.isArray(cells)) {
37 throw new TypeError('Table row data must be an array.');
40 if (cells.length !== columnNumber) {
41 throw new Error('Table must have a consistent number of cells.');
44 for (const cell of cells) {
45 // eslint-disable-next-line no-control-regex
46 if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test(cell)) {
47 throw new Error('Table data must not contain control characters.');
53 var _default = validateTableData;
54 exports.default = _default;
55 //# sourceMappingURL=validateTableData.js.map