aboutsummaryrefslogtreecommitdiff
path: root/lib/random.js
diff options
context:
space:
mode:
authorJakub Mandula <[email protected]>2017-02-26 13:51:40 +0000
committerJakub Mandula <[email protected]>2017-02-26 13:51:40 +0000
commit232a2a58d70935c57d311b5ba237347f703c2131 (patch)
tree69f695e62e17386988c47f8522bf5e14db193839 /lib/random.js
parentd6c20353360ef1eefb56128eeb50ece4f5845372 (diff)
parentf379057be0112d6732b056d93d1380be18e1087a (diff)
downloadfaker-232a2a58d70935c57d311b5ba237347f703c2131.tar.xz
faker-232a2a58d70935c57d311b5ba237347f703c2131.zip
Merge branch 'Mark/origin' into creditCard
Diffstat (limited to 'lib/random.js')
-rw-r--r--lib/random.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/random.js b/lib/random.js
index d3cbf3ea..d5f112ce 100644
--- a/lib/random.js
+++ b/lib/random.js
@@ -193,10 +193,20 @@ function Random (faker, seed) {
* alphaNumeric
*
* @method faker.random.alphaNumeric
+ * @param {number} count defaults to 1
*/
- this.alphaNumeric = function alphaNumeric() {
- return faker.random.arrayElement(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]);
- }
+ this.alphaNumeric = function alphaNumeric(count) {
+ if (typeof count === "undefined") {
+ count = 1;
+ }
+
+ var wholeString = "";
+ for(var i = 0; i < count; i++) {
+ wholeString += faker.random.arrayElement(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]);
+ }
+
+ return wholeString;
+ };
return this;