@@ -19,57 +19,3 @@ export const flexibleBoolean = z.preprocess((val) => {
19
19
}
20
20
return val ;
21
21
} , z . boolean ( ) ) ;
22
-
23
-
24
- export const numericStringSchemaNullable = z . coerce . string ( ) . or ( z . number ( ) ) . transform ( ( val , ctx ) => {
25
- const strValue = String ( val ) ;
26
- const trimmedStrValue = strValue . trim ( ) ;
27
-
28
- if ( trimmedStrValue === '' ) {
29
- ctx . addIssue ( {
30
- code : z . ZodIssueCode . custom ,
31
- message : `Expected a numeric string or number, but received an empty string or string with only whitespace.` ,
32
- } ) ;
33
- return z . NEVER ;
34
- }
35
- if ( trimmedStrValue . toLowerCase ( ) === 'null' ) {
36
- return null ;
37
- }
38
- if ( isNaN ( Number ( trimmedStrValue ) ) ) {
39
- ctx . addIssue ( {
40
- code : z . ZodIssueCode . custom ,
41
- message : `Expected a numeric string or number, but received ${ trimmedStrValue } ` ,
42
- } ) ;
43
- return z . NEVER ;
44
- }
45
- return String ( trimmedStrValue ) ;
46
- } ) . nullable ( ) ;
47
-
48
-
49
- export const numericStringSchema = z . coerce . string ( ) . transform ( ( val , ctx ) => {
50
- const strValue = String ( val ) ;
51
- const trimmedStrValue = strValue . trim ( ) ;
52
-
53
- if ( trimmedStrValue === '' ) {
54
- ctx . addIssue ( {
55
- code : z . ZodIssueCode . custom ,
56
- message : `Expected a numeric string or number, but received an empty string or string with only whitespace.` ,
57
- } ) ;
58
- return z . NEVER ;
59
- }
60
- if ( trimmedStrValue . toLowerCase ( ) === 'null' ) {
61
- ctx . addIssue ( {
62
- code : z . ZodIssueCode . custom ,
63
- message : `Expected a numeric string or number, but received an null as string` ,
64
- } ) ;
65
- return z . NEVER ;
66
- }
67
- if ( isNaN ( Number ( trimmedStrValue ) ) ) {
68
- ctx . addIssue ( {
69
- code : z . ZodIssueCode . custom ,
70
- message : `Expected a numeric string or number, but received ${ trimmedStrValue } ` ,
71
- } ) ;
72
- return z . NEVER ;
73
- }
74
- return String ( trimmedStrValue ) ;
75
- } ) ;
0 commit comments