API reference › @evolu/common › Leancase › leancased
const leancased: BrandFactory<"Leancased", string, LeancasedError>;
Defined in: packages/common/src/Leancase.ts:85
Experimental
Adds leancase validation to an existing string Type.
A string is valid when leancase leaves it unchanged. Validation does not modify the value.
Example
import {
assertErr,
assertOk,
leancased,
maxLength,
String,
} from "@evolu/common";
const Post = leancased(maxLength(280)(String));
assertOk(Post.fromUnknown("hello. world"), "hello. world");
assertErr(Post.fromUnknown("Hello. World."));