{"size": 759, "ext": "js", "max_stars_repo_path": "src/extended-repeater.js", "max_stars_repo_name": "EugeneBarD/basic-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/extended-repeater.js", "max_issues_repo_name": "EugeneBarD/basic-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/extended-repeater.js", "max_forks_repo_name": "EugeneBarD/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": 27.1071428571, "max_line_length": 81, "alphanum_fraction": 0.6350461133}
const CustomError = require("../extensions/custom-error");

module.exports = function repeater(str, options) {
  if(options.separator == undefined) options.separator = '+';
  if(options.addition !== undefined)
  {
    if(options.additionRepeatTimes == undefined) options.additionRepeatTimes = 1;
    if(options.additionRepeatTimes == 1) str += options.addition;
    else
    {
      let resultAddition = options.addition;
      for (let i = 1; i < options.additionRepeatTimes; i++) 
      {
        resultAddition += (options.additionSeparator + options.addition) ;
      }
      str += resultAddition;
    }
  }
  let result = str;
  
  for (let i = 1; i < options.repeatTimes; i++) 
  {
    result += (options.separator + str);
  }
  
  return result;
};
  