We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f2db06a + e7c177f commit 20a8e98Copy full SHA for 20a8e98
lib/index.js
@@ -11,8 +11,9 @@ function setLang(lang) {
11
messages.defaultLang = lang;
12
}
13
14
-function extend(name, callback) {
+function extend(name, callback, isImplicit=false) {
15
rules[name] = callback;
16
+ if (isImplicit) Validator.addImplicitRule(name);
17
18
19
/**
lib/validator.js
@@ -78,6 +78,14 @@ class Validator {
78
this.breakWhenFailed = sure;
79
80
81
+ /**
82
+ * Allows a custom rule to be added as an implicit rule
83
+ * @param {String} ruleName
84
+ */
85
+ static addImplicitRule(ruleName){
86
+ implicitRules.push(ruleName);
87
+ }
88
+
89
90
* set attributes nice names
91
* @param {*} attributeNames
0 commit comments