11 lines
356 B
TypeScript
11 lines
356 B
TypeScript
import {
|
|
ValidationError, validate,
|
|
isBoolean
|
|
} from "./mod.ts";
|
|
|
|
const converted: any = {};
|
|
const errors: ValidationError[] = await validate("foobar", isBoolean(), { doConversion: true, converted });
|
|
console.log(errors);
|
|
// [ { type: "isBoolean", args: {}, message: "This value has to be a boolean." } ]
|
|
console.log(converted);
|
|
// { output: "foobar" }
|