Comparing version 1.11.4 to 1.11.5
"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 |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
276776
3606