1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

多行内容逐行处理;更新测试用例;测试用例可以指定EOL换行符;transformMutliLineText 通过所有测试用例

This commit is contained in:
程序员小墨 2024-04-03 00:07:12 +08:00
parent c7a16581ab
commit 30224cfeb6
8 changed files with 244 additions and 90 deletions

View File

@ -2,8 +2,7 @@
// Import the module and reference it with the alias vscode in your code below // Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as TextConversion from './main-code/text-conversion'; import * as TextConversion from './main-code/text-conversion';
import { ConvertFunction, EOL } from './type-definition/convert-function-type';
type ConvertFunction = (selectionText: string) => string;
// This method is called when your extension is activated // This method is called when your extension is activated
// Your extension is activated the very first time the command is executed // Your extension is activated the very first time the command is executed
@ -32,12 +31,13 @@ export function activate(context: vscode.ExtensionContext) {
console.log('============ start convert ============'); console.log('============ start convert ============');
let document = editor.document; let document = editor.document;
let selection = editor.selection; let selection = editor.selection;
let eol: EOL = document.eol === vscode.EndOfLine.CRLF ? '\r\n' : '\n';
// 获取选中的文本 // 获取选中的文本
let text = document.getText(selection); let text = document.getText(selection);
// 转换文本 // 转换文本
const converted = convertFunction(text); const converted = convertFunction(text, eol);
console.log('converted', converted); console.log('converted', converted);
// 无法转换时,跳过转换 // 无法转换时,跳过转换

View File

@ -1,4 +1,6 @@
import { transformText } from './text-transform'; import { ConvertFunction, EOL } from '../type-definition/convert-function-type';
import { TransformTextResult } from '../type-definition/text-transform-type';
import { transformMutliLineText, transformText } from './text-transform';
/** /**
* to Camel Case * to Camel Case
@ -7,26 +9,41 @@ import { transformText } from './text-transform';
* @returns * @returns
* @since 2024-03-28 * @since 2024-03-28
*/ */
export function toCamelCase(str: string): string { export const toCamelCase: ConvertFunction = (str: string, eol: EOL): string => {
// Cut text 切割文本 // Cut text 切割文本
let result = transformText(str); const results: Array<TransformTextResult> = transformMutliLineText(str);
console.log('result', result); console.log('results', results);
// Post Process 后置处理 const transformedLines: Array<string> = [];
const words = result.trimResult.split('|'); for (const result of results) {
const camelCaseWords = words.map((word, index) => { // Post Process 后置处理
if (index === 0) { const words = result.trimResult.split('|');
// 第一个单词保持不变 let isFirstWord: boolean = true;// 用于判断首词小写
return word; const camelCaseWords: Array<string> = [];
} else { for (let index = 0; index < words.length; index++) {
// 其他单词首字母大写 const word = words[index];
return word.charAt(0).toUpperCase() + word.slice(1); const firstLetter = word.charAt(0);
const pascalCaseWord = firstLetter.toUpperCase() + word.slice(1);
if (isFirstWord) {
camelCaseWords.push(word);
if (firstLetter !== firstLetter.toUpperCase()) {
// 是大写 (A-Z), 再后面的词句不再是首词
isFirstWord = false;
}
} else {
camelCaseWords.push(pascalCaseWord);
}
if (word === '\n' || word === '\r\n') {
isFirstWord = true; // 换行后,重新计算首词
}
} }
}); const transformedLine = result.leadingSpace + camelCaseWords.join('') + result.trailingSpace;
return result.leadingSpace + camelCaseWords.join('') + result.trailingSpace; transformedLines.push(transformedLine);
}
return transformedLines.join(eol);
// return str.replace(/_([a-z])/g, (g) => g[1].toUpperCase()); // return str.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
} };
/** /**
* to Pascal Case * to Pascal Case
@ -35,7 +52,7 @@ export function toCamelCase(str: string): string {
* @returns * @returns
* @since 2024-03-28 * @since 2024-03-28
*/ */
export function toPascalCase(str: string): string { export const toPascalCase: ConvertFunction = (str: string, eol: EOL): string => {
// Cut text 切割文本 // Cut text 切割文本
let result = transformText(str); let result = transformText(str);
console.log('result', result); console.log('result', result);
@ -49,7 +66,7 @@ export function toPascalCase(str: string): string {
return result.leadingSpace + pascalCaseWords.join('') + result.trailingSpace; return result.leadingSpace + pascalCaseWords.join('') + result.trailingSpace;
// return str.replace(/(^\w|_\w)/g, (g) => g.toUpperCase().replace('_', '')); // return str.replace(/(^\w|_\w)/g, (g) => g.toUpperCase().replace('_', ''));
} };
/** /**
* to Upper Case * to Upper Case
@ -57,10 +74,10 @@ export function toPascalCase(str: string): string {
* @param {string} str user selection * @param {string} str user selection
* @returns * @returns
* @since 2024-03-28 * @since 2024-03-28
*/ */
export function toUpperCase(str: string): string { export const toUpperCase: ConvertFunction = (str: string, eol: EOL): string => {
return str.toUpperCase(); return str.toUpperCase();
} };
/** /**
* to Lower Case * to Lower Case
@ -69,6 +86,6 @@ export function toUpperCase(str: string): string {
* @returns * @returns
* @since 2024-03-28 * @since 2024-03-28
*/ */
export function toLowerCase(str: string): string { export const toLowerCase: ConvertFunction = (str: string, eol: EOL): string => {
return str.toLowerCase(); return str.toLowerCase();
} };

View File

@ -2,6 +2,15 @@ import { TransformTextResult } from "../type-definition/text-transform-type";
const logDebugInfo = false; const logDebugInfo = false;
export function transformMutliLineText(multilineInput: string): Array<TransformTextResult> {
const results: Array<TransformTextResult> = [];
const lines = multilineInput.split(/\r?\n/);
for (const line of lines) {
// console.log('line', '->' + line + '<-');
results.push(transformText(line));
}
return results;
}
/** /**
* *
* *
@ -17,6 +26,8 @@ export function transformText(input: string): TransformTextResult {
? '' // 字符串全为空格时,将尾空格置为空字符串 ? '' // 字符串全为空格时,将尾空格置为空字符串
: input.match(/ +$/); : input.match(/ +$/);
// const debug = { input, leadingSpaces, trailingSpaces };
// 去除首尾空格 // 去除首尾空格
// 不可以使用 input = input.trim(); 否则换行会被替换掉 // 不可以使用 input = input.trim(); 否则换行会被替换掉
input = input.replace(/^ +| +$/g, ''); input = input.replace(/^ +| +$/g, '');
@ -61,5 +72,6 @@ export function transformText(input: string): TransformTextResult {
trailingSpace: trailingSpaceStr, trailingSpace: trailingSpaceStr,
result: noTrimResult, result: noTrimResult,
trimResult: result, trimResult: result,
// debug: debug
}; };
} }

View File

@ -5,8 +5,9 @@ import * as assert from 'assert';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import testGroups from './test-case'; import testGroups from './test-case';
import { TestCase, TestCaseGroup } from '../type-definition/test-case-type'; import { TestCase, TestCaseGroup } from '../type-definition/test-case-type';
import { transformText } from '../main-code/text-transform'; import { transformMutliLineText, transformText } from '../main-code/text-transform';
import { toCamelCase, toPascalCase } from '../main-code/text-conversion'; import { toCamelCase, toPascalCase } from '../main-code/text-conversion';
import { TransformTextResult } from '../type-definition/text-transform-type';
// import * as myExtension from '../../extension'; // import * as myExtension from '../../extension';
/* /*
@ -31,15 +32,28 @@ suite('Extension Test: run test case', () => {
const testTitle = testGroup.testTitle; const testTitle = testGroup.testTitle;
const testCases: Array<TestCase> = testGroup.cases; const testCases: Array<TestCase> = testGroup.cases;
for (const testCase of testCases) { for (const testCase of testCases) {
// // 临时
// if (testCase.title !== '') {
// continue;
// }
test(testTitle + ' - ' + testCase.title, () => { test(testTitle + ' - ' + testCase.title, () => {
const inputList = Array.isArray(testCase.input) ? testCase.input : [testCase.input]; const inputList = Array.isArray(testCase.input) ? testCase.input : [testCase.input];
const eolList = Array.isArray(testCase.eol) ? testCase.eol : [testCase.eol];
for (const input of inputList) { for (const input of inputList) {
// console.log('input', '->' + input + '<-');
// 验证 transformText // 验证 transformText
const transformTextResult = transformText(input); const transformTextResult: Array<TransformTextResult> = transformMutliLineText(input);
assert.strictEqual(testCase.transformText, transformTextResult.result); const results = transformTextResult.map(res => res.result);
for (let index = 0; index < testCase.transformText.length; index++) {
const correctValue = testCase.transformText[index];
const currentValue = results[index];
assert.strictEqual(correctValue, currentValue);
}
// 验证转换 // 验证转换
assert.strictEqual(testCase.output.camelCase, toCamelCase(input)); for (let eol of eolList) {
assert.strictEqual(testCase.output.pascalCase, toPascalCase(input)); assert.strictEqual(testCase.output.camelCase, toCamelCase(input, eol));
assert.strictEqual(testCase.output.pascalCase, toPascalCase(input, eol));
}
} }
}); });
} }

View File

@ -1,5 +1,8 @@
import { TestCaseGroup } from "../type-definition/test-case-type"; import { TestCaseGroup } from "../type-definition/test-case-type";
const LF = '\n';
const CRLF = '\r\n';
const testGroups: Array<TestCaseGroup> = [ const testGroups: Array<TestCaseGroup> = [
{ {
group: 'Input validation', group: 'Input validation',
@ -9,7 +12,10 @@ const testGroups: Array<TestCaseGroup> = [
{ {
title: 'empty input', title: 'empty input',
input: '', input: '',
transformText: '', eol: [LF, CRLF],
transformText: [
'',
],
output: { output: {
camelCase: '', camelCase: '',
pascalCase: '', pascalCase: '',
@ -18,28 +24,65 @@ const testGroups: Array<TestCaseGroup> = [
{ {
title: 'empty input (contains space)', title: 'empty input (contains space)',
input: ' ', input: ' ',
transformText: ' ', eol: [LF, CRLF],
transformText: [
' ',
],
output: { output: {
camelCase: ' ', camelCase: ' ',
pascalCase: ' ', pascalCase: ' ',
}, },
}, },
{ {
title: 'empty input (contains space and enter 1)', title: 'empty input (contains space and crlf enter 1)',
input: ' \r\n ',
eol: [CRLF],
transformText: [
' ',
' ',
],
output: {
camelCase: ' \r\n ',
pascalCase: ' \r\n ',
},
},
{
title: 'empty input (contains space and crlf enter 2)',
input: ' x \r\ny ',
eol: [CRLF],
transformText: [
' x ',
'y ',
],
output: {
camelCase: ' x \r\ny ',
pascalCase: ' X \r\nY ',
},
},
{
title: 'empty input (contains space and lf enter 1)',
input: ' \n ', input: ' \n ',
transformText: ' \n ', eol: [LF],
transformText: [
' ',
' ',
],
output: { output: {
camelCase: ' \n ', camelCase: ' \n ',
pascalCase: ' \n ', pascalCase: ' \n ',
}, },
}, },
{ {
title: 'empty input (contains space and enter 2)', title: 'empty input (contains space and lf enter 2)',
input: ' a\nb ', input: ' a\nb ',
transformText: ' a|\n|b ', eol: [LF],
transformText: [
' a',
'b ',
],
output: { output: {
camelCase: ' a\nb ', camelCase: ' a\nb ',
pascalCase: ' a\nb ', pascalCase: ' A\nB ',
}, },
}, },
// 输入长文本 // 输入长文本
@ -48,35 +91,46 @@ const testGroups: Array<TestCaseGroup> = [
input: input:
`China's factory activity expanded in March after five consecutive months of contraction, an official survey revealed on Sunday, adding to a run of indicators that suggest the stabilization of the world's second-largest economy.` `China's factory activity expanded in March after five consecutive months of contraction, an official survey revealed on Sunday, adding to a run of indicators that suggest the stabilization of the world's second-largest economy.`
, ,
transformText: eol: [LF, CRLF],
transformText: [
"china|'|s|factory|activity|expanded|in|march|after|five|consecutive|months|of|contraction|,|an|official|survey|revealed|on|sunday|,|adding|to|a|run|of|indicators|that|suggest|the|stabilization|of|the|world|'|s|second|largest|economy|." "china|'|s|factory|activity|expanded|in|march|after|five|consecutive|months|of|contraction|,|an|official|survey|revealed|on|sunday|,|adding|to|a|run|of|indicators|that|suggest|the|stabilization|of|the|world|'|s|second|largest|economy|."
, ],
output: { output: {
camelCase: '', camelCase:
pascalCase: '', "china'SFactoryActivityExpandedInMarchAfterFiveConsecutiveMonthsOfContraction,AnOfficialSurveyRevealedOnSunday,AddingToARunOfIndicatorsThatSuggestTheStabilizationOfTheWorld'SSecondLargestEconomy."
,
pascalCase:
"China'SFactoryActivityExpandedInMarchAfterFiveConsecutiveMonthsOfContraction,AnOfficialSurveyRevealedOnSunday,AddingToARunOfIndicatorsThatSuggestTheStabilizationOfTheWorld'SSecondLargestEconomy."
,
}, },
}, },
// 输入包含数字 // 输入包含数字
{ {
title: 'text and number input', title: 'text and number input',
input: 'entity2Map', input: 'entity2Map',
transformText: 'entity|2|map', eol: [LF, CRLF],
transformText: [
'entity|2|map',
],
output: { output: {
camelCase: '', camelCase: 'entity2Map',
pascalCase: '', pascalCase: 'Entity2Map',
}, },
}, },
// 输入包含换行 // 输入包含换行
{ {
title: 'enter input', title: 'enter input',
input: input:
`How do you\bdo? 'How do you\bdo?\n How do you\tdo!'
How do you\tdo!`
, ,
transformText: 'how|do|you|\b|do|?\n|how|do|you|\t|do|!', eol: [LF, CRLF],
transformText: [
'how|do|you|\b|do|?',
' how|do|you|\t|do|!',
],
output: { output: {
camelCase: '', camelCase: 'howDoYou\bDo?\n HowDoYou\tDo!',
pascalCase: '', pascalCase: 'HowDoYou\bDo?\n HowDoYou\tDo!',
}, },
}, },
// 非英文字符,特殊字符 // 非英文字符,特殊字符
@ -85,7 +139,10 @@ const testGroups: Array<TestCaseGroup> = [
input: input:
'今天是星期日' '今天是星期日'
, ,
transformText: '今天是星期日', eol: [LF, CRLF],
transformText: [
'今天是星期日',
],
output: { output: {
camelCase: '今天是星期日', camelCase: '今天是星期日',
pascalCase: '今天是星期日', pascalCase: '今天是星期日',
@ -96,10 +153,13 @@ const testGroups: Array<TestCaseGroup> = [
input: input:
'🥰 a-cup/_of Coffee🍻,-_please!. ' '🥰 a-cup/_of Coffee🍻,-_please!. '
, ,
transformText: '🥰|a|cup|/|of|coffee|🍻,|please|!. ', eol: [LF, CRLF],
transformText: [
'🥰|a|cup|/|of|coffee|🍻,|please|!. ',
],
output: { output: {
camelCase: '', camelCase: '🥰aCup/OfCoffee🍻,Please!. ',
pascalCase: '', pascalCase: '🥰ACup/OfCoffee🍻,Please!. ',
}, },
}, },
{ {
@ -107,10 +167,13 @@ const testGroups: Array<TestCaseGroup> = [
input: input:
' NHDAs--+90-usz&* ' ' NHDAs--+90-usz&* '
, ,
transformText: ' n|h|d|as|+90|usz|&* ', eol: [LF, CRLF],
transformText: [
' n|h|d|as|+90|usz|&* ',
],
output: { output: {
camelCase: '', camelCase: ' nHDAs+90Usz&* ',
pascalCase: '', pascalCase: ' NHDAs+90Usz&* ',
}, },
}, },
{ {
@ -118,10 +181,13 @@ const testGroups: Array<TestCaseGroup> = [
input: input:
'--担心你鸿dAf_=coffee—_— ' '--担心你鸿dAf_=coffee—_— '
, ,
transformText: '担心你鸿|d|af|=|coffee|—|— ', eol: [LF, CRLF],
transformText: [
'担心你鸿|d|af|=|coffee|—|— ',
],
output: { output: {
camelCase: '', camelCase: '担心你鸿dAf=Coffee—— ',
pascalCase: '', pascalCase: '担心你鸿DAf=Coffee—— ',
}, },
}, },
{ {
@ -129,10 +195,13 @@ const testGroups: Array<TestCaseGroup> = [
input: input:
'fsdi_sdacsaf+desd' 'fsdi_sdacsaf+desd'
, ,
transformText: 'fsdi|sdacsaf|+|desd', eol: [LF, CRLF],
transformText: [
'fsdi|sdacsaf|+|desd',
],
output: { output: {
camelCase: '', camelCase: 'fsdiSdacsaf+Desd',
pascalCase: '', pascalCase: 'FsdiSdacsaf+Desd',
}, },
}, },
// add more cases... // add more cases...
@ -150,7 +219,10 @@ const testGroups: Array<TestCaseGroup> = [
'-foo -bar', '-foo -bar',
'__foo - _bar-__', '__foo - _bar-__',
], ],
transformText: 'foo|bar', eol: [LF, CRLF],
transformText: [
'foo|bar',
],
output: { output: {
camelCase: 'fooBar', camelCase: 'fooBar',
pascalCase: 'FooBar', pascalCase: 'FooBar',
@ -166,7 +238,10 @@ const testGroups: Array<TestCaseGroup> = [
'TestCase', 'TestCase',
'TEST_CASE', 'TEST_CASE',
], ],
transformText: 'test|case', eol: [LF, CRLF],
transformText: [
'test|case',
],
output: { output: {
camelCase: 'testCase', camelCase: 'testCase',
pascalCase: 'TestCase', pascalCase: 'TestCase',
@ -177,7 +252,10 @@ const testGroups: Array<TestCaseGroup> = [
input: [ input: [
'pineApple', 'pineApple',
], ],
transformText: 'pine|apple', eol: [LF, CRLF],
transformText: [
'pine|apple',
],
output: { output: {
camelCase: 'pineApple', camelCase: 'pineApple',
pascalCase: 'PineApple', pascalCase: 'PineApple',
@ -197,7 +275,10 @@ const testGroups: Array<TestCaseGroup> = [
'HaveANiceDay!', 'HaveANiceDay!',
'haveANiceDay!', 'haveANiceDay!',
], ],
transformText: 'have|a|nice|day|!', eol: [LF, CRLF],
transformText: [
'have|a|nice|day|!',
],
output: { output: {
camelCase: 'haveANiceDay!', camelCase: 'haveANiceDay!',
pascalCase: 'HaveANiceDay!', pascalCase: 'HaveANiceDay!',
@ -215,7 +296,10 @@ const testGroups: Array<TestCaseGroup> = [
// ' A----NiCe_Day_-_!-- ', // ' A----NiCe_Day_-_!-- ',
' A----NICE_Day_-_!-- ', ' A----NICE_Day_-_!-- ',
], ],
transformText: ' a|nice|day|! ', eol: [LF, CRLF],
transformText: [
' a|nice|day|! ',
],
output: { output: {
camelCase: ' aNiceDay! ', camelCase: ' aNiceDay! ',
pascalCase: ' ANiceDay! ', pascalCase: ' ANiceDay! ',
@ -227,22 +311,28 @@ const testGroups: Array<TestCaseGroup> = [
' A NICE-Day-', ' A NICE-Day-',
' A niceDay', ' A niceDay',
], ],
transformText: ' a|nice|day', eol: [LF, CRLF],
transformText: [
' a|nice|day',
],
output: { output: {
camelCase: ' a niceDay', camelCase: ' aNiceDay',
pascalCase: ' A NiceDay', pascalCase: ' ANiceDay',
}, },
}, },
{ {
title: 'Normal input (foo-bar)', title: 'Normal input (apple-2-Tree)',
input: [ input: [
' app2-Trrre ', ' apple2-Tree ',
' app2Trrre ', ' apple2Tree ',
],
eol: [LF, CRLF],
transformText: [
' apple|2|tree ',
], ],
transformText: ' app|2|trrre ',
output: { output: {
camelCase: '', camelCase: ' apple2Tree ',
pascalCase: '', pascalCase: ' Apple2Tree ',
}, },
}, },
{ {
@ -250,24 +340,35 @@ const testGroups: Array<TestCaseGroup> = [
input: input:
' Julius_Caesar, William_Shakespeare, Albert_Einstein, Marie_Curie, WolfgangAmadeusMozart, Vincent-van-Gogh. ' ' Julius_Caesar, William_Shakespeare, Albert_Einstein, Marie_Curie, WolfgangAmadeusMozart, Vincent-van-Gogh. '
, ,
transformText: ' julius|caesar|,|william|shakespeare|,|albert|einstein|,|marie|curie|,|wolfgang|amadeus|mozart|,|vincent|van|gogh|. ', eol: [LF, CRLF],
transformText: [
' julius|caesar|,|william|shakespeare|,|albert|einstein|,|marie|curie|,|wolfgang|amadeus|mozart|,|vincent|van|gogh|. ',
],
output: { output: {
camelCase: '', camelCase: ' juliusCaesar,WilliamShakespeare,AlbertEinstein,MarieCurie,WolfgangAmadeusMozart,VincentVanGogh. ',
pascalCase: '', pascalCase: ' JuliusCaesar,WilliamShakespeare,AlbertEinstein,MarieCurie,WolfgangAmadeusMozart,VincentVanGogh. ',
}, },
}, },
{ {
title: 'Normal input (&quot;You&quot; (or &quot;Your&quot;) ...)', title: 'Normal input (&quot;You&quot; (or &quot;Your&quot;) ...)',
input: input:
[ ' &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity\n' +
` &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity`, ' exercising permissions granted by this License.'
` exercising permissions granted by this License.`
].join('\n')
, ,
transformText: ' &|quot|;|you|&|quot|;|(|or|&|quot|;|your|&|quot|;)|shall|mean|an|individual|or|legal|entity|\n|exercising|permissions|granted|by|this|license|.', eol: [LF],
transformText: [
' &|quot|;|you|&|quot|;|(|or|&|quot|;|your|&|quot|;)|shall|mean|an|individual|or|legal|entity',
' exercising|permissions|granted|by|this|license|.',
],
output: { output: {
camelCase: ' &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity\n exercising permissions granted by this License.', camelCase:
pascalCase: ' &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity\n exercising permissions granted by this License.', ' &quot;You&Quot;(Or&Quot;Your&Quot;)ShallMeanAnIndividualOrLegalEntity\n' +
' exercisingPermissionsGrantedByThisLicense.'
,
pascalCase:
' &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity\n' +
' exercising permissions granted by this License.'
,
}, },
}, },
// add more cases... // add more cases...
@ -290,7 +391,10 @@ const testGroups: Array<TestCaseGroup> = [
// { // {
// title: 'Normal input ( ...)', // title: 'Normal input ( ...)',
// input: '', // input: '',
// transformText: '', // eol: [LF, CRLF],
// transformText: [
// '',
// ],
// output: { // output: {
// camelCase: '', // camelCase: '',
// pascalCase: '' // pascalCase: ''

View File

@ -0,0 +1,3 @@
export type EOL = '\n' | '\r\n';
export type ConvertFunction = (selectionText: string, eol: EOL) => string;

View File

@ -1,3 +1,5 @@
import { EOL } from "./convert-function-type";
export type TestCaseGroup = { export type TestCaseGroup = {
group: string group: string
testTitle: string testTitle: string
@ -7,7 +9,8 @@ export type TestCaseGroup = {
export type TestCase = { export type TestCase = {
title: string title: string
input: string | Array<string> input: string | Array<string>
transformText: string eol: EOL | Array<EOL>
transformText: Array<string>
output: { output: {
camelCase: string camelCase: string
pascalCase: string pascalCase: string

View File

@ -3,4 +3,5 @@ export type TransformTextResult = {
trailingSpace: string trailingSpace: string
result: string result: string
trimResult: string trimResult: string
// debug?: any
}; };