UNPKG

validlyjs

Version:

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

22 lines 591 B
export class ObjectBuilder { rules = []; shape(schema) { this.rules.push({ name: "shape", params: [JSON.stringify(schema)] }); return this; } strict() { this.rules.push({ name: "strict", params: [] }); return this; } custom(ruleName, ...params) { this.rules.push({ name: ruleName, params: params.map(String) }); return this; } build() { return [{ name: "object", params: [] }, ...this.rules]; } } export function object() { return new ObjectBuilder(); } //# sourceMappingURL=ObjectBuilder.js.map