zod-form-data
Advanced tools
Comparing version 1.2.4 to 1.2.5-beta.0
import { z, ZodArray, ZodEffects, ZodNumber, ZodObject, ZodString, ZodTypeAny } from "zod"; | ||
declare type InputType<DefaultType extends ZodTypeAny> = { | ||
(): ZodEffects<DefaultType>; | ||
<ProvidedType extends ZodTypeAny>(schema: ProvidedType): ZodEffects<ProvidedType>; | ||
type InputType<DefaultType extends ZodTypeAny> = { | ||
(): ZodEffects<DefaultType, DefaultType["_output"], unknown>; | ||
<ProvidedType extends ZodTypeAny>(schema: ProvidedType): ZodEffects<ProvidedType, ProvidedType["_output"], unknown>; | ||
}; | ||
@@ -21,3 +21,3 @@ /** | ||
export declare const numeric: InputType<ZodNumber>; | ||
declare type CheckboxOpts = { | ||
type CheckboxOpts = { | ||
trueValue?: string; | ||
@@ -55,6 +55,6 @@ }; | ||
*/ | ||
export declare const repeatableOfType: <T extends z.ZodTypeAny>(schema: T) => z.ZodEffects<z.ZodArray<T, "many">, T["_output"][], T["_input"][]>; | ||
declare type FormDataType = { | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects<ZodObject<T>>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T>; | ||
export declare const repeatableOfType: <T extends z.ZodTypeAny>(schema: T) => z.ZodEffects<z.ZodArray<T, "many">, T["_output"], unknown>; | ||
type FormDataType = { | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects<ZodObject<T>, ZodObject<T>["_output"], unknown>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T, T["_output"], unknown>; | ||
}; | ||
@@ -61,0 +61,0 @@ export declare const json: <T extends z.ZodTypeAny>(schema: T) => z.ZodEffects<T, T["_output"], T["_input"]>; |
@@ -1,2 +0,2 @@ | ||
import { setPath } from "setGet"; | ||
import { setPath } from "set-get"; | ||
import { z, ZodType, } from "zod"; | ||
@@ -3,0 +3,0 @@ const stripEmpty = z.literal("").transform(() => undefined); |
{ | ||
"name": "zod-form-data", | ||
"version": "1.2.4", | ||
"browser": "./dist/zod-form-data.cjs.js", | ||
"main": "./dist/zod-form-data.umd.js", | ||
"module": "./dist/zod-form-data.es.js", | ||
"types": "./dist/types/index.d.ts", | ||
"version": "1.2.5-beta.0", | ||
"main": "./dist/index.cjs.js", | ||
"module": "./dist/index.esm.js", | ||
"types": "./dist/index.d.ts", | ||
"license": "MIT", | ||
@@ -14,5 +13,6 @@ "repository": { | ||
"scripts": { | ||
"dev": "tsc --module ESNext --outDir ./browser --watch", | ||
"build": "vite build", | ||
"prepublishOnly": "npm run build" | ||
"dev": "tsup --watch", | ||
"build": "tsup", | ||
"prepublishOnly": "npm run build", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
@@ -25,2 +25,3 @@ "peerDependencies": { | ||
"tsconfig": "*", | ||
"tsup-config": "*", | ||
"typescript": "^4.8.4", | ||
@@ -27,0 +28,0 @@ "zod": "^3.11.6" |
@@ -5,3 +5,3 @@ # zod-form-data | ||
specifically for parsing `FormData` or `URLSearchParams`. | ||
This is particularly useful when using [remix](https://github.com/remix-run/remix) | ||
This is particularly useful when using [Remix](https://github.com/remix-run/remix) | ||
and combos well with [remix-validated-form](https://github.com/airjp73/remix-validated-form). | ||
@@ -24,3 +24,3 @@ | ||
// This example is using `remix`, but it will work | ||
// This example is using Remix, but it will work | ||
// with any `FormData` or `URLSearchParams` no matter where you get it from. | ||
@@ -27,0 +27,0 @@ export const action = async ({ request }) => { |
@@ -14,6 +14,8 @@ import { setPath } from "set-get"; | ||
type InputType<DefaultType extends ZodTypeAny> = { | ||
(): ZodEffects<DefaultType>; | ||
<ProvidedType extends ZodTypeAny>( | ||
schema: ProvidedType | ||
): ZodEffects<ProvidedType>; | ||
(): ZodEffects<DefaultType, DefaultType["_output"], unknown>; | ||
<ProvidedType extends ZodTypeAny>(schema: ProvidedType): ZodEffects< | ||
ProvidedType, | ||
ProvidedType["_output"], | ||
unknown | ||
>; | ||
}; | ||
@@ -114,3 +116,4 @@ | ||
schema: T | ||
): ZodEffects<ZodArray<T>> => repeatable(z.array(schema)); | ||
): ZodEffects<ZodArray<T>, T["_output"], unknown> => | ||
repeatable(z.array(schema)); | ||
@@ -120,4 +123,8 @@ const entries = z.array(z.tuple([z.string(), z.any()])); | ||
type FormDataType = { | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects<ZodObject<T>>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T>; | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects< | ||
ZodObject<T>, | ||
ZodObject<T>["_output"], | ||
unknown | ||
>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T, T["_output"], unknown>; | ||
}; | ||
@@ -124,0 +131,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
308046
1714
2
5
22
2