@ptolemy2002/regex-utils 2.6.1 → 3.0.0

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/README.md CHANGED
@@ -151,6 +151,16 @@ Checks if a string is a valid set of regular expression flags.
151
151
  #### Returns
152
152
  `boolean` - `true` if the string is a valid set of regular expression flags, `false` otherwise.
153
153
 
154
+ ### isZodError
155
+ #### Description
156
+ Checks if an unknown value is a ZodError. This is more reliable than using `instanceof` as it also checks for the name property. This is particularly important in projects with multiple versions of zod, where instanceof checks may fail due to different constructor references.
157
+
158
+ #### Parameters
159
+ - `err` (`unknown`): The value to be checked.
160
+
161
+ #### Returns
162
+ `boolean` - `true` if the value is a ZodError, `false` otherwise.
163
+
154
164
  ### interpretZodError
155
165
  #### Description
156
166
  Given a zod error, interprets it to `null` if no error is found, a single error message if there is a single error, or an array of error messages if there are multiple errors. The error messages will be in the format `<path>: <message>`. If the error is with function arguments, "arguments.<index>" will be appended to the end of the path. Similarly, if the error is with a function return value, "returnValue" will be appended to the end of the path. Note that for function arguments, only the first seen error will be reported.
package/dist/index.d.ts CHANGED
@@ -46,5 +46,31 @@ export declare function isValidEmail(v: string): boolean;
46
46
  export declare function isValidURL(v: string): boolean;
47
47
  export declare function isValidPhoneNumber(v: string): boolean;
48
48
  export declare function isValidSSN(v: string): boolean;
49
- export declare const ZodCoercedBooleanEnum: z.ZodEnum<["true", "false", "t", "f", "yes", "no", "y", "n", "1", "0", "on", "off"]>;
50
- export declare const ZodCoercedBoolean: z.ZodEffects<z.ZodEnum<["true", "false", "t", "f", "yes", "no", "y", "n", "1", "0", "on", "off"]>, boolean, "0" | "1" | "true" | "false" | "t" | "f" | "yes" | "no" | "y" | "n" | "on" | "off">;
49
+ export declare const ZodCoercedBooleanEnum: z.ZodEnum<{
50
+ 0: "0";
51
+ 1: "1";
52
+ true: "true";
53
+ false: "false";
54
+ t: "t";
55
+ f: "f";
56
+ yes: "yes";
57
+ no: "no";
58
+ y: "y";
59
+ n: "n";
60
+ on: "on";
61
+ off: "off";
62
+ }>;
63
+ export declare const ZodCoercedBoolean: z.ZodPipe<z.ZodEnum<{
64
+ 0: "0";
65
+ 1: "1";
66
+ true: "true";
67
+ false: "false";
68
+ t: "t";
69
+ f: "f";
70
+ yes: "yes";
71
+ no: "no";
72
+ y: "y";
73
+ n: "n";
74
+ on: "on";
75
+ off: "off";
76
+ }>, z.ZodTransform<boolean, "0" | "1" | "true" | "false" | "t" | "f" | "yes" | "no" | "y" | "n" | "on" | "off">>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/regex-utils",
3
- "version": "2.6.1",
3
+ "version": "3.0.0",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,9 +27,9 @@
27
27
  "release-major": "bash ./scripts/release.sh major"
28
28
  },
29
29
  "peerDependencies": {
30
- "zod": "^3.23.8"
30
+ "zod": "^4.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "zod": "^3.23.8"
33
+ "zod": "^4.0.0"
34
34
  }
35
35
  }