refactor(case converter): no split on lowercase, uppercase and mocking case (#748)

This commit is contained in:
Corentin THOMASSET 2023-11-13 01:00:55 +01:00 committed by GitHub
parent 7fe47b3be4
commit ca43a25569
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,11 +23,11 @@ const input = ref('lorem ipsum dolor sit amet');
const formats = computed(() => [ const formats = computed(() => [
{ {
label: 'Lowercase:', label: 'Lowercase:',
value: noCase(input.value, baseConfig).toLocaleLowerCase(), value: input.value.toLocaleLowerCase(),
}, },
{ {
label: 'Uppercase:', label: 'Uppercase:',
value: noCase(input.value, baseConfig).toLocaleUpperCase(), value: input.value.toLocaleUpperCase(),
}, },
{ {
label: 'Camelcase:', label: 'Camelcase:',
@ -75,7 +75,7 @@ const formats = computed(() => [
}, },
{ {
label: 'Mockingcase:', label: 'Mockingcase:',
value: noCase(input.value, baseConfig) value: input.value
.split('') .split('')
.map((char, index) => (index % 2 === 0 ? char.toUpperCase() : char.toLowerCase())) .map((char, index) => (index % 2 === 0 ? char.toUpperCase() : char.toLowerCase()))
.join(''), .join(''),