diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/helpers.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/helpers.js b/lib/helpers.js index 832732f5..c7957e08 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1,3 +1,18 @@ +/** Define the String.prototype.repeat if it is not implemented.... See PR #382 +*/ +if(typeof String.prototype.repeat === "undefined") { + String.prototype.repeat = function(num) { + if(typeof num ==="undefined") { + num = 0; + } + var text = ""; + for(var i = 0; i < num; i++){ + text += this.toString(); + } + return text; + }; +} + /** * * @namespace faker.helpers |
