UNPKG

validlyjs

Version:

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

26 lines 700 B
export class FileBuilder { rules = []; maxSize(size) { this.rules.push({ name: "maxSize", params: [size] }); return this; } mimes(types) { this.rules.push({ name: "mimes", params: types }); return this; } dimensions(constraints) { this.rules.push({ name: "dimensions", params: [constraints] }); return this; } custom(ruleName, ...params) { this.rules.push({ name: ruleName, params: params.map(String) }); return this; } build() { return [{ name: "file", params: [] }, ...this.rules]; } } export function file() { return new FileBuilder(); } //# sourceMappingURL=FileBuilder.js.map