-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch.js
More file actions
44 lines (37 loc) · 1.39 KB
/
Copy pathpatch.js
File metadata and controls
44 lines (37 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const fs = require('fs');
let content = fs.readFileSync('tools/sql-formatter/schema_converter.js', 'utf8');
const conflictBlock = `<<<<<<< HEAD
let columnLines = [];
let currentLine = "";
parenDepth = 0;
inString = false;
for (let i = 0; i < columnsStr.length; i++) {
const char = columnsStr[i];
if (!inString && (char === "'" || char === '"' || char === '`')) {
inString = true;
stringChar = char;
currentLine += char;
continue;
}
if (inString) {
if (char === stringChar) inString = false;
currentLine += char;
continue;
}
if (char === '(') {
parenDepth++;
} else if (char === ')') {
parenDepth--;
} else if (char === ',' && parenDepth === 0) {
columnLines.push(currentLine.trim());
currentLine = "";
continue;
}
currentLine += char;
}
if (currentLine.trim()) columnLines.push(currentLine.trim());
=======
let columnLines = splitColumns(columnsStr);
>>>>>>> origin/main`;
content = content.replace(conflictBlock, ` let columnLines = splitColumns(columnsStr);`);
fs.writeFileSync('tools/sql-formatter/schema_converter.js', content);