···17171818 public async processZipArchive(
1919 zip: JSZip,
2020- rules: ParseRule[],
2020+ rules: ParseRule[]
2121 ): Promise<ExtractionResults> {
2222 /** Core logic for extracting usernames from a successfully loaded ZIP archive. */
2323 const allExtracted: Record<string, string[]> = {};
···2727 const rule = rules[i];
2828 const ruleId = `Rule_${i + 1}_${rule.zipPath}`;
2929 console.log(
3030- `Processing ZIP file path ${rule.zipPath} (Format: ${rule.format})`,
3030+ `Processing ZIP file path ${rule.zipPath} (Format: ${rule.format})`
3131 );
32323333 // 1. Get file object from ZIP
3434 const fileInZip = zip.file(rule.zipPath);
3535 if (!fileInZip) {
3636 console.warn(
3737- `WARNING: File not found in ZIP: '${rule.zipPath}'. Skipping rule.`,
3737+ `WARNING: File not found in ZIP: '${rule.zipPath}'. Skipping rule.`
3838 );
3939 continue;
4040 }
···6565 * Check if file is a ZIP by reading magic number
6666 */
6767async function checkIfZipFile(
6868- file: File | ArrayBuffer | Blob,
6868+ file: File | ArrayBuffer | Blob
6969): Promise<boolean> {
7070 try {
7171 const blob =
···8888 */
8989export async function parseDataFile(
9090 file: File | ArrayBuffer | Blob,
9191- platform: string,
9191+ platform: string
9292): Promise<string[]> {
9393 const rules = getRulesForPlatform(platform);
9494···109109 const results = await extractor.processZipArchive(zip, rules);
110110111111 console.log(
112112- `Successfully extracted ${results.uniqueUsernames.length} usernames from ZIP archive.`,
112112+ `Successfully extracted ${results.uniqueUsernames.length} usernames from ZIP archive.`
113113 );
114114 return results.uniqueUsernames;
115115 } catch (e) {
···123123 // We need a File object to get the name and content easily
124124 if (!(file instanceof File) && !(file instanceof Blob)) {
125125 console.error(
126126- "Input failed ZIP check and lacks a name/content structure for single file parsing (must be File or Blob).",
126126+ "Input failed ZIP check and lacks a name/content structure for single file parsing (must be File or Blob)."
127127 );
128128 return [];
129129 }
···146146147147 if (!matchingRule) {
148148 console.error(
149149- `Could not match single file '${singleFile.name}' (extension: ${fileExt}) to any rule for platform ${platform}. Available formats: ${rules.map((r) => r.format).join(", ")}`,
149149+ `Could not match single file '${singleFile.name}' (extension: ${fileExt}) to any rule for platform ${platform}. Available formats: ${rules.map((r) => r.format).join(", ")}`
150150 );
151151 return [];
152152 }
153153154154 console.log(
155155- `Matched single file '${singleFile.name}' to rule format: ${matchingRule.format}`,
155155+ `Matched single file '${singleFile.name}' to rule format: ${matchingRule.format}`
156156 );
157157158158 // 3. Process as single file content
···162162163163 const uniqueUsernames = Array.from(new Set(extracted)).sort();
164164 console.log(
165165- `Successfully extracted ${uniqueUsernames.length} unique usernames from single file.`,
165165+ `Successfully extracted ${uniqueUsernames.length} unique usernames from single file.`
166166 );
167167168168 return uniqueUsernames;
+6-6
packages/web/src/lib/parsers/parserLogic.ts
···88 **/
99export function parseTextOrHtml(
1010 content: string,
1111- regexPattern: string,
1111+ regexPattern: string
1212): string[] {
1313 try {
1414 // 'g' for global matching, 's' for multiline (DOTALL equivalent)
···39394040 if (pathKeys.length < 2) {
4141 console.error(
4242- "JSON rule must have at least two path keys (list key and target key).",
4242+ "JSON rule must have at least two path keys (list key and target key)."
4343 );
4444 return [];
4545 }
···6060 currentData = currentData[key];
6161 } else {
6262 console.error(
6363- `ERROR: Could not traverse JSON path up to key: ${key}. Path: ${listContainerPath.join(" -> ")}`,
6363+ `ERROR: Could not traverse JSON path up to key: ${key}. Path: ${listContainerPath.join(" -> ")}`
6464 );
6565 return [];
6666 }
···8484 }
8585 } else {
8686 console.error(
8787- `ERROR: Expected an array at key '${listKey}' but found a different type.`,
8787+ `ERROR: Expected an array at key '${listKey}' but found a different type.`
8888 );
8989 }
9090 } else {
9191 console.error(
9292- `ERROR: List key '${listKey}' not found at its expected position.`,
9292+ `ERROR: List key '${listKey}' not found at its expected position.`
9393 );
9494 }
9595···121121 }
122122 }
123123 console.error(
124124- `ERROR: Unsupported format or invalid rule type for rule with path: ${rule.zipPath}`,
124124+ `ERROR: Unsupported format or invalid rule type for rule with path: ${rule.zipPath}`
125125 );
126126 return [];
127127}