webhook/node_modules/table/dist/validateTableData.js.map

1 line
No EOL
2 KiB
Text

{"version":3,"sources":["../src/validateTableData.js"],"names":["rows","Array","isArray","TypeError","length","Error","columnNumber","cells","cell","test"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;0BACgBA,I,IAAS;AACvB,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,IAAd,CAAL,EAA0B;AACxB,UAAM,IAAIG,SAAJ,CAAc,8BAAd,CAAN;AACD;;AAED,MAAIH,IAAI,CAACI,MAAL,KAAgB,CAApB,EAAuB;AACrB,UAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;AACD;;AAED,MAAIL,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAR,KAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAIC,KAAJ,CAAU,wCAAV,CAAN;AACD;;AAED,QAAMC,YAAY,GAAGN,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAA7B;;AAEA,OAAK,MAAMG,KAAX,IAAoBP,IAApB,EAA0B;AACxB,QAAI,CAACC,KAAK,CAACC,OAAN,CAAcK,KAAd,CAAL,EAA2B;AACzB,YAAM,IAAIJ,SAAJ,CAAc,kCAAd,CAAN;AACD;;AAED,QAAII,KAAK,CAACH,MAAN,KAAiBE,YAArB,EAAmC;AACjC,YAAM,IAAID,KAAJ,CAAU,+CAAV,CAAN;AACD;;AAED,SAAK,MAAMG,IAAX,IAAmBD,KAAnB,EAA0B;AACxB;AACA,UAAI,2CAA2CE,IAA3C,CAAgDD,IAAhD,CAAJ,EAA2D;AACzD,cAAM,IAAIH,KAAJ,CAAU,iDAAV,CAAN;AACD;AACF;AACF;AACF,C","sourcesContent":["/**\n * @typedef {string} cell\n */\n\n/**\n * @typedef {cell[]} validateData~column\n */\n\n/**\n * @param {column[]} rows\n * @returns {undefined}\n */\nexport default (rows) => {\n if (!Array.isArray(rows)) {\n throw new TypeError('Table data must be an array.');\n }\n\n if (rows.length === 0) {\n throw new Error('Table must define at least one row.');\n }\n\n if (rows[0].length === 0) {\n throw new Error('Table must define at least one column.');\n }\n\n const columnNumber = rows[0].length;\n\n for (const cells of rows) {\n if (!Array.isArray(cells)) {\n throw new TypeError('Table row data must be an array.');\n }\n\n if (cells.length !== columnNumber) {\n throw new Error('Table must have a consistent number of cells.');\n }\n\n for (const cell of cells) {\n // eslint-disable-next-line no-control-regex\n if (/[\\u0001-\\u0006\\u0008\\u0009\\u000B-\\u001A]/.test(cell)) {\n throw new Error('Table data must not contain control characters.');\n }\n }\n }\n};\n"],"file":"validateTableData.js"}