@ptolemy2002/regex-utils 4.1.0 → 4.2.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 +9 -2
- package/dist/index.d.ts +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,14 @@ type ZodValidateWithErrorsOptions = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
type ArrayWithOptional<AR extends unknown[], AO extends unknown[]> = AR | [...AR, ...AO];
|
|
38
|
-
type ZodGenericFactory<ZTA extends Array<ZodType<unknown
|
|
38
|
+
type ZodGenericFactory<ZTA extends Array<ZodType<unknown>>=[ZodType], ZT extends ZodType=ZodType> =
|
|
39
|
+
<ZTAO extends ZTA>(...genericArgs: ZTAO) => (
|
|
40
|
+
<ZTO extends ZT>(
|
|
41
|
+
fn: (...args: ZTAO) => ZTO
|
|
42
|
+
) => ZTO
|
|
43
|
+
)
|
|
44
|
+
;
|
|
45
|
+
type MaybeZodOptional<ZT extends ZodType> = ZT | ZodOptional<ZT>;
|
|
39
46
|
```
|
|
40
47
|
|
|
41
48
|
## Classes
|
|
@@ -262,7 +269,7 @@ Uses `zodValidate` to check if a string is a valid Social Security Number (SSN).
|
|
|
262
269
|
#### Returns
|
|
263
270
|
`boolean` - `true` if the string is a valid SSN, `false` otherwise.
|
|
264
271
|
|
|
265
|
-
### zodGenericFactory<ZTA extends Array<ZodType<unknown
|
|
272
|
+
### zodGenericFactory<ZTA extends Array<ZodType<unknown>=[ZodType]>, ZT extends ZodType=ZodType>
|
|
266
273
|
|
|
267
274
|
#### Description
|
|
268
275
|
Creates a factory for building generic Zod schemas with reusable type parameters. This is useful when you want to create schema templates where certain types (like ID or name fields) can be customized while maintaining type safety.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z, ZodError, ZodType } from "zod";
|
|
1
|
+
import { z, ZodError, ZodOptional, ZodType } from "zod";
|
|
2
2
|
export type RegexInput = string | RegExp;
|
|
3
3
|
export declare function combineFlags(...flags: string[]): string;
|
|
4
4
|
export declare function escapeRegex(value: RegexInput, flags?: string): RegExp;
|
|
@@ -75,5 +75,6 @@ export declare const ZodCoercedBoolean: z.ZodPipe<z.ZodEnum<{
|
|
|
75
75
|
off: "off";
|
|
76
76
|
}>, z.ZodTransform<boolean, "0" | "1" | "true" | "false" | "t" | "f" | "yes" | "no" | "y" | "n" | "on" | "off">>;
|
|
77
77
|
export type ArrayWithOptional<AR extends unknown[], AO extends unknown[]> = AR | [...AR, ...AO];
|
|
78
|
-
export type ZodGenericFactory<ZTA extends Array<ZodType<unknown
|
|
79
|
-
export declare function zodGenericFactory<ZTA extends Array<ZodType
|
|
78
|
+
export type ZodGenericFactory<ZTA extends Array<ZodType<unknown>> = [ZodType], ZT extends ZodType = ZodType> = <ZTAO extends ZTA>(...genericArgs: ZTAO) => (<ZTO extends ZT>(fn: (...args: ZTAO) => ZTO) => ZTO);
|
|
79
|
+
export declare function zodGenericFactory<ZTA extends Array<ZodType> = [ZodType], ZT extends ZodType = ZodType>(): ZodGenericFactory<ZTA, ZT>;
|
|
80
|
+
export type MaybeZodOptional<ZT extends ZodType> = ZT | ZodOptional<ZT>;
|