text: /**
   * Fix VAR corrections encountered in the array of results. A result is
   * considered to be corrected when the sequence of results doesn't seem logical.
   * For instance, 1-0, 2-0, 1-0 and 1-0. The home team scores a goal and tweet it
   * then the VAR rule it out.
   *
   * @param {Array} results Array of results.
   * @returns {Array} Returns a new array with the results corrected if any.
   * @example
   *
   * const results = fixVAR([
   *   createResult("0-0"),
   *   createResult("0-0"),
   *   createResult("1-0"),
   *   createResult("2-0"),
   *   createResult("1-0"), // VAR
   *   createResult("1-0"),
   * ]);
   * // ["0-0", "0-0", "1-0", "1-0", "1-0", "1-0"]
   *
   */
  const fixVAR = (results) => {
    const fixedResults = [...results];
  
    for (let i = 3; i < fixedResults.length; i++) {
      const result = fixedResults[i];
      const controlResult = fixedResults[i - 3];
      const correctedResult = fixedResults[i - 2];
      const previousResult = fixedResults[i - 1];
  
      if (result.isEqualTo(controlResult) && !result.isEqualTo(correctedResult)) {
        fixedResults[i - 2] = previousResult;
      }
    }
  
    return fixedResults;
  };
  
  export { fixVAR };
  