You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
381 B
JavaScript
14 lines
381 B
JavaScript
"use strict";
|
|
|
|
const { validateValue } = require("@validatem/core");
|
|
const matchesFormat = require("./");
|
|
|
|
let rule = matchesFormat(/^[a-z0-9]+$/);
|
|
|
|
console.log(validateValue("hello", [ rule ])); // hello
|
|
|
|
console.log(validateValue("hello world", [ rule ])); /*
|
|
AggregrateValidationError: One or more validation errors occurred:
|
|
- At (root): Must match format: /^[a-z0-9]+$/
|
|
*/
|