ant-design/components/_util/capitalize.ts
vagusX 11ffb1ba6f
refactor: cssinjs for tag (#34422)
* feat: basic implements

* feat: add rtl

* feat: reorganize types

* test: add test cases for capitalize

* test: improve coverage

* chore: improve types

* chore: update

* chore: update
2022-03-15 15:33:50 +08:00

9 lines
223 B
TypeScript

export default function capitalize<T extends string>(str: T): Capitalize<T> {
if (typeof str !== 'string') {
return str;
}
const ret = str.charAt(0).toUpperCase() + str.slice(1);
return ret as Capitalize<T>;
}