{"size": 871, "ext": "js", "max_stars_repo_path": "src/extended-repeater.js", "max_stars_repo_name": "xx3u/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": "xx3u/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": "xx3u/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": 32.2592592593, "max_line_length": 77, "alphanum_fraction": 0.5970149254}
const CustomError = require("../extensions/custom-error");

module.exports = function repeater(str, options) {
  let newAr = [];
  if (options.repeatTimes === undefined) {
    newAr.push(String(str), String(options.addition))
    return newAr.join('');
  } else {
    for (i = 0; i < options.repeatTimes; i++) {
      newAr.push(String(str));
      if (options.additionRepeatTimes > 0) {
        for (y = 0; y < options.additionRepeatTimes; y++) {
          newAr.push(String(options.addition));
          options.additionSeparator ? newAr.push(options.additionSeparator) :
          newAr.push('|');
        }
        newAr.pop();
      } else if (options.addition !== undefined) {
        newAr.push(String(options.addition))
      }
      options.separator ? newAr.push(options.separator) : newAr.push('+');
    };
    newAr.pop();
    return newAr.join('');
  }
};
  