waltronics-types 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Validate.ts +19 -1
- package/package.json +1 -1
package/Validate.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import validator from "validator";
|
|
3
3
|
|
|
4
|
-
export const isName
|
|
4
|
+
export const isName = z.string().trim().min(2, "Must enter a name.").max(50, "Must enter a name less than 50 characters.").regex(/^[A-Za-z\s'-]*$/, "Must enter a name without symbols.").transform(s => {
|
|
5
5
|
return s
|
|
6
6
|
.replace(/\s+/g, ' ')
|
|
7
7
|
.split(/\s/)
|
|
@@ -122,4 +122,22 @@ export const isRepair: z.ZodType = hasLengthAndClean({
|
|
|
122
122
|
min: 1,
|
|
123
123
|
max: 500,
|
|
124
124
|
name: "repair"
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export const isClass: z.ZodType = hasLengthAndClean({
|
|
128
|
+
min: 1,
|
|
129
|
+
max: 500,
|
|
130
|
+
name: "repair"
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export const isDivision: z.ZodType = hasLengthAndClean({
|
|
134
|
+
min: 1,
|
|
135
|
+
max: 50,
|
|
136
|
+
name: "value"
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const isService: z.ZodType = hasLengthAndClean({
|
|
140
|
+
min: 1,
|
|
141
|
+
max: 50,
|
|
142
|
+
name: "value"
|
|
125
143
|
});
|