use-zod-default 1.0.22 → 1.0.23

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/dist/v3.js CHANGED
@@ -190,10 +190,16 @@ const defaultInstance = (schema, source = {}) => {
190
190
  // Process defined schema properties
191
191
  for (const [key, fieldSchema] of Object.entries(shape)) {
192
192
  if (key in source) {
193
- result[key] = processValue(fieldSchema, source[key]);
193
+ const v = processValue(fieldSchema, source[key]);
194
+ if (v !== undefined) {
195
+ result[key] = v;
196
+ }
194
197
  }
195
198
  else {
196
- result[key] = getDefaultValue(fieldSchema);
199
+ const v = getDefaultValue(fieldSchema);
200
+ if (v !== undefined) {
201
+ result[key] = v;
202
+ }
197
203
  }
198
204
  }
199
205
  // Handle passthrough - preserve additional properties not in schema
package/dist/v4.js CHANGED
@@ -273,10 +273,16 @@ const defaultInstance = (schema, source) => {
273
273
  // Create a proper ZodType from the field schema
274
274
  const zodFieldSchema = cast(fieldSchema);
275
275
  if (source && key in source) {
276
- result[key] = processValue(zodFieldSchema, source[key]);
276
+ const v = processValue(zodFieldSchema, source[key]);
277
+ if (v !== undefined) {
278
+ result[key] = v;
279
+ }
277
280
  }
278
281
  else {
279
- result[key] = getDefaultValue(zodFieldSchema);
282
+ const v = getDefaultValue(zodFieldSchema);
283
+ if (v !== undefined) {
284
+ result[key] = v;
285
+ }
280
286
  }
281
287
  }
282
288
  // Handle catchall - preserve additional properties not in schema
package/package.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "test:watch": "vitest",
40
40
  "test:coverage": "rm -rf coverage && vitest --run --coverage"
41
41
  },
42
- "version": "1.0.22"
42
+ "version": "1.0.23"
43
43
  }