新增 空格分隔 + 小驼峰/大驼峰/全小写/全大写;修正 KEBAB_PASCAL_CASE, KEBAB_UPPER_CASE 关键词错误;添加测试用例并通过测试用例
This commit is contained in:
parent
ef42f97944
commit
62b9acc38f
@ -26,9 +26,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Add 4 new conversion types: space case, space camel case, space pascal case, space upper case (新增 4 种转换类型: 空格分隔 + 小驼峰/大驼峰/全小写/全大写)
|
||||
|
||||
### Changed
|
||||
|
||||
-- Optimize QickPick conversion value display (优化 QickPick 转换值展示)
|
||||
- Optimize QickPick conversion value display (优化 QickPick 转换值展示)
|
||||
- Fixed typo: keyword of KEBAB_PASCAL_CASE, KEBAB_UPPER_CASE (修正 KEBAB_PASCAL_CASE, KEBAB_UPPER_CASE 关键词错误)
|
||||
|
||||
## 1.0.6
|
||||
|
||||
|
@ -91,7 +91,24 @@
|
||||
"command": "variable-conversion.toKebabCamelCase",
|
||||
"title": "连字符(脊柱式) + 小驼峰(驼峰)命名 (Kebab Camel Case) [ foo-Bar ]"
|
||||
},
|
||||
// group-4-upper-lower
|
||||
// group-4-space
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCase",
|
||||
"title": "空格分隔命名 (Space Case) [ foo bar ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceUpperCase",
|
||||
"title": "空格分隔 + 全大写命名 (Space Upper Case) [ FOO BAR ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpacePascalCase",
|
||||
"title": "空格分隔 + 大驼峰(帕斯卡)命名 (Space Pascal Case) [ Foo Bar ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCamelCase",
|
||||
"title": "空格分隔 + 小驼峰(驼峰)命名 (Space Camel Case) [ foo Bar ]"
|
||||
},
|
||||
// group-5-upper-lower
|
||||
{
|
||||
"command": "variable-conversion.toLowerCase",
|
||||
"title": "全小写 (Lower Case) [ foobar ]"
|
||||
@ -160,6 +177,7 @@
|
||||
}
|
||||
],
|
||||
"variable-conversion.stringConversionMenu": [
|
||||
// group-1-camel
|
||||
{
|
||||
"command": "variable-conversion.toCamelCase",
|
||||
"group": "group-1-camel@1"
|
||||
@ -168,6 +186,7 @@
|
||||
"command": "variable-conversion.toPascalCase",
|
||||
"group": "group-1-camel@2"
|
||||
},
|
||||
// group-2-snake
|
||||
{
|
||||
"command": "variable-conversion.toSnakeCase",
|
||||
"group": "group-2-snake@1"
|
||||
@ -184,6 +203,7 @@
|
||||
"command": "variable-conversion.toSnakeCamelCase",
|
||||
"group": "group-2-snake@4"
|
||||
},
|
||||
// group-3-kebab
|
||||
{
|
||||
"command": "variable-conversion.toKebabCase",
|
||||
"group": "group-3-kebab@1"
|
||||
@ -200,13 +220,31 @@
|
||||
"command": "variable-conversion.toKebabCamelCase",
|
||||
"group": "group-3-kebab@4"
|
||||
},
|
||||
// group-4-space
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCase",
|
||||
"group": "group-4-space@1"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceUpperCase",
|
||||
"group": "group-4-space@2"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpacePascalCase",
|
||||
"group": "group-4-space@3"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCamelCase",
|
||||
"group": "group-4-space@4"
|
||||
},
|
||||
// group-5-upper-lower
|
||||
{
|
||||
"command": "variable-conversion.toLowerCase",
|
||||
"group": "group-4-upper-lower@1"
|
||||
"group": "group-5-upper-lower@1"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toUpperCase",
|
||||
"group": "group-4-upper-lower@2"
|
||||
"group": "group-5-upper-lower@2"
|
||||
}
|
||||
// 隐藏菜单项
|
||||
// {
|
||||
|
36
package.json
36
package.json
@ -76,6 +76,22 @@
|
||||
"command": "variable-conversion.toKebabCamelCase",
|
||||
"title": "连字符(脊柱式) + 小驼峰(驼峰)命名 (Kebab Camel Case) [ foo-Bar ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCase",
|
||||
"title": "空格分隔命名 (Space Case) [ foo bar ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceUpperCase",
|
||||
"title": "空格分隔 + 全大写命名 (Space Upper Case) [ FOO BAR ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpacePascalCase",
|
||||
"title": "空格分隔 + 大驼峰(帕斯卡)命名 (Space Pascal Case) [ Foo Bar ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCamelCase",
|
||||
"title": "空格分隔 + 小驼峰(驼峰)命名 (Space Camel Case) [ foo Bar ]"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toLowerCase",
|
||||
"title": "全小写 (Lower Case) [ foobar ]"
|
||||
@ -146,13 +162,29 @@
|
||||
"command": "variable-conversion.toKebabCamelCase",
|
||||
"group": "group-3-kebab@4"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCase",
|
||||
"group": "group-4-space@1"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceUpperCase",
|
||||
"group": "group-4-space@2"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpacePascalCase",
|
||||
"group": "group-4-space@3"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toSpaceCamelCase",
|
||||
"group": "group-4-space@4"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toLowerCase",
|
||||
"group": "group-4-upper-lower@1"
|
||||
"group": "group-5-upper-lower@1"
|
||||
},
|
||||
{
|
||||
"command": "variable-conversion.toUpperCase",
|
||||
"group": "group-4-upper-lower@2"
|
||||
"group": "group-5-upper-lower@2"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -96,7 +96,7 @@ export function handleQuickPick() {
|
||||
title: '请选择需要转换的命名类型...',
|
||||
placeHolder: '点击转换,输入关键词可快速选择'
|
||||
}).then(pickItem => {
|
||||
if (pickItem === undefined) {
|
||||
if (!editor || pickItem === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,12 @@ export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, c
|
||||
case SupportCase.KEBAB_UPPER_CASE: // 连字符(脊柱式) + 全大写命名
|
||||
spaceCharacter = '-';
|
||||
break;
|
||||
case SupportCase.SPACE_CASE: // 空格分隔命名
|
||||
case SupportCase.SPACE_CAMEL_CASE: // 空格分隔 + 小驼峰(驼峰)命名
|
||||
case SupportCase.SPACE_PASCAL_CASE: // 空格分隔 + 大驼峰(帕斯卡)命名
|
||||
case SupportCase.SPACE_UPPER_CASE: // 空格分隔 + 全大写命名
|
||||
spaceCharacter = ' ';
|
||||
break;
|
||||
case SupportCase.LOWER_CASE: // 全小写
|
||||
return str.toLowerCase();
|
||||
case SupportCase.UPPER_CASE: // 全大写
|
||||
@ -75,6 +81,7 @@ export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, c
|
||||
case SupportCase.CAMEL_CASE: // 小驼峰(驼峰)命名
|
||||
case SupportCase.SNAKE_CAMEL_CASE: // 下划线(蛇形) + 小驼峰(驼峰)命名
|
||||
case SupportCase.KEBAB_CAMEL_CASE: // 连字符(脊柱式) + 小驼峰(驼峰)命名
|
||||
case SupportCase.SPACE_CAMEL_CASE: // 空格分隔 + 小驼峰(驼峰)命名
|
||||
if (isFirstWord) {
|
||||
transformedWords.push(word);
|
||||
if (isCurrentWordNormal) {
|
||||
@ -87,14 +94,17 @@ export function caseConversion(targetCase: SupportCase, str: string, eol: EOL, c
|
||||
case SupportCase.PASCAL_CASE: // 大驼峰(帕斯卡)命名
|
||||
case SupportCase.SNAKE_PASCAL_CASE: // 下划线(蛇形) + 大驼峰(帕斯卡)命名
|
||||
case SupportCase.KEBAB_PASCAL_CASE: // 连字符(脊柱式) + 大驼峰(帕斯卡)命名
|
||||
case SupportCase.SPACE_PASCAL_CASE: // 空格分隔 + 大驼峰(帕斯卡)命名
|
||||
transformedWords.push(pascalCaseWord);
|
||||
break;
|
||||
case SupportCase.SNAKE_CASE: // 下划线(蛇形)命名
|
||||
case SupportCase.KEBAB_CASE: // 转连字符 / 脊柱式命名
|
||||
case SupportCase.KEBAB_CASE: // 连字符(脊柱式)命名
|
||||
case SupportCase.SPACE_CASE: // 空格分隔命名
|
||||
transformedWords.push(word);
|
||||
break;
|
||||
case SupportCase.SNAKE_UPPER_CASE: // 下划线(蛇形) + 全大写命名
|
||||
case SupportCase.KEBAB_UPPER_CASE: // 连字符(脊柱式) + 全大写命名
|
||||
case SupportCase.SPACE_UPPER_CASE: // 空格分隔 + 全大写命名
|
||||
transformedWords.push(word.toUpperCase());
|
||||
break;
|
||||
default:
|
||||
|
@ -51,14 +51,22 @@ suite('Extension Test: run test case', () => {
|
||||
for (let eol of eolList) {
|
||||
assert.strictEqual(testCase.output.camelCase, caseConversion(SupportCase.CAMEL_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.pascalCase, caseConversion(SupportCase.PASCAL_CASE, input, eol));
|
||||
|
||||
assert.strictEqual(testCase.output.snakeCase, caseConversion(SupportCase.SNAKE_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.snakeCamelCase, caseConversion(SupportCase.SNAKE_CAMEL_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.snakePascalCase, caseConversion(SupportCase.SNAKE_PASCAL_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.snakeUpperCase, caseConversion(SupportCase.SNAKE_UPPER_CASE, input, eol));
|
||||
|
||||
assert.strictEqual(testCase.output.kebabCase, caseConversion(SupportCase.KEBAB_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.kebabCamelCase, caseConversion(SupportCase.KEBAB_CAMEL_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.kebabPascalCase, caseConversion(SupportCase.KEBAB_PASCAL_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.kebabUpperCase, caseConversion(SupportCase.KEBAB_UPPER_CASE, input, eol));
|
||||
|
||||
assert.strictEqual(testCase.output.spaceCase, caseConversion(SupportCase.SPACE_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.spaceCamelCase, caseConversion(SupportCase.SPACE_CAMEL_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.spacePascalCase, caseConversion(SupportCase.SPACE_PASCAL_CASE, input, eol));
|
||||
assert.strictEqual(testCase.output.spaceUpperCase, caseConversion(SupportCase.SPACE_UPPER_CASE, input, eol));
|
||||
|
||||
if (testCase.output.lowerCase !== undefined) {
|
||||
assert.strictEqual(testCase.output.lowerCase, caseConversion(SupportCase.LOWER_CASE, input, eol));
|
||||
}
|
||||
|
@ -27,6 +27,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: '',
|
||||
kebabPascalCase: '',
|
||||
kebabUpperCase: '',
|
||||
spaceCase: '',
|
||||
spaceCamelCase: '',
|
||||
spacePascalCase: '',
|
||||
spaceUpperCase: '',
|
||||
lowerCase: '',
|
||||
upperCase: '',
|
||||
},
|
||||
@ -49,6 +53,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' ',
|
||||
kebabPascalCase: ' ',
|
||||
kebabUpperCase: ' ',
|
||||
spaceCase: ' ',
|
||||
spaceCamelCase: ' ',
|
||||
spacePascalCase: ' ',
|
||||
spaceUpperCase: ' ',
|
||||
lowerCase: ' ',
|
||||
upperCase: ' ',
|
||||
},
|
||||
@ -72,6 +80,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' \r\n ',
|
||||
kebabPascalCase: ' \r\n ',
|
||||
kebabUpperCase: ' \r\n ',
|
||||
spaceCase: ' \r\n ',
|
||||
spaceCamelCase: ' \r\n ',
|
||||
spacePascalCase: ' \r\n ',
|
||||
spaceUpperCase: ' \r\n ',
|
||||
lowerCase: ' \r\n ',
|
||||
upperCase: ' \r\n ',
|
||||
},
|
||||
@ -95,6 +107,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' x \r\ny ',
|
||||
kebabPascalCase: ' X \r\nY ',
|
||||
kebabUpperCase: ' X \r\nY ',
|
||||
spaceCase: ' x \r\ny ',
|
||||
spaceCamelCase: ' x \r\ny ',
|
||||
spacePascalCase: ' X \r\nY ',
|
||||
spaceUpperCase: ' X \r\nY ',
|
||||
lowerCase: ' x \r\ny ',
|
||||
upperCase: ' X \r\nY ',
|
||||
},
|
||||
@ -118,6 +134,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' \n ',
|
||||
kebabPascalCase: ' \n ',
|
||||
kebabUpperCase: ' \n ',
|
||||
spaceCase: ' \n ',
|
||||
spaceCamelCase: ' \n ',
|
||||
spacePascalCase: ' \n ',
|
||||
spaceUpperCase: ' \n ',
|
||||
lowerCase: ' \n ',
|
||||
upperCase: ' \n ',
|
||||
},
|
||||
@ -141,6 +161,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' a\nb ',
|
||||
kebabPascalCase: ' A\nB ',
|
||||
kebabUpperCase: ' A\nB ',
|
||||
spaceCase: ' a\nb ',
|
||||
spaceCamelCase: ' a\nb ',
|
||||
spacePascalCase: ' A\nB ',
|
||||
spaceUpperCase: ' A\nB ',
|
||||
lowerCase: ' a\nb ',
|
||||
upperCase: ' A\nB ',
|
||||
},
|
||||
@ -186,6 +210,18 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabUpperCase:
|
||||
"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."
|
||||
,
|
||||
spaceCase:
|
||||
"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."
|
||||
,
|
||||
spaceCamelCase:
|
||||
"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."
|
||||
,
|
||||
spacePascalCase:
|
||||
"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."
|
||||
,
|
||||
spaceUpperCase:
|
||||
"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."
|
||||
,
|
||||
lowerCase:
|
||||
"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."
|
||||
,
|
||||
@ -213,6 +249,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'entity2Map',
|
||||
kebabPascalCase: 'Entity2Map',
|
||||
kebabUpperCase: 'ENTITY2MAP',
|
||||
spaceCase: 'entity2map',
|
||||
spaceCamelCase: 'entity2Map',
|
||||
spacePascalCase: 'Entity2Map',
|
||||
spaceUpperCase: 'ENTITY2MAP',
|
||||
lowerCase: 'entity2map',
|
||||
upperCase: 'ENTITY2MAP',
|
||||
},
|
||||
@ -239,6 +279,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'how-Do-You\bDo?\n how-Do-You\tDo!',
|
||||
kebabPascalCase: 'How-Do-You\bDo?\n How-Do-You\tDo!',
|
||||
kebabUpperCase: 'HOW-DO-YOU\bDO?\n HOW-DO-YOU\tDO!',
|
||||
spaceCase: 'how do you\bdo?\n how do you\tdo!',
|
||||
spaceCamelCase: 'how Do You\bDo?\n how Do You\tDo!',
|
||||
spacePascalCase: 'How Do You\bDo?\n How Do You\tDo!',
|
||||
spaceUpperCase: 'HOW DO YOU\bDO?\n HOW DO YOU\tDO!',
|
||||
lowerCase: 'how do you\bdo?\n how do you\tdo!',
|
||||
upperCase: 'HOW DO YOU\bDO?\n HOW DO YOU\tDO!',
|
||||
},
|
||||
@ -264,6 +308,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: '今天是星期日',
|
||||
kebabPascalCase: '今天是星期日',
|
||||
kebabUpperCase: '今天是星期日',
|
||||
spaceCase: '今天是星期日',
|
||||
spaceCamelCase: '今天是星期日',
|
||||
spacePascalCase: '今天是星期日',
|
||||
spaceUpperCase: '今天是星期日',
|
||||
lowerCase: '今天是星期日',
|
||||
upperCase: '今天是星期日',
|
||||
},
|
||||
@ -288,6 +336,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: '担心你d-Af=Coffee—爸妈不在家— ',
|
||||
kebabPascalCase: '担心你D-Af=Coffee—爸妈不在家— ',
|
||||
kebabUpperCase: '担心你D-AF=COFFEE—爸妈不在家— ',
|
||||
spaceCase: '担心你d af=coffee—爸妈不在家— ',
|
||||
spaceCamelCase: '担心你d Af=Coffee—爸妈不在家— ',
|
||||
spacePascalCase: '担心你D Af=Coffee—爸妈不在家— ',
|
||||
spaceUpperCase: '担心你D AF=COFFEE—爸妈不在家— ',
|
||||
lowerCase: '--担心你daf_=coffee—爸妈不在家_— ',
|
||||
upperCase: '--担心你DAF_=COFFEE—爸妈不在家_— ',
|
||||
},
|
||||
@ -312,6 +364,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: '🥰a-Cup/Of-Coffee🍻,Please!. ',
|
||||
kebabPascalCase: '🥰A-Cup/Of-Coffee🍻,Please!. ',
|
||||
kebabUpperCase: '🥰A-CUP/OF-COFFEE🍻,PLEASE!. ',
|
||||
spaceCase: '🥰a cup/of coffee🍻,please!. ',
|
||||
spaceCamelCase: '🥰a Cup/Of Coffee🍻,Please!. ',
|
||||
spacePascalCase: '🥰A Cup/Of Coffee🍻,Please!. ',
|
||||
spaceUpperCase: '🥰A CUP/OF COFFEE🍻,PLEASE!. ',
|
||||
lowerCase: '🥰 a-cup/_of coffee🍻,-_please!. ',
|
||||
upperCase: '🥰 A-CUP/_OF COFFEE🍻,-_PLEASE!. ',
|
||||
},
|
||||
@ -336,6 +392,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'take-A-Rest😊Ha-P-Py,😢Tri-Ste,Enfadado,驚きました,❤️,笑,😎C-Ool,😳Embarrassed',
|
||||
kebabPascalCase: 'Take-A-Rest😊Ha-P-Py,😢Tri-Ste,Enfadado,驚きました,❤️,笑,😎C-Ool,😳Embarrassed',
|
||||
kebabUpperCase: 'TAKE-A-REST😊HA-P-PY,😢TRI-STE,ENFADADO,驚きました,❤️,笑,😎C-OOL,😳EMBARRASSED',
|
||||
spaceCase: 'take a rest😊ha p py,😢tri ste,enfadado,驚きました,❤️,笑,😎c ool,😳embarrassed',
|
||||
spaceCamelCase: 'take A Rest😊Ha P Py,😢Tri Ste,Enfadado,驚きました,❤️,笑,😎C Ool,😳Embarrassed',
|
||||
spacePascalCase: 'Take A Rest😊Ha P Py,😢Tri Ste,Enfadado,驚きました,❤️,笑,😎C Ool,😳Embarrassed',
|
||||
spaceUpperCase: 'TAKE A REST😊HA P PY,😢TRI STE,ENFADADO,驚きました,❤️,笑,😎C OOL,😳EMBARRASSED',
|
||||
lowerCase: 'takearest😊happy,😢triste,enfadado, 驚きました,❤️, 笑, 😎cool, 😳-embarrassed',
|
||||
upperCase: 'TAKEAREST😊HAPPY,😢TRISTE,ENFADADO, 驚きました,❤️, 笑, 😎COOL, 😳-EMBARRASSED',
|
||||
},
|
||||
@ -360,6 +420,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' n-H-D-As+90Usz&* ',
|
||||
kebabPascalCase: ' N-H-D-As+90Usz&* ',
|
||||
kebabUpperCase: ' N-H-D-AS+90USZ&* ',
|
||||
spaceCase: ' n h d as+90usz&* ',
|
||||
spaceCamelCase: ' n H D As+90Usz&* ',
|
||||
spacePascalCase: ' N H D As+90Usz&* ',
|
||||
spaceUpperCase: ' N H D AS+90USZ&* ',
|
||||
lowerCase: ' nhdas--+90-usz&* ',
|
||||
upperCase: ' NHDAS--+90-USZ&* ',
|
||||
},
|
||||
@ -384,6 +448,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'fsdi-Sdacsaf+Desd',
|
||||
kebabPascalCase: 'Fsdi-Sdacsaf+Desd',
|
||||
kebabUpperCase: 'FSDI-SDACSAF+DESD',
|
||||
spaceCase: 'fsdi sdacsaf+desd',
|
||||
spaceCamelCase: 'fsdi Sdacsaf+Desd',
|
||||
spacePascalCase: 'Fsdi Sdacsaf+Desd',
|
||||
spaceUpperCase: 'FSDI SDACSAF+DESD',
|
||||
lowerCase: 'fsdi_sdacsaf+desd',
|
||||
upperCase: 'FSDI_SDACSAF+DESD',
|
||||
},
|
||||
@ -418,6 +486,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'foo-Bar',
|
||||
kebabPascalCase: 'Foo-Bar',
|
||||
kebabUpperCase: 'FOO-BAR',
|
||||
spaceCase: 'foo bar',
|
||||
spaceCamelCase: 'foo Bar',
|
||||
spacePascalCase: 'Foo Bar',
|
||||
spaceUpperCase: 'FOO BAR',
|
||||
// lowerCase: 'foo--bar',
|
||||
// upperCase: 'FOO--BAR',
|
||||
},
|
||||
@ -447,6 +519,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'test-Case',
|
||||
kebabPascalCase: 'Test-Case',
|
||||
kebabUpperCase: 'TEST-CASE',
|
||||
spaceCase: 'test case',
|
||||
spaceCamelCase: 'test Case',
|
||||
spacePascalCase: 'Test Case',
|
||||
spaceUpperCase: 'TEST CASE',
|
||||
// lowerCase: 'test case',
|
||||
// upperCase: 'TEST CASE',
|
||||
},
|
||||
@ -473,6 +549,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'apple',
|
||||
kebabPascalCase: 'Apple',
|
||||
kebabUpperCase: 'APPLE',
|
||||
spaceCase: 'apple',
|
||||
spaceCamelCase: 'apple',
|
||||
spacePascalCase: 'Apple',
|
||||
spaceUpperCase: 'APPLE',
|
||||
lowerCase: 'apple',
|
||||
upperCase: 'APPLE',
|
||||
},
|
||||
@ -497,6 +577,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'pine-Apple',
|
||||
kebabPascalCase: 'Pine-Apple',
|
||||
kebabUpperCase: 'PINE-APPLE',
|
||||
spaceCase: 'pine apple',
|
||||
spaceCamelCase: 'pine Apple',
|
||||
spacePascalCase: 'Pine Apple',
|
||||
spaceUpperCase: 'PINE APPLE',
|
||||
lowerCase: 'pineapple',
|
||||
upperCase: 'PINEAPPLE',
|
||||
},
|
||||
@ -530,6 +614,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'have-A-Nice-Day!',
|
||||
kebabPascalCase: 'Have-A-Nice-Day!',
|
||||
kebabUpperCase: 'HAVE-A-NICE-DAY!',
|
||||
spaceCase: 'have a nice day!',
|
||||
spaceCamelCase: 'have A Nice Day!',
|
||||
spacePascalCase: 'Have A Nice Day!',
|
||||
spaceUpperCase: 'HAVE A NICE DAY!',
|
||||
// lowerCase: 'have a nice day!',
|
||||
// upperCase: 'HAVE A NICE DAY!',
|
||||
},
|
||||
@ -561,6 +649,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' a-Nice-Day! ',
|
||||
kebabPascalCase: ' A-Nice-Day! ',
|
||||
kebabUpperCase: ' A-NICE-DAY! ',
|
||||
spaceCase: ' a nice day! ',
|
||||
spaceCamelCase: ' a Nice Day! ',
|
||||
spacePascalCase: ' A Nice Day! ',
|
||||
spaceUpperCase: ' A NICE DAY! ',
|
||||
// lowerCase: ' a nice day! ',
|
||||
// upperCase: ' A NICE DAY! ',
|
||||
},
|
||||
@ -586,6 +678,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' a-Nice-Day',
|
||||
kebabPascalCase: ' A-Nice-Day',
|
||||
kebabUpperCase: ' A-NICE-DAY',
|
||||
spaceCase: ' a nice day',
|
||||
spaceCamelCase: ' a Nice Day',
|
||||
spacePascalCase: ' A Nice Day',
|
||||
spaceUpperCase: ' A NICE DAY',
|
||||
// lowerCase: ' a nice-day-',
|
||||
// upperCase: ' A NICE-DAY-',
|
||||
},
|
||||
@ -610,6 +706,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: 'tom-Likes-Eat-Ice-Cream.',
|
||||
kebabPascalCase: 'Tom-Likes-Eat-Ice-Cream.',
|
||||
kebabUpperCase: 'TOM-LIKES-EAT-ICE-CREAM.',
|
||||
spaceCase: 'tom likes eat ice cream.',
|
||||
spaceCamelCase: 'tom Likes Eat Ice Cream.',
|
||||
spacePascalCase: 'Tom Likes Eat Ice Cream.',
|
||||
spaceUpperCase: 'TOM LIKES EAT ICE CREAM.',
|
||||
lowerCase: 'tomlikes eat icecream.',
|
||||
upperCase: 'TOMLIKES EAT ICECREAM.',
|
||||
},
|
||||
@ -635,6 +735,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' apple2Tree ',
|
||||
kebabPascalCase: ' Apple2Tree ',
|
||||
kebabUpperCase: ' APPLE2TREE ',
|
||||
spaceCase: ' apple2tree ',
|
||||
spaceCamelCase: ' apple2Tree ',
|
||||
spacePascalCase: ' Apple2Tree ',
|
||||
spaceUpperCase: ' APPLE2TREE ',
|
||||
// lowerCase: ' apple2-tree ',
|
||||
// upperCase: ' APPLE2-TREE ',
|
||||
},
|
||||
@ -659,6 +763,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
kebabCamelCase: ' julius-Caesar,William-Shakespeare,Albert-Einstein,Marie-Curie,Wolfgang-Amadeus-Mozart,Vincent-Van-Gogh. ',
|
||||
kebabPascalCase: ' Julius-Caesar,William-Shakespeare,Albert-Einstein,Marie-Curie,Wolfgang-Amadeus-Mozart,Vincent-Van-Gogh. ',
|
||||
kebabUpperCase: ' JULIUS-CAESAR,WILLIAM-SHAKESPEARE,ALBERT-EINSTEIN,MARIE-CURIE,WOLFGANG-AMADEUS-MOZART,VINCENT-VAN-GOGH. ',
|
||||
spaceCase: ' julius caesar,william shakespeare,albert einstein,marie curie,wolfgang amadeus mozart,vincent van gogh. ',
|
||||
spaceCamelCase: ' julius Caesar,William Shakespeare,Albert Einstein,Marie Curie,Wolfgang Amadeus Mozart,Vincent Van Gogh. ',
|
||||
spacePascalCase: ' Julius Caesar,William Shakespeare,Albert Einstein,Marie Curie,Wolfgang Amadeus Mozart,Vincent Van Gogh. ',
|
||||
spaceUpperCase: ' JULIUS CAESAR,WILLIAM SHAKESPEARE,ALBERT EINSTEIN,MARIE CURIE,WOLFGANG AMADEUS MOZART,VINCENT VAN GOGH. ',
|
||||
lowerCase: ' julius_caesar, william_shakespeare, albert_einstein, marie_curie, wolfgangamadeusmozart, vincent-van-gogh. ',
|
||||
upperCase: ' JULIUS_CAESAR, WILLIAM_SHAKESPEARE, ALBERT_EINSTEIN, MARIE_CURIE, WOLFGANGAMADEUSMOZART, VINCENT-VAN-GOGH. ',
|
||||
},
|
||||
@ -715,6 +823,22 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
' "YOU"(OR"YOUR")SHALL-MEAN-AN-INDIVIDUAL-OR-LEGAL-ENTITY\n' +
|
||||
' EXERCISING-PERMISSIONS-GRANTED-BY-THIS-LICENSE.'
|
||||
,
|
||||
spaceCase:
|
||||
' "you"(or"your")shall mean an individual or legal entity\n' +
|
||||
' exercising permissions granted by this license.'
|
||||
,
|
||||
spaceCamelCase:
|
||||
' "You&Quot;(Or&Quot;Your&Quot;)Shall Mean An Individual Or Legal Entity\n' +
|
||||
' exercising Permissions Granted By This License.'
|
||||
,
|
||||
spacePascalCase:
|
||||
' &Quot;You&Quot;(Or&Quot;Your&Quot;)Shall Mean An Individual Or Legal Entity\n' +
|
||||
' Exercising Permissions Granted By This License.'
|
||||
,
|
||||
spaceUpperCase:
|
||||
' "YOU"(OR"YOUR")SHALL MEAN AN INDIVIDUAL OR LEGAL ENTITY\n' +
|
||||
' EXERCISING PERMISSIONS GRANTED BY THIS LICENSE.'
|
||||
,
|
||||
lowerCase:
|
||||
' "you" (or "your") shall mean an individual or legal entity\n' +
|
||||
' exercising permissions granted by this license.'
|
||||
@ -760,6 +884,10 @@ const testGroups: Array<TestCaseGroup> = [
|
||||
// kebabCamelCase: '',
|
||||
// kebabPascalCase: '',
|
||||
// kebabUpperCase: '',
|
||||
// spaceCase: '',
|
||||
// spaceCamelCase: '',
|
||||
// spacePascalCase: '',
|
||||
// spaceUpperCase: '',
|
||||
// lowerCase: '',
|
||||
// upperCase: '',
|
||||
// },
|
||||
|
@ -120,6 +120,46 @@ export enum SupportCase {
|
||||
*/
|
||||
KEBAB_UPPER_CASE,
|
||||
|
||||
/**
|
||||
* 空格分隔命名
|
||||
* Space Case / Spinal Case
|
||||
* e.g. foo bar
|
||||
*
|
||||
* @alias: spaceCase / SpaceCase / space case / space_case / SPACE_CASE
|
||||
* @since 2024-04-07
|
||||
*/
|
||||
SPACE_CASE,
|
||||
|
||||
/**
|
||||
* 空格分隔 + 小驼峰(驼峰)命名
|
||||
* Space Camel Case
|
||||
* e.g. foo Bar
|
||||
*
|
||||
* @alias: spaceCamelCase / SpaceCamelCase / space camel case / space_camel_case / SPACE_CAMEL_CASE
|
||||
* @since 2024-04-07
|
||||
*/
|
||||
SPACE_CAMEL_CASE,
|
||||
|
||||
/**
|
||||
* 空格分隔 + 大驼峰(帕斯卡)命名
|
||||
* Space Pascal Case
|
||||
* e.g. Foo Bar
|
||||
*
|
||||
* @alias: spacePascalCase / SpacePascalCase / space pascal case / space_pascal_case / SPACE_PASCAL_CASE
|
||||
* @since 2024-04-07
|
||||
*/
|
||||
SPACE_PASCAL_CASE,
|
||||
|
||||
/**
|
||||
* 空格分隔 + 全大写命名
|
||||
* Space Upper Case
|
||||
* e.g. FOO BAR
|
||||
*
|
||||
* @alias: spaceUpperCase / SpaceUpperCase / space upper case / space_upper_case / SPACE_UPPER_CASE
|
||||
* @since 2024-04-07
|
||||
*/
|
||||
SPACE_UPPER_CASE,
|
||||
|
||||
/**
|
||||
* 全小写
|
||||
* Lower Case
|
||||
@ -170,6 +210,13 @@ const keyword = {
|
||||
'LianZiFu', 'JiZhuShi',
|
||||
'lzf', 'jzs',
|
||||
],
|
||||
space: [
|
||||
'空格', // ' ',
|
||||
'Space Case',
|
||||
'sc',
|
||||
'KongGe',
|
||||
'kg',
|
||||
],
|
||||
upper: [
|
||||
'全大写', '大写',
|
||||
'Upper Case',
|
||||
@ -243,13 +290,37 @@ export const qickPickSupportCases = [
|
||||
type: SupportCase.KEBAB_PASCAL_CASE,
|
||||
name: '连字符(脊柱式) + 大驼峰(帕斯卡)命名',
|
||||
shortName: '脊柱帕斯卡',
|
||||
keyword: [...keyword.snake, ...keyword.pascal],
|
||||
keyword: [...keyword.kebab, ...keyword.pascal],
|
||||
},
|
||||
{
|
||||
type: SupportCase.KEBAB_UPPER_CASE,
|
||||
name: '连字符(脊柱式) + 全大写命名',
|
||||
shortName: '脊柱大写',
|
||||
keyword: [...keyword.snake, ...keyword.upper],
|
||||
keyword: [...keyword.kebab, ...keyword.upper],
|
||||
},
|
||||
{
|
||||
type: SupportCase.SPACE_CASE,
|
||||
name: '空格分隔命名',
|
||||
shortName: '脊柱',
|
||||
keyword: [...keyword.space, ...keyword.lower],
|
||||
},
|
||||
{
|
||||
type: SupportCase.SPACE_CAMEL_CASE,
|
||||
name: '空格分隔 + 小驼峰(驼峰)命名',
|
||||
shortName: '脊柱驼峰',
|
||||
keyword: [...keyword.space, ...keyword.camel],
|
||||
},
|
||||
{
|
||||
type: SupportCase.SPACE_PASCAL_CASE,
|
||||
name: '空格分隔 + 大驼峰(帕斯卡)命名',
|
||||
shortName: '脊柱帕斯卡',
|
||||
keyword: [...keyword.space, ...keyword.pascal],
|
||||
},
|
||||
{
|
||||
type: SupportCase.SPACE_UPPER_CASE,
|
||||
name: '空格分隔 + 全大写命名',
|
||||
shortName: '脊柱大写',
|
||||
keyword: [...keyword.space, ...keyword.upper],
|
||||
},
|
||||
{
|
||||
type: SupportCase.LOWER_CASE,
|
||||
|
@ -14,14 +14,22 @@ export type TestCase = {
|
||||
output: {
|
||||
camelCase: string
|
||||
pascalCase: string
|
||||
|
||||
snakeCase: string
|
||||
snakeCamelCase: string
|
||||
snakePascalCase: string
|
||||
snakeUpperCase: string
|
||||
|
||||
kebabCase: string
|
||||
kebabCamelCase: string
|
||||
kebabPascalCase: string
|
||||
kebabUpperCase: string
|
||||
|
||||
spaceCase: string
|
||||
spaceCamelCase: string
|
||||
spacePascalCase: string
|
||||
spaceUpperCase: string
|
||||
|
||||
lowerCase?: string
|
||||
upperCase?: string
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user