Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 9x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { camelCase } from './camelCase'
import { upperFirst } from './upperFirst'
/**
* format string to pascal case
*
* @param text text to format
* @returns pascal case string
*/
export function pascalCase(text: string) {
return upperFirst(camelCase(text))
}
Eif (import.meta.vitest) {
const { test, expect } = import.meta.vitest
test('pascalCase', () => {
expect(pascalCase('useXx')).toBe('UseXx')
expect(pascalCase('usexx')).toBe('Usexx')
expect(pascalCase('use-xx')).toBe('UseXx')
expect(pascalCase('use xx')).toBe('UseXx')
expect(pascalCase('UseXx')).toBe('UseXx')
expect(pascalCase('use_xx')).toBe('UseXx')
expect(pascalCase('Use Xx')).toBe('UseXx')
expect(pascalCase('Use-Xx')).toBe('UseXx')
expect(pascalCase('USE XX')).toBe('UseXx')
})
}
|