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 | 14x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { splitByCase } from './splitByCase'
/**
* format string to upper case
*
*
* @param text
* @returns upper case string
*
* {@link https://lodash.com/docs#upperCase}
*/
export function upperCase(text: string) {
return splitByCase(text).map(word => word.toUpperCase()).join(' ')
}
Eif (import.meta.vitest) {
const { test, expect } = import.meta.vitest
test('upperCase', () => {
expect(upperCase('useXx')).toBe('USE XX')
expect(upperCase('use-xx')).toBe('USE XX')
expect(upperCase('use xx')).toBe('USE XX')
expect(upperCase('UseXx')).toBe('USE XX')
expect(upperCase('use_xx')).toBe('USE XX')
expect(upperCase('Use Xx')).toBe('USE XX')
expect(upperCase('USE XX')).toBe('USE XX')
})
}
|