X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Funderscore.string%2Frepeat.js;fp=node_modules%2Funderscore.string%2Frepeat.js;h=71228ed4ff9bd5dd22a7bb22aec8ab3e1ec471de;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/underscore.string/repeat.js b/node_modules/underscore.string/repeat.js new file mode 100644 index 000000000..71228ed4f --- /dev/null +++ b/node_modules/underscore.string/repeat.js @@ -0,0 +1,16 @@ +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); +};