Skip to content

Commit ba2eb09

Browse files
committed
add name like string schema
1 parent 93a67ba commit ba2eb09

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/schemas/common.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { z } from "zod";
2+
3+
export const stringSchema = z.string();
4+
5+
export const nameLikeStringSchema = z
6+
.string()
7+
.min(3)
8+
.max(32)
9+
.regex(/^[a-zA-Z0-9_]{3,32}$/, {
10+
message: "Name must contain only letters, numbers and _",
11+
});

0 commit comments

Comments
 (0)