API Reference / @evolu/common / Type / trimmed
Variable: trimmed
const trimmed: BrandFactory<"Trimmed", string, TrimmedError>;
Defined in: packages/common/src/Type.ts:941
Trimmed string.
This Type Factory does not transform; it only validates whether a string has no leading or trailing whitespaces. To trim a string, use trim Type Factory.
Examples
// this Type already exists
const TrimmedString = trimmed(String);
type TrimmedString = typeof TrimmedString.Type;
// we can make any branded Type trimmed:
const TrimmedNonEmptyString = trimmed(minLength(1)(String));
// string & Brand<"MinLength1"> & Brand<"Trimmed">
type TrimmedNonEmptyString = typeof TrimmedNonEmptyString.Type;