|
|
|
@ -6,7 +6,7 @@ const wrapError = require("./");
|
|
|
|
|
|
|
|
|
|
/*** Simple rules ***/
|
|
|
|
|
|
|
|
|
|
let rule = wrapError("wrap-error.custom", "This is a custom error message complaining that the value must be a string!", [ isString ]);
|
|
|
|
|
let rule = wrapError("This is a custom error message complaining that the value must be a string!", "wrap-error.custom", [ isString ]);
|
|
|
|
|
|
|
|
|
|
console.log(validateValue("hello world", [ rule ])); // hello world
|
|
|
|
|
|
|
|
|
@ -21,7 +21,7 @@ try {
|
|
|
|
|
|
|
|
|
|
/*** Combinators with properties, and preserving the original errors as well ***/
|
|
|
|
|
|
|
|
|
|
let objectRule = wrapError("wrap-error.thingem", "Must be a valid thingem", {
|
|
|
|
|
let objectRule = wrapError("Must be a valid thingem", "wrap-error.thingem", {
|
|
|
|
|
a: [ isString ],
|
|
|
|
|
b: [ isString ]
|
|
|
|
|
}, { preserveOriginalErrors: true });
|
|
|
|
|