Socket
Socket
Sign inDemoInstall

zod

Package Overview
Dependencies
0
Maintainers
1
Versions
360
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.6.1

13

lib/src/parser.js

@@ -163,2 +163,4 @@ "use strict";

var isValid = false;
var unionErrors = [];
// unionError.addError('union', 'Error parsing union type.');
for (var _i = 0, _a = def.options; _i < _a.length; _i++) {

@@ -171,2 +173,3 @@ var option = _a[_i];

catch (err) {
unionErrors.push("\tunion option #" + def.options.indexOf(option) + ": " + err.message);
// isValid = false;

@@ -176,5 +179,8 @@ }

if (isValid === false) {
throw ZodError_1.ZodError.fromString("Error parsing union.\nReceived: " + JSON.stringify(obj, null, 2) + "\nExpected: " + def.options
.map(function (x) { return x._def.t; })
.join(' OR '));
throw ZodError_1.ZodError.fromString('\n' + unionErrors.join('\n'));
// throw ZodError.fromString(
// `Error parsing union.\nReceived: ${JSON.stringify(obj, null, 2)}\nExpected: ${def.options
// .map(x => x._def.t)
// .join(' OR ')}`,
// );
}

@@ -218,2 +224,3 @@ break;

catch (err) {
console.log("mering child: " + index);
tupleError.mergeChild(index, err);

@@ -220,0 +227,0 @@ }

"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var z = __importStar(require("."));
exports.CreateUserParams = z.object({
email: z.string(),
firstName: z.string(),
lastName: z.string(),
});
// import * as z from '.';
// export const TestObject = z
// .object({
// email: z.string(),
// firstName: z.string(),
// lastName: z.string(),
// })
// .nonstrict();
// // const asdf = TestObject.parse('doesntmatter');
// // export type TestObject = z.infer<typeof TestObject>;
// // const asfdwer:TestObject = "asdf" as any;
// const testUnion = z.object({ asdf: z.array(z.union([z.string(), z.number()])) });
// testUnion.parse({ asdf: [false] });
//# sourceMappingURL=playground.js.map

@@ -51,3 +51,3 @@ "use strict";

var path = _a.path, message = _a.message;
return path.length ? "`" + path.join('.') + "`: " + message : "" + message;
return path.length ? path.join('.') + ": " + message : "" + message;
})

@@ -54,0 +54,0 @@ .join('\n');

{
"name": "zod",
"version": "1.6.0",
"version": "1.6.1",
"description": "TypeScript-first schema declaration and validation library with static type inference",

@@ -5,0 +5,0 @@ "main": "./lib/src/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc