adb.sh/src/projects/hoyams.md
adb-sh c6811fb286
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
Update hoyams post
2023-03-31 23:26:27 +02:00

1.1 KiB

sidebar excerpt meta
true the validation tool nobody asked for
name content
description the validation tool nobody asked for
name content
keywords Alban, David, Becker, deno, web, javascript

hoyams

the validation tool nobody asked for | hoyams = hold on you are missing something

Concept

Rules are defined via a callback which retuns true or an error String. This is so that you can define rules by using an or operator like this:

new Rule((v) => typeof v === "string" || "is not a string");

or this:

new Rule((v) =>
  typeof v === "string" && !!v.match(/^\w+@\w+\.\w+$/) ||
  "no valid email"
);
  • If a executing a validation completes without an error an object with the same structure as the object given is returned.

  • For creating powerful nested object rules there are some primites given: How to use