Skip to content

Commit e84fa29

Browse files
committed
update post
1 parent 49c02fd commit e84fa29

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

content/posts/프로젝트/당근마켓 클론코딩/당근마켓 클론코딩으로 Zod 배우기.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tags:
55
- study
66
- zod
77
createdAt: 2025-06-30 21:21:49
8-
modifiedAt: 2025-07-02 18:55:04
8+
modifiedAt: 2025-07-02 21:15:26
99
publish: 프로젝트/당근마켓 클론코딩
1010
related:
1111
- "[[당근마켓 클론코딩]]"
@@ -386,3 +386,22 @@ const formSchema = z.object({
386386

387387
- `toLowerCase`메소드: 입력받은 데이터를 소문자로 변환
388388
- `trim`메소드: 입력받은 데이터의 시작과 끝의 빈 문자열을 삭제해줌
389+
390+
#### transform 메소드
391+
392+
refine과 마찬가지로 함수를 변수로받아 유효성 검사 뒤에 데이터를 변환한다.
393+
394+
```typescript
395+
const formSchema = z.object({
396+
username: z
397+
.string()
398+
.min(3)
399+
.max(10)
400+
.trim()
401+
.toLowerCase()
402+
.transform((username) => `안녕 ${username}`),
403+
email: z.string().email(),
404+
password: z.string().min(10),
405+
confirmPassword: z.string().min(10),
406+
});
407+
```

public/meta-data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@
579579
"tags": ["project", "carrot-market", "study", "zod"],
580580
"series": "",
581581
"createdAt": "2025-06-30 21:21:49",
582-
"modifiedAt": "2025-07-02 18:55:04",
582+
"modifiedAt": "2025-07-02 21:15:26",
583583
"publish": "프로젝트/당근마켓 클론코딩"
584584
},
585585
{

0 commit comments

Comments
 (0)