Socket
Socket
Sign inDemoInstall

@conform-to/zod

Package Overview
Dependencies
2
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0-pre.3 to 0.4.0

6

_virtual/_rollupPluginBabelHelpers.js

@@ -7,3 +7,2 @@ 'use strict';

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -15,6 +14,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -29,6 +26,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function _defineProperty(obj, key, value) {

@@ -45,3 +40,2 @@ if (key in obj) {

}
return obj;

@@ -48,0 +42,0 @@ }

24

index.js

@@ -38,9 +38,6 @@ 'use strict';

}
return null;
}
function inferConstraint(schema) {
var constraint = {};
if (schema instanceof z__namespace.ZodEffects) {

@@ -67,5 +64,3 @@ constraint = _rollupPluginBabelHelpers.objectSpread2({}, inferConstraint(schema.innerType()));

}
break;
case 'max':

@@ -75,5 +70,3 @@ if (!constraint.maxLength || constraint.maxLength > check.value) {

}
break;
case 'regex':

@@ -83,3 +76,2 @@ if (!constraint.pattern) {

}
break;

@@ -95,5 +87,3 @@ }

}
break;
case 'max':

@@ -103,3 +93,2 @@ if (!constraint.max || constraint.max > _check.value) {

}
break;

@@ -109,16 +98,13 @@ }

} else if (schema instanceof z__namespace.ZodEnum) {
constraint.pattern = schema.options.map(option => // To escape unsafe characters on regex
constraint.pattern = schema.options.map(option =>
// To escape unsafe characters on regex
option.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')).join('|');
}
if (typeof constraint.required === 'undefined') {
constraint.required = true;
}
return constraint;
}
var shape = getSchemaShape(source);
var result = {};
if (shape) {

@@ -130,3 +116,2 @@ for (var [key, def] of Object.entries(shape)) {

}
return result;

@@ -136,3 +121,2 @@ }

var fallbackMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Oops! Something went wrong.';
if (error instanceof z__namespace.ZodError) {

@@ -148,3 +132,2 @@ return error.errors.reduce((result, e) => {

var submission = dom.parse(formData);
try {

@@ -155,3 +138,2 @@ schema.parse(submission.value);

}
return submission;

@@ -164,7 +146,5 @@ }

}
if (value === '') {
return undefined;
}
return fn(value);

@@ -171,0 +151,0 @@ };

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -10,6 +9,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -24,6 +21,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function _defineProperty(obj, key, value) {

@@ -40,3 +35,2 @@ if (key in obj) {

}
return obj;

@@ -43,0 +37,0 @@ }

@@ -14,9 +14,6 @@ import { objectSpread2 as _objectSpread2 } from './_virtual/_rollupPluginBabelHelpers.js';

}
return null;
}
function inferConstraint(schema) {
var constraint = {};
if (schema instanceof z.ZodEffects) {

@@ -43,5 +40,3 @@ constraint = _objectSpread2({}, inferConstraint(schema.innerType()));

}
break;
case 'max':

@@ -51,5 +46,3 @@ if (!constraint.maxLength || constraint.maxLength > check.value) {

}
break;
case 'regex':

@@ -59,3 +52,2 @@ if (!constraint.pattern) {

}
break;

@@ -71,5 +63,3 @@ }

}
break;
case 'max':

@@ -79,3 +69,2 @@ if (!constraint.max || constraint.max > _check.value) {

}
break;

@@ -85,16 +74,13 @@ }

} else if (schema instanceof z.ZodEnum) {
constraint.pattern = schema.options.map(option => // To escape unsafe characters on regex
constraint.pattern = schema.options.map(option =>
// To escape unsafe characters on regex
option.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')).join('|');
}
if (typeof constraint.required === 'undefined') {
constraint.required = true;
}
return constraint;
}
var shape = getSchemaShape(source);
var result = {};
if (shape) {

@@ -106,3 +92,2 @@ for (var [key, def] of Object.entries(shape)) {

}
return result;

@@ -112,3 +97,2 @@ }

var fallbackMessage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Oops! Something went wrong.';
if (error instanceof z.ZodError) {

@@ -124,3 +108,2 @@ return error.errors.reduce((result, e) => {

var submission = parse(formData);
try {

@@ -131,3 +114,2 @@ schema.parse(submission.value);

}
return submission;

@@ -140,7 +122,5 @@ }

}
if (value === '') {
return undefined;
}
return fn(value);

@@ -147,0 +127,0 @@ };

4

package.json

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "0.4.0-pre.3",
"version": "0.4.0",
"main": "index.js",

@@ -18,3 +18,3 @@ "module": "module/index.js",

"peerDependencies": {
"@conform-to/dom": "0.4.0-pre.3",
"@conform-to/dom": "0.4.0",
"zod": "^3.0.0"

@@ -21,0 +21,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc