Skip to content

Commit 0c6cbbd

Browse files
committedDec 10, 2024
Undeprecate .nonempty()
1 parent b333f96 commit 0c6cbbd

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed
 

‎deno/lib/__tests__/string.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as z from "../index.ts";
88
const minFive = z.string().min(5, "min5");
99
const maxFive = z.string().max(5, "max5");
1010
const justFive = z.string().length(5);
11-
const nonempty = z.string().min(1, "nonempty");
11+
const nonempty = z.string().nonempty("nonempty");
1212
const includes = z.string().includes("includes");
1313
const includesFromIndex2 = z.string().includes("includes", { position: 2 });
1414
const startsWith = z.string().startsWith("startsWith");

‎deno/lib/types.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,10 @@ export class ZodString extends ZodType<string, ZodStringDef, string> {
11331133
}
11341134
base64url(message?: errorUtil.ErrMessage) {
11351135
// base64url encoding is a modification of base64 that can safely be used in URLs and filenames
1136-
return this._addCheck({ kind: "base64url", ...errorUtil.errToObj(message) });
1136+
return this._addCheck({
1137+
kind: "base64url",
1138+
...errorUtil.errToObj(message),
1139+
});
11371140
}
11381141

11391142
jwt(options?: { alg?: string; message?: string }) {
@@ -1267,8 +1270,7 @@ export class ZodString extends ZodType<string, ZodStringDef, string> {
12671270
}
12681271

12691272
/**
1270-
* @deprecated Use z.string().min(1) instead.
1271-
* @see {@link ZodString.min}
1273+
* Equivalent to `.min(1)`
12721274
*/
12731275
nonempty(message?: errorUtil.ErrMessage) {
12741276
return this.min(1, errorUtil.errToObj(message));

‎src/__tests__/string.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as z from "../index";
77
const minFive = z.string().min(5, "min5");
88
const maxFive = z.string().max(5, "max5");
99
const justFive = z.string().length(5);
10-
const nonempty = z.string().min(1, "nonempty");
10+
const nonempty = z.string().nonempty("nonempty");
1111
const includes = z.string().includes("includes");
1212
const includesFromIndex2 = z.string().includes("includes", { position: 2 });
1313
const startsWith = z.string().startsWith("startsWith");

‎src/types.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,10 @@ export class ZodString extends ZodType<string, ZodStringDef, string> {
11331133
}
11341134
base64url(message?: errorUtil.ErrMessage) {
11351135
// base64url encoding is a modification of base64 that can safely be used in URLs and filenames
1136-
return this._addCheck({ kind: "base64url", ...errorUtil.errToObj(message) });
1136+
return this._addCheck({
1137+
kind: "base64url",
1138+
...errorUtil.errToObj(message),
1139+
});
11371140
}
11381141

11391142
jwt(options?: { alg?: string; message?: string }) {
@@ -1267,8 +1270,7 @@ export class ZodString extends ZodType<string, ZodStringDef, string> {
12671270
}
12681271

12691272
/**
1270-
* @deprecated Use z.string().min(1) instead.
1271-
* @see {@link ZodString.min}
1273+
* Equivalent to `.min(1)`
12721274
*/
12731275
nonempty(message?: errorUtil.ErrMessage) {
12741276
return this.min(1, errorUtil.errToObj(message));

0 commit comments

Comments
 (0)
Please sign in to comment.