Socket
Socket
Sign inDemoInstall

zod

Package Overview
Dependencies
Maintainers
1
Versions
361
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 1.11.4 to 1.11.5

25

lib/src/playground.js
"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("."));
var schema = z.object({
items: z.array(z.string()).refine(function (data) { return data.length > 3; }, {
path: ['items-too-few'],
}),
});
var customErrorMap = function (error, ctx) {
// console.log(`code: ${error.code}`);
// console.log('message:', error.message);
// console.log('path:', error.path);
console.log(JSON.stringify(error, null, 2));
console.log('data:', data);
return { message: error.message || ctx.defaultError };
};
var data = { items: ['first'] };
var parsed = schema.safeParse(data, { errorMap: customErrorMap });
console.log(JSON.stringify(parsed, null, 2));
//# sourceMappingURL=playground.js.map

7

lib/src/ZodError.js

@@ -66,3 +66,8 @@ "use strict";

var actualProto = _newTarget.prototype;
Object.setPrototypeOf(_this, actualProto);
if (Object.setPrototypeOf) {
Object.setPrototypeOf(_this, actualProto);
}
else {
_this.__proto__ = actualProto;
}
_this.errors = errors;

@@ -69,0 +74,0 @@ return _this;

{
"name": "zod",
"version": "1.11.4",
"version": "1.11.5",
"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

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