API reference / @evolu/common / Type / TrimString

Variable: TrimString

const TrimString: TransformType<
  Type<"String", string, string, StringError, string, StringError>,
  BrandType<
    Type<"String", string, string, StringError, string, StringError>,
    "Trimmed",
    never,
    StringError
  >,
  never
>;

Defined in: packages/common/src/Type.ts:1992

Trims leading and trailing whitespace from a string.

Example

expect(TrimString.from("a ")).toEqual(ok("a"));
expect(TrimString.fromParent("a ").value).toEqual("a");

Was this page helpful?