API reference › @evolu/common › Type › capitalize
function capitalize<S>(value: S): Capitalize<S>;
Defined in: packages/common/src/Type.ts:6184
Uppercases the first Unicode code point and returns a CapitalizedString.
Preserves the remainder of the string and leaves an empty string unchanged. Uses JavaScript's default Unicode casing without locale-specific rules. Changing case can change the length, so input brands are not retained.
Example
import { assertEqual, assertType, capitalize } from "@evolu/common";
const text = capitalize("hello world");
assertEqual(text, "Hello world");
assertType<typeof text, "Hello world">();
assertEqual(capitalize(text), text);