Effect CommunityEC
Effect Community3y ago
2 replies
Dimitris

Using `Schema.Trim` and converting to lowercase:

Reading from the Schema docs that..
import * as S from "@effect/schema/Schema";

// $ExpectType Schema<string, string>
const schema = S.Trim;
const parse = S.parseSync(schema);

parse("a"); // "a"
parse(" a"); // "a"
parse("a "); // "a"
parse(" a "); // "a"


Now what If I want to create a pipeline like this, and also trim and make the string lowercase? I see that there are these transformations Schema.Trim & Schema.Lowercase
export const userNameSchema = Schema.string.pipe(
  Schema.minLength(2),
  Schema.maxLength(100)
);
Was this page helpful?