delsenyoret
v1.0.5
Published
**Validator** utility class (304 bytes).
Downloads
3
Readme
Delsenyoret
Validator utility class (304 bytes).
Install
npm i delsenyoret
Use
import { Validator } from "delsenyoret";
let product_name_validator = new Validator<string>("product")
.addRule("is_string", value => typeof value === "string")
.addRule("is_not_empty", value => value.length > 0)
.addRule("starts_with_pattern", value => value.startsWith("sku-"));
product_name_validator.exec("sku 37db5e2d-c36c-49c0-b8bd-ca750fd9e35a"); // throws
product_name_validator.exec("sku-37db5e2d-c36c-49c0-b8bd-ca750fd9e35a"); // ok
License
Delsenyoret is distributed under the MIT license