function createRunner(rules) {
  let _beforeEach;
  let _afterEach;
  return {
    beforeEach(fn) {
      _beforeEach = fn;
    },
    afterEach(fn) {
      _afterEach = fn;
    },
    run() {
      const violations = [];

      for (const rule of rules) {
        const node = _beforeEach(rule.context);
        const result = rule.validate(node, rule.context);

        if (result instanceof ValidationError) {
          violations.push(result);
        }

        _afterEach(node);
      }

      return violations;
    },
  };
}
/**
 * Create a runner for the given collection of rules
 * @param {Array<Rule>} rules
 * @return Runner
 */
Create a runner for the given collection of rules
@param {Array} rules
@return Runner
Create a runner for the given collection of rules @param { Array } rules @return Runner
function createRunner(rules) {
  let _beforeEach;
  let _afterEach;
  return {
    beforeEach(fn) {
      _beforeEach = fn;
    },
    afterEach(fn) {
      _afterEach = fn;
    },
    run() {
      const violations = [];
      for (const rule of rules) {
        const node = _beforeEach(rule.context);
        const result = rule.validate(node, rule.context);
        if (result instanceof ValidationError) {
          violations.push(result);
        }
        _afterEach(node);
      }
      return violations;
    },
  };
}
function createRunner ( rules ) { let _beforeEach ; let _afterEach ; return { beforeEach ( fn ) { _beforeEach = fn ; } , afterEach ( fn ) { _afterEach = fn ; } , run ( ) { const violations = [ ] ; for ( const rule of rules ) { const node = _beforeEach ( rule . context ) ; const result = rule . validate ( node , rule . context ) ; if ( result instanceof ValidationError ) { violations . push ( result ) ; } _afterEach ( node ) ; } return violations ; } , } ; }
Create a runner for the given collection of rules
 @param {Array<Rule>} rules
 @return Runner
Create a runner for the given collection of rules @param { Array<Rule > } rules @return Runner