API reference / @evolu/common / Type / SimplePassword
Variable: SimplePassword
const SimplePassword: BrandType<
BrandType<
Type<
"Brand",
string & Brand<"Trimmed"> & Brand<"MaxLength64">,
string,
MaxLengthError<64>,
string & Brand<"Trimmed">,
StringError | TrimmedError
>,
"MinLength8",
MinLengthError<8>,
StringError | TrimmedError | MaxLengthError<64>
>,
"SimplePassword",
BrandWithoutRefineError<
"SimplePassword",
StringError | TrimmedError | MinLengthError<8> | MaxLengthError<64>
>,
never
>;
Defined in: packages/common/src/Type.ts:1575
Trimmed string between 8 and 64 characters, branded as SimplePassword.
Take a look how SimplePassword is defined:
export const SimplePassword = brand(
"SimplePassword",
minLength(8)(maxLength(64)(TrimmedString)),
);
Nested functions are often OK (if not, make a helper), but with TC39 Hack pipes it would be clearer:
// TrimmedString
// |> minLength(8)(%)
// |> maxLength(64)(%)
// |> brand("SimplePassword", %)