-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (30 loc) · 961 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Created by roten on 8/15/17.
*/
'use strict';
module.exports = require('./src/JCompiler');
module.exports = {
JCompiler: require('./src/JCompiler'),
ValidVerbs: require('./src/lib/ValidVerbs'),
operands: require('./src/lib/operands'),
getVerbsInString: require('./src/lib/Commons').getInstance().parser.getVerbsInString,
isRuleValidator: function(rules) {
let res = null;
try {
const targets = require('./src/lib/Parser').getInstance().rawTargetParser(rules);
Object.keys(targets).forEach(topKey => {
Object.keys(targets[topKey]).forEach(verb => {
Object.keys(targets[topKey][verb]['value']).forEach(operands => {
if (targets[topKey][verb]['keyTarget']['acceptableOperand'].indexOf(operands) == -1) {
throw new Error('The operand ' + operands + ' is not valid ');
}
});
});
});
}
catch (e) {
res = e;
}
return res;
},
};