mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-09 23:55:01 -04:00
refactor(case converter): using nocase to convert to upper and lower case
This commit is contained in:
parent
8485a0842f
commit
325f27b547
1 changed files with 6 additions and 3 deletions
|
@ -19,7 +19,10 @@ const baseConfig = {
|
|||
};
|
||||
|
||||
const input = ref('lorem ipsum dolor sit amet');
|
||||
const strippedInput = computed(() => input.value.split(' ').map(x => x.replace(baseConfig.stripRegexp, '')).join(' '));
|
||||
|
||||
// Using noCase to convert to lowercase and uppercase to ensure consistent splitting
|
||||
const toLowerCase = (str: string) => noCase(str, baseConfig).toLocaleLowerCase();
|
||||
const toUpperCase = (str: string) => noCase(str, baseConfig).toLocaleUpperCase();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -33,10 +36,10 @@ const strippedInput = computed(() => input.value.split(' ').map(x => x.replace(b
|
|||
<n-divider />
|
||||
|
||||
<n-form-item label="Lowercase:">
|
||||
<InputCopyable :value="strippedInput.toLowerCase()" />
|
||||
<InputCopyable :value="toLowerCase(input)" />
|
||||
</n-form-item>
|
||||
<n-form-item label="Uppercase:">
|
||||
<InputCopyable :value="strippedInput.toUpperCase()" />
|
||||
<InputCopyable :value="toUpperCase(input)" />
|
||||
</n-form-item>
|
||||
<n-form-item label="Camelcase:">
|
||||
<InputCopyable :value="camelCase(input, baseConfig)" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue