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 30 | 88x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /**
* format text with the first character to upper case
*
* @param text text to format
* @returns text with the first character to upper case
*
* {@link https://lodash.com/docs#upperFirst}
*/
export function upperFirst(text: string) {
return text
.trim()
.charAt(0)
.toUpperCase()
+ text.slice(1)
}
if (import.meta.vitest) {
const { test, expect } = import.meta.vitest
test('upperFirst', () => {
expect(upperFirst('useXx')).toBe('UseXx')
expect(upperFirst('use-xx')).toBe('Use-xx')
expect(upperFirst('use xx')).toBe('Use xx')
expect(upperFirst('UseXx')).toBe('UseXx')
expect(upperFirst('use_xx')).toBe('Use_xx')
expect(upperFirst('Use Xx')).toBe('Use Xx')
expect(upperFirst('USE XX')).toBe('USE XX')
})
}
|