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 (29 loc) • 806 B
JavaScript
import {
CommonSchema
} from "./chunk-QIPGUTIG.mjs";
import {
BuildSchemaError
} from "./chunk-ZTCXXAKD.mjs";
import {
ctxSymbol
} from "./chunk-2ANPCB4O.mjs";
// src/asserts/array/index.ts
function array(arraySchema) {
return new ArraySchema({ type: [], requiredValidations: [] }, arraySchema);
}
var ArraySchema = class extends CommonSchema {
_array = 1;
constructor(ctx, arraySchema) {
super(ctx);
this.validateArrayEntry(arraySchema);
this[ctxSymbol].array = arraySchema;
}
validateArrayEntry(arraySchema) {
if (!arraySchema) throw new BuildSchemaError("Missing schema in array method");
if (!(arraySchema instanceof CommonSchema)) throw new BuildSchemaError("Invalid schema in array method");
}
};
export {
array
};
//# sourceMappingURL=chunk-6WKSLMJG.mjs.map