UNPKG

validlyjs

Version:

ValidlyJS is a lightweight, type-safe validation library inspired by Laravel's validation syntax

22 lines 603 B
export class ArrayBuilder { rules = []; each(ruleDef) { this.rules.push({ name: "each", params: [JSON.stringify(ruleDef)] }); return this; } min(length) { this.rules.push({ name: "min", params: [length.toString()] }); return this; } custom(ruleName, ...params) { this.rules.push({ name: ruleName, params: params.map(String) }); return this; } build() { return [{ name: "array", params: [] }, ...this.rules]; } } export function array() { return new ArrayBuilder(); } //# sourceMappingURL=ArrayBuilder.js.map