Runtime implementation of the Capitalize helper type.
capitalize()
import { assert, Equals } from"tsafe";import { capitalize } from"tsafe/capitalize";conststr="foo";constcapitalizedStr=capitalize(str);assert<Equals<typeof capitalizedStr,"Foo">>();assert(capitalizedStr ==="Foo");//NOTE: There is a 'Capitalize' builtin type in TypeScript such that:assert<Equals<Capitalize<"foo">,"Foo">>();
uncapitalize()
import { assert, Equals } from"tsafe";import { uncapitalize } from"tsafe/uncapitalize";constcapitalizedStr="Foo";conststr=uncapitalize(capitalizedStr);assert<Equals<typeof str,"foo">>();assert(str ==="foo");//NOTE: There is a 'Uncapitalize' builtin type in TypeScript such that:assert<Equals<Uncapitalize<"Foo">,"foo">>();