{"size": 949, "ext": "js", "max_stars_repo_path": "src/transform-array.js", "max_stars_repo_name": "IanaLit/basic-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/transform-array.js", "max_issues_repo_name": "IanaLit/basic-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/transform-array.js", "max_forks_repo_name": "IanaLit/basic-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 33.8928571429, "max_line_length": 85, "alphanum_fraction": 0.5363540569}
const CustomError = require("../extensions/custom-error");

module.exports =  function transform(arr) {
let tmp =[]; 

  for (let i=0; i< arr.length; i++){

    if (arr[i] === '--discard-next') continue;
    else if (arr[i-1] === '--discard-next') continue;
    else if(arr[i] === '--discard-prev') continue; 
    else if(arr[i+1] === '--discard-prev') continue;

    else if (arr[i] === '--double-next'){
      if (i === arr.length-1) continue;
      else if(arr[i+1] !== undefined ) tmp.push(arr[i+1]);  
    } 
    else if (arr[i-1] === '--double-next' && arr[i] !== undefined) tmp.push(arr[i]);
    else if( arr[i] === '--double-prev'){
      if(arr[i-2] !== '--discard-next' && arr[i-1] !== undefined) tmp.push(arr[i-1]);
      else continue;
    } else if(arr[i+1] === '-double-prev'){
      if(arr[i-1] !== '--discard-next' && arr[i] !== undefined) tmp.push(arr[i]);
      else continue;
    }
      else tmp.push(arr[i]);
  }
  return tmp;
}