New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zod

Package Overview
Dependencies
Maintainers
2
Versions
374
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zod - npm Package Compare versions

Comparing version 2.0.0-beta.22 to 2.0.0-beta.23

22

lib/cjs/__tests__/object.test.js

@@ -284,2 +284,24 @@ "use strict";

}); });
test('test nonexistent keys', function () { return __awaiter(void 0, void 0, void 0, function () {
var Schema, obj, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
Schema = z.union([
z.object({
a: z.string(),
}),
z.object({
b: z.number(),
}),
]);
obj = { a: 'A' };
return [4, Schema.spa(obj)];
case 1:
result = _a.sent();
expect(result.success).toBe(true);
return [2, result];
}
});
}); });
//# sourceMappingURL=object.test.js.map

22

lib/cjs/parser.js

@@ -424,4 +424,5 @@ "use strict";

: undefined;
if (!keyValidator)
if (!keyValidator) {
return "continue";
}
if (!Object.keys(data).includes(key)) {

@@ -431,6 +432,18 @@ try {

if (output === undefined) {
return "continue";
}
else {
objectPromises[key] = PseudoPromise_1.PseudoPromise.resolve(output);
}
}
catch (err) { }
catch (err) {
if (err instanceof ZodError_1.ZodError) {
var zerr = err;
ERROR.addIssues(zerr.issues);
objectPromises[key] = PseudoPromise_1.PseudoPromise.resolve(util_1.INVALID);
}
else {
throw err;
}
}
return "continue";
}

@@ -548,3 +561,4 @@ objectPromises[key] = new PseudoPromise_1.PseudoPromise().then(function () {

try {
var unionValueProm = PseudoPromise_1.PseudoPromise.resolve(opt.parse(data, params));
var parseProm = opt.parse(data, params);
var unionValueProm = PseudoPromise_1.PseudoPromise.resolve(parseProm);
isValid_1 = true;

@@ -551,0 +565,0 @@ return unionValueProm;

@@ -81,3 +81,14 @@ "use strict";

try {
return Promise.all(pps.map(function (pp) { return pp.getValueAsync(); }));
var allValues = Promise.all(pps.map(function (pp) {
try {
var asdf = pp.getValueAsync();
return asdf;
}
catch (err) {
return util_1.INVALID;
}
})).then(function (vals) {
return vals;
});
return allValues;
}

@@ -84,0 +95,0 @@ catch (err) { }

2

package.json
{
"name": "zod",
"version": "2.0.0-beta.22",
"version": "2.0.0-beta.23",
"description": "TypeScript-first schema declaration and validation library with static type inference",

@@ -5,0 +5,0 @@ "main": "./lib/cjs/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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc