Comparing version 1.2.0 to 1.2.2
@@ -9,15 +9,27 @@ "use strict"; | ||
Object.defineProperty(exports, "keySignature", { enumerable: true, get: function () { return types_2.keySignature; } }); | ||
exports.string = (opts) => new types_1.StringType(opts); | ||
exports.boolean = () => new types_1.BooleanType(); | ||
exports.number = (opts) => new types_1.NumberType(opts); | ||
exports.bigint = (opts) => new types_1.BigIntType(opts); | ||
exports.unknown = () => new types_1.UnknownType(); | ||
exports.literal = (literal) => new types_1.LiteralType(literal); | ||
exports.object = (shape, opts) => new types_1.ObjectType(shape, opts); | ||
exports.array = (schema, opts) => new types_1.ArrayType(schema, opts); | ||
exports.union = (schemas, opts) => new types_1.UnionType(schemas, opts); | ||
exports.intersection = (l, r) => l.and(r); | ||
exports.literals = (...args) => new types_1.UnionType(args.map(exports.literal)); | ||
exports.record = (schema) => new types_1.ObjectType({ [types_1.keySignature]: schema }); | ||
exports.dictionary = (schema) => { | ||
const string = (opts) => new types_1.StringType(opts); | ||
exports.string = string; | ||
const boolean = () => new types_1.BooleanType(); | ||
exports.boolean = boolean; | ||
const number = (opts) => new types_1.NumberType(opts); | ||
exports.number = number; | ||
const bigint = (opts) => new types_1.BigIntType(opts); | ||
exports.bigint = bigint; | ||
const unknown = () => new types_1.UnknownType(); | ||
exports.unknown = unknown; | ||
const literal = (literal) => new types_1.LiteralType(literal); | ||
exports.literal = literal; | ||
const object = (shape, opts) => new types_1.ObjectType(shape, opts); | ||
exports.object = object; | ||
const array = (schema, opts) => new types_1.ArrayType(schema, opts); | ||
exports.array = array; | ||
const union = (schemas, opts) => new types_1.UnionType(schemas, opts); | ||
exports.union = union; | ||
const intersection = (l, r) => l.and(r); | ||
exports.intersection = intersection; | ||
const literals = (...args) => new types_1.UnionType(args.map(exports.literal)); | ||
exports.literals = literals; | ||
const record = (schema) => new types_1.ObjectType({ [types_1.keySignature]: schema }); | ||
exports.record = record; | ||
const dictionary = (schema) => { | ||
if (schema instanceof types_1.OptionalType) { | ||
@@ -28,5 +40,9 @@ return new types_1.ObjectType({ [types_1.keySignature]: schema }); | ||
}; | ||
exports.tuple = (schemas) => new types_1.TupleType(schemas); | ||
exports.date = () => new types_1.DateType(); | ||
exports.lazy = (fn) => new types_1.LazyType(fn); | ||
exports.dictionary = dictionary; | ||
const tuple = (schemas) => new types_1.TupleType(schemas); | ||
exports.tuple = tuple; | ||
const date = () => new types_1.DateType(); | ||
exports.date = date; | ||
const lazy = (fn) => new types_1.LazyType(fn); | ||
exports.lazy = lazy; | ||
function partial(schema, opts) { | ||
@@ -33,0 +49,0 @@ if (schema instanceof types_1.ObjectType) { |
{ | ||
"name": "myzod", | ||
"version": "1.2.0", | ||
"version": "1.2.2", | ||
"description": "", | ||
@@ -11,3 +11,4 @@ "main": "./libs/index.js", | ||
"pub": "npm t && npm run build && npm publish", | ||
"bench": "find test -path '*.benchmark.ts' | xargs benchmonkey" | ||
"bench": "find test -path '*.benchmark.ts' | xargs benchmonkey", | ||
"prettier": "prettier --write '**/*.ts'" | ||
}, | ||
@@ -29,10 +30,10 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/mocha": "^8.0.3", | ||
"@types/node": "^14.14.6", | ||
"@types/mocha": "^8.0.4", | ||
"@types/node": "^14.14.9", | ||
"benchmonkey": "0.0.7", | ||
"mocha": "^8.2.0", | ||
"mocha": "^8.2.1", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.1.2", | ||
"prettier": "^2.2.0", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.1.2" | ||
}, | ||
@@ -39,0 +40,0 @@ "nyc": { |
95832
1570