7
8
export function buildReplaceStringWithCasePreserved(matches: string[] | null, pattern: string): string {
9
>
if (matches && (matches[0] !== '')) {
search.ts
10
>
const containsHyphens = validateSpecificSpecialCharacter(matches, pattern, '-');
11
>
const containsUnderscores = validateSpecificSpecialCharacter(matches, pattern, '_');
12
>
if (containsHyphens && !containsUnderscores) {
13
>
return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '-');
14
>
} else if (!containsHyphens && containsUnderscores) {
15
>
return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '_');
16
>
}
17
>
if (matches[0].toUpperCase() === matches[0]) {
18
>
return pattern.toUpperCase();
19
>
} else if (matches[0].toLowerCase() === matches[0]) {
20
return pattern.toLowerCase();
21
>
} else if (strings.containsUppercaseCharacter(matches[0][0]) && pattern.length > 0) {
search.ts
22
>
return pattern[0].toUpperCase() + pattern.substr(1);
23
>
} else if (matches[0][0].toUpperCase() !== matches[0][0] && pattern.length > 0) {
24
return pattern[0].toLowerCase() + pattern.substr(1);
25
} else {