mario-education 2.4.517-feedback → 2.4.518-feedback

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6169,32 +6169,16 @@ var useCSVImport = function useCSVImport() {
6169
6169
  var _temp8 = function () {
6170
6170
  if (type == CSVType.AllUser) {
6171
6171
  console.log("📌 Type 1:", type.toString());
6172
- return Promise.resolve(new Promise(function (resolve, reject) {
6173
- var reader = new FileReader();
6174
-
6175
- reader.onload = function () {
6176
- return resolve(reader.result);
6177
- };
6178
-
6179
- reader.onerror = reject;
6180
- reader.readAsText(file);
6181
- })).then(function (fileTextRaw) {
6172
+ return Promise.resolve(file.text()).then(function (fileTextRaw) {
6182
6173
  console.log("📌 fileTextRaw:", fileTextRaw);
6183
6174
  var fileText = fileTextRaw.trim();
6184
- var headerIndex = 0;
6185
6175
  var rows = fileText.split("\n").map(function (row) {
6186
6176
  return row.trim();
6187
6177
  });
6188
6178
  console.log("📌 rows:", rows);
6189
-
6190
- for (var _i = 0; _i < rows.length; _i++) {
6191
- var cols = rows[_i].split(",");
6192
-
6193
- if (cols.includes("FirstName")) {
6194
- headerIndex = _i;
6195
- return;
6196
- }
6197
- }
6179
+ var headerIndex = rows.findIndex(function (row) {
6180
+ return row.split(",").includes("FirstName");
6181
+ });
6198
6182
 
6199
6183
  if (headerIndex === 0) {
6200
6184
  throw new Error("Invalid CSV: Missing header row.");
@@ -6212,8 +6196,8 @@ var useCSVImport = function useCSVImport() {
6212
6196
  var chunkSize = 20;
6213
6197
  var chunks = [];
6214
6198
 
6215
- for (var _i2 = 0; _i2 < dataRows.length; _i2 += chunkSize) {
6216
- var chunkData = dataRows.slice(_i2, _i2 + chunkSize);
6199
+ for (var _i = 0; _i < dataRows.length; _i += chunkSize) {
6200
+ var chunkData = dataRows.slice(_i, _i + chunkSize);
6217
6201
  var csvChunk = Papa.unparse({
6218
6202
  fields: header,
6219
6203
  data: chunkData