text: const CustomError = require("../extensions/custom-error");
  
  module.exports = function repeater(str, options) {
    str = String(str);
    let addiction = String(options.addition);
    let additionSeparator = options.additionSeparator ? options.additionSeparator : "|";
    let separator = options.separator ? options.separator : "+";
    let additionRepeatTimes = options.additionRepeatTimes ? options.additionRepeatTimes : 1;
    let repeatTimes = options.repeatTimes ? options.repeatTimes : 1;
  
    let res = [];
    let addictionRes = [];
    if (options.hasOwnProperty("addition")) {
  
      for (let i = 0; i < additionRepeatTimes; i += 1) {
        addictionRes.push(addiction);
      }
      for (let i = 0; i < repeatTimes; i += 1) {
        res.push(`${str + addictionRes.join(additionSeparator)}`);
      }
    }
    else {
      for (let i = 0; i < repeatTimes; i += 1) {
        res.push(str);
      }
    }
  
    return res.join(`${separator}`)
  }
  