Socket
Socket
Sign inDemoInstall

zod

Package Overview
Dependencies
0
Maintainers
1
Versions
361
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.10.2 to 1.10.3

10

lib/src/types/array.js

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

// import { ZodUnion } from './union';
var __1 = require("..");
var ZodError_1 = require("../ZodError");
var ZodArray = /** @class */ (function (_super) {

@@ -54,6 +54,6 @@ __extends(ZodArray, _super);

_this.min = function (minLength, message) {
return _this._refinement(__assign({ check: function (data) { return data.length >= minLength; }, code: __1.ZodErrorCode.too_small, type: 'array', inclusive: true, minimum: minLength }, (typeof message === 'string' ? { message: message } : message)));
return _this._refinement(__assign({ check: function (data) { return data.length >= minLength; }, code: ZodError_1.ZodErrorCode.too_small, type: 'array', inclusive: true, minimum: minLength }, (typeof message === 'string' ? { message: message } : message)));
};
_this.max = function (maxLength, message) {
return _this._refinement(__assign({ check: function (data) { return data.length <= maxLength; }, code: __1.ZodErrorCode.too_big, type: 'array', inclusive: true, maximum: maxLength }, (typeof message === 'string' ? { message: message } : message)));
return _this._refinement(__assign({ check: function (data) { return data.length <= maxLength; }, code: ZodError_1.ZodErrorCode.too_big, type: 'array', inclusive: true, maximum: maxLength }, (typeof message === 'string' ? { message: message } : message)));
};

@@ -96,6 +96,6 @@ _this.length = function (len, message) { return _this.min(len, { message: message }).max(len, { message: message }); };

_this.min = function (minLength, message) {
return _this._refinement(__assign({ check: function (data) { return data.length >= minLength; }, code: __1.ZodErrorCode.too_small, minimum: minLength, type: 'array', inclusive: true }, (typeof message === 'string' ? { message: message } : message)));
return _this._refinement(__assign({ check: function (data) { return data.length >= minLength; }, code: ZodError_1.ZodErrorCode.too_small, minimum: minLength, type: 'array', inclusive: true }, (typeof message === 'string' ? { message: message } : message)));
};
_this.max = function (maxLength, message) {
return _this._refinement(__assign({ check: function (data) { return data.length >= maxLength; }, code: __1.ZodErrorCode.too_big, maximum: maxLength, type: 'array', inclusive: true }, (typeof message === 'string' ? { message: message } : message)));
return _this._refinement(__assign({ check: function (data) { return data.length >= maxLength; }, code: ZodError_1.ZodErrorCode.too_big, maximum: maxLength, type: 'array', inclusive: true }, (typeof message === 'string' ? { message: message } : message)));
};

@@ -102,0 +102,0 @@ _this.length = function (len, message) { return _this.min(len, { message: message }).max(len, { message: message }); };

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

// import { ZodUnion } from './union';
var __1 = require("..");
var ZodError_1 = require("../ZodError");
var errorUtil_1 = require("../helpers/errorUtil");

@@ -49,21 +49,21 @@ var ZodNumber = /** @class */ (function (_super) {

_this.min = function (minimum, message) {
return _this._refinement(__assign({ check: function (data) { return data >= minimum; }, code: __1.ZodErrorCode.too_small, minimum: minimum, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data >= minimum; }, code: ZodError_1.ZodErrorCode.too_small, minimum: minimum, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.max = function (maximum, message) {
return _this._refinement(__assign({ check: function (data) { return data <= maximum; }, code: __1.ZodErrorCode.too_big, maximum: maximum, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data <= maximum; }, code: ZodError_1.ZodErrorCode.too_big, maximum: maximum, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.int = function (message) {
return _this._refinement(__assign({ check: function (data) { return Number.isInteger(data); }, code: __1.ZodErrorCode.invalid_type, expected: 'integer', received: 'number' }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return Number.isInteger(data); }, code: ZodError_1.ZodErrorCode.invalid_type, expected: 'integer', received: 'number' }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.positive = function (message) {
return _this._refinement(__assign({ check: function (data) { return data > 0; }, code: __1.ZodErrorCode.too_small, minimum: 0, type: 'number', inclusive: false }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data > 0; }, code: ZodError_1.ZodErrorCode.too_small, minimum: 0, type: 'number', inclusive: false }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.negative = function (message) {
return _this._refinement(__assign({ check: function (data) { return data < 0; }, code: __1.ZodErrorCode.too_big, maximum: 0, type: 'number', inclusive: false }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data < 0; }, code: ZodError_1.ZodErrorCode.too_big, maximum: 0, type: 'number', inclusive: false }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.nonpositive = function (message) {
return _this._refinement(__assign({ check: function (data) { return data <= 0; }, code: __1.ZodErrorCode.too_big, maximum: 0, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data <= 0; }, code: ZodError_1.ZodErrorCode.too_big, maximum: 0, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.nonnegative = function (message) {
return _this._refinement(__assign({ check: function (data) { return data >= 0; }, code: __1.ZodErrorCode.too_small, minimum: 0, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data >= 0; }, code: ZodError_1.ZodErrorCode.too_small, minimum: 0, type: 'number', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};

@@ -70,0 +70,0 @@ return _this;

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

// import { ZodUnion } from './union';
var __1 = require("..");
var ZodError_1 = require("../ZodError");
var errorUtil_1 = require("../helpers/errorUtil");

@@ -52,15 +52,15 @@ var emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;

_this.min = function (minLength, message) {
return _this._refinement(__assign({ check: function (data) { return data.length >= minLength; }, code: __1.ZodErrorCode.too_small, minimum: minLength, type: 'string', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data.length >= minLength; }, code: ZodError_1.ZodErrorCode.too_small, minimum: minLength, type: 'string', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.max = function (maxLength, message) {
return _this._refinement(__assign({ check: function (data) { return data.length <= maxLength; }, code: __1.ZodErrorCode.too_big, maximum: maxLength, type: 'string', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return data.length <= maxLength; }, code: ZodError_1.ZodErrorCode.too_big, maximum: maxLength, type: 'string', inclusive: true }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.email = function (message) {
return _this._refinement(__assign({ check: function (data) { return emailRegex.test(data); }, code: __1.ZodErrorCode.invalid_string, validation: 'email' }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return emailRegex.test(data); }, code: ZodError_1.ZodErrorCode.invalid_string, validation: 'email' }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.url = function (message) {
return _this._refinement(__assign({ check: function (data) { return urlRegex.test(data); }, code: __1.ZodErrorCode.invalid_string, validation: 'url' }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return urlRegex.test(data); }, code: ZodError_1.ZodErrorCode.invalid_string, validation: 'url' }, errorUtil_1.errorUtil.errToObj(message)));
};
_this.uuid = function (message) {
return _this._refinement(__assign({ check: function (data) { return uuidRegex.test(data); }, code: __1.ZodErrorCode.invalid_string, validation: 'uuid' }, errorUtil_1.errorUtil.errToObj(message)));
return _this._refinement(__assign({ check: function (data) { return uuidRegex.test(data); }, code: ZodError_1.ZodErrorCode.invalid_string, validation: 'uuid' }, errorUtil_1.errorUtil.errToObj(message)));
};

@@ -67,0 +67,0 @@ _this.nonempty = function (message) { return _this.min(1, errorUtil_1.errorUtil.errToObj(message)); };

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

@@ -58,2 +58,2 @@ "main": "./lib/src/index.js",

}
}
}

@@ -23,2 +23,4 @@ <p align="center">

> โš ๏ธ You might be encountering issues building your project is you're using zod@<1.10.2. This is the result of a bug in the TypeScript compiler. To solve this without updating, set `"skipLibCheck": true` in your tsconfig.json "compilerOptions". This issue is resolved in zod@1.10.2 and later.
# What is Zod

@@ -1093,3 +1095,3 @@

> You can the special `z.void()` option if your function doesn't return anything. This will let Zod properly infer the type of void-returning functions. (Void-returning function can actually return either undefined or null.)
> You can use the special `z.void()` option if your function doesn't return anything. This will let Zod properly infer the type of void-returning functions. (Void-returning function can actually return either undefined or null.)

@@ -1096,0 +1098,0 @@ ```ts

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