UNPKG

520 BJavaScriptView Raw
1"use strict";
2/* let Rules = spice.classes.validate.Rules;
3
4Rules.prototype.shouldExist = function* (field, value, args, message) {
5 try {
6 let loaded = require(spice.root_path + `/models/${args}`);
7 let Class = loaded.default;
8 let obj = new Class();
9 let found = yield obj.exist(value);
10 if (found) {
11 return true;
12 }
13 } catch (e) {
14 this.validator.addError(field, 'rule', field + 'ShouldExist', 'Cannot Validate ' + args);
15 }
16 return false;
17} */
\No newline at end of file