Sha256: a03376eba45895bcc8bd6f53bb1763d3ce6642b1e597e383d098ad0018ba70fd

Contents?: true

Size: 480 Bytes

Versions: 19

Compression:

Stored size: 480 Bytes

Contents

var makeString = require('./helper/makeString');
var strRepeat = require('./helper/strRepeat');

module.exports = function repeat(str, qty, separator) {
  str = makeString(str);

  qty = ~~qty;

  // using faster implementation if separator is not needed;
  if (separator == null) return strRepeat(str, qty);

  // this one is about 300x slower in Google Chrome
  /*eslint no-empty: 0*/
  for (var repeat = []; qty > 0; repeat[--qty] = str) {}
  return repeat.join(separator);
};

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ela-4.1.6 node_modules/underscore.string/repeat.js
ela-4.1.5 node_modules/underscore.string/repeat.js
ela-4.1.4 node_modules/underscore.string/repeat.js
ela-4.1.3 node_modules/underscore.string/repeat.js
ela-4.1.2 node_modules/underscore.string/repeat.js
ela-4.1.1 node_modules/underscore.string/repeat.js
ela-4.1.0 node_modules/underscore.string/repeat.js
ela-4.0.0 node_modules/underscore.string/repeat.js
ela-3.4.3 node_modules/underscore.string/repeat.js
ela-3.4.2 node_modules/underscore.string/repeat.js
ela-3.4.0 node_modules/underscore.string/repeat.js
ela-3.3.1 node_modules/underscore.string/repeat.js
ela-3.3.0 node_modules/underscore.string/repeat.js
ela-3.2.0 node_modules/underscore.string/repeat.js
ela-3.1.1 node_modules/underscore.string/repeat.js
ela-3.1.0 node_modules/underscore.string/repeat.js
ela-3.0.0 node_modules/underscore.string/repeat.js
ela-2.0.0 node_modules/underscore.string/repeat.js
ela-1.1.0 node_modules/underscore.string/repeat.js