bguard
Version:
**bguard** is a powerful, flexible, and type-safe validation library for TypeScript. It allows developers to define validation schemas for their data structures and ensures that data conforms to the expected types and constraints.
31 lines (22 loc) • 1.06 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true}); var _class;
var _chunkVN4GLOENjs = require('./chunk-VN4GLOEN.js');
var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js');
var _chunkAXKX5BGHjs = require('./chunk-AXKX5BGH.js');
// src/asserts/array/index.ts
function array(arraySchema) {
return new ArraySchema({ type: [], requiredValidations: [] }, arraySchema);
}
var ArraySchema = (_class = class extends _chunkVN4GLOENjs.CommonSchema {
__init() {this._array = 1}
constructor(ctx, arraySchema) {
super(ctx);_class.prototype.__init.call(this);;
this.validateArrayEntry(arraySchema);
this[_chunkAXKX5BGHjs.ctxSymbol].array = arraySchema;
}
validateArrayEntry(arraySchema) {
if (!arraySchema) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)("Missing schema in array method");
if (!(arraySchema instanceof _chunkVN4GLOENjs.CommonSchema)) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)("Invalid schema in array method");
}
}, _class);
exports.array = array;
//# sourceMappingURL=chunk-TCDQA2NU.js.map