代码拉取完成,页面将自动刷新
/**
* @typedef {string} cell
*/
/**
* @typedef {cell[]} validateData~column
*/
/**
* @param {column[]} rows
* @returns {undefined}
*/
export default (rows) => {
if (!Array.isArray(rows)) {
throw new TypeError('Table data must be an array.');
}
if (rows.length === 0) {
throw new Error('Table must define at least one row.');
}
if (rows[0].length === 0) {
throw new Error('Table must define at least one column.');
}
const columnNumber = rows[0].length;
for (const cells of rows) {
if (!Array.isArray(cells)) {
throw new TypeError('Table row data must be an array.');
}
if (cells.length !== columnNumber) {
throw new Error('Table must have a consistent number of cells.');
}
for (const cell of cells) {
// eslint-disable-next-line no-control-regex
if (/[\u0001-\u0006\u0008-\u0009\u000B-\u001A]/.test(cell)) {
throw new Error('Table data must not contain control characters.');
}
}
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。