Version 1
[yaffs-website] / node_modules / underscore.string / helper / strRepeat.js
diff --git a/node_modules/underscore.string/helper/strRepeat.js b/node_modules/underscore.string/helper/strRepeat.js
new file mode 100644 (file)
index 0000000..b60d876
--- /dev/null
@@ -0,0 +1,9 @@
+module.exports = function strRepeat(str, qty){
+  if (qty < 1) return '';
+  var result = '';
+  while (qty > 0) {
+    if (qty & 1) result += str;
+    qty >>= 1, str += str;
+  }
+  return result;
+};