MCPcopy Index your code
hub / github.com/ccxt/ccxt / processFile

Function processFile

utils/move-jsdoc.ts:7–44  ·  view source on GitHub ↗
(fileContent)

Source from the content-addressed store, hash-verified

5const WS_FOLDER = './ts/src/pro/';
6
7function processFile(fileContent) {
8 let fileSplit = fileContent.split('\n');
9
10 const newFile: string[] = [];
11 for (let i = 0; i < fileSplit.length; i++) {
12
13 const currentLine = fileSplit[i];
14
15 const isSignatureRegex = /\s*async\s\w+/;
16 if (isSignatureRegex.test(currentLine)) {
17 const nextLine = fileSplit[i + 1];
18 const isJSDocRegex = /\s*\/\*\*/;
19 if (isJSDocRegex.test(nextLine)) {
20 let jsDocLines = [nextLine];
21 let j = i + 2;
22 while (fileSplit[j] && !/\s*\*\//.test(fileSplit[j])) {
23 jsDocLines.push(fileSplit[j]);
24 j++;
25 }
26 jsDocLines.push(fileSplit[j]);
27 // remove 1 level of identation from jsdoc
28 const spaces4 = ' ';
29 const spaces5 = ' ';
30 jsDocLines = jsDocLines.map((line, i) => (i == 0 ? spaces4 : spaces5) + line.trim());
31 newFile.push(jsDocLines.join('\n'));
32 newFile.push(currentLine);
33 i = j;
34 } else {
35 newFile.push(currentLine);
36 }
37 } else {
38 newFile.push(currentLine);
39 }
40 }
41
42 const updatedContent = newFile.join('\n');
43 return updatedContent;
44}
45
46
47function main() {

Callers 1

mainFunction · 0.85

Calls 4

splitMethod · 0.80
pushMethod · 0.80
testMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…