MCPcopy Index your code
hub / github.com/bitnbytesio/node-input-validator / validate

Method validate

lib/post.js:17–37  ·  view source on GitHub ↗

* validate post rule * @param rule

(rule)

Source from the content-addressed store, hash-verified

15 * @param rule
16 */
17 async validate(rule) {
18
19 let result;
20
21 switch (rule.rule) {
22
23 case 'any':
24 result = await this.validateAny(rule.values, rule.params);
25 break;
26
27 case 'all':
28 result = await this.validateAll(rule.values, rule.params);
29 break;
30
31 case 'function':
32 result = await rule.params.apply(this, [rule.values]);
33 break;
34 }
35
36 return result;
37 }
38
39 /**
40 * check if any of required fields exists on input

Callers

nothing calls this directly

Calls 3

validateAnyMethod · 0.95
validateAllMethod · 0.95
applyMethod · 0.80

Tested by

no test coverage detected