| import fs from 'fs'; |
|
|
| const content = fs.readFileSync('src/components/AptitudeContentPage.tsx', 'utf-8'); |
| const parseFuncMatch = content.match(/function parseAptitudeContent[\s\S]*?return questions;\n}/); |
| if (parseFuncMatch) { |
| let code = parseFuncMatch[0].replace(/export /g, ''); |
| |
| code = code.replace(/: ParsedQuestion\[\]/g, ''); |
| code = code.replace(/: string/g, ''); |
| code = code.replace(/as any/g, ''); |
| |
| const fs = require('fs'); |
| fs.writeFileSync('temp.js', ` |
| function formatPassageTables(text) { return text; } |
| ${code} |
| |
| const testText = \`Q1. What were the total sales in 2020? |
| Statement 1: Q3 sales in 2020 were ₹35 lakhs. |
| Statement 2: Total sales in 2021 were ₹140 lakhs. |
| A) Statement 1 alone B) Statement 2 alone C) Both together D) Either alone E) Neither |
| Answer: A) Statement 1 alone |
| Explanation: 2020 total = 25+30+Q3+20. With Q3=35 → total=110. St1 alone sufficient. Answer A.\`; |
| |
| console.log(JSON.stringify(parseAptitudeContent(testText), null, 2)); |
| `); |
| } |
|
|