feat(docgen): typescript support

This commit is contained in:
iCrawl
2022-06-08 17:26:54 +02:00
parent 1afae909d7
commit 3279b40912
42 changed files with 962 additions and 328 deletions

View File

@@ -0,0 +1,28 @@
export function splitVarName(str: string) {
const res: string[][] = [];
let currGroup: string[] = [];
let currStr = '';
const isASymbol = (char: string) => '-!$%^&*()_+|~=`{}[]:;<>?, '.includes(char);
for (const char of str) {
const currentlyInASymbolSection = isASymbol(currStr[0]!);
const charIsASymbol = isASymbol(char);
if (currStr.length && currentlyInASymbolSection !== charIsASymbol) {
currGroup.push(currStr);
currStr = char;
if (!charIsASymbol) {
res.push(currGroup);
currGroup = [];
}
} else {
currStr += char;
}
}
currGroup.push(currStr);
res.push(currGroup);
return res;
}