json-api-nestjs
Version:
JsonApi Plugin for NestJs
14 lines • 414 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.zodId = zodId;
const zod_1 = require("zod");
const types_1 = require("../../types");
const reg = new RegExp('^-?\\d+$');
function zodId(typeId) {
let idSchema = zod_1.z.string();
if (typeId === types_1.TypeField.number) {
idSchema = idSchema.regex(reg);
}
return idSchema;
}
//# sourceMappingURL=id.js.map