All files rule.js

33.33% Statements 2/6
0% Branches 0/2
50% Functions 1/2
40% Lines 2/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20      1x 1x                              
// A Rule has actions for a field.
class Rule {
  constructor(field, actions) {
    this.field = field
    this.actions = actions
  }
 
  // Execute all actions of this rule.
  apply(form) {
    if (ddf.debug) console.log('[Rule]', this, '.apply(', form, ')')
    for (var i=0; i<this.actions.length; i++) {
      this.actions[i].execute(form, this.field)
    }
  }
}
 
export {
  Rule,
}