aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorashmothership <[email protected]>2016-03-17 23:58:29 +0000
committerashmothership <[email protected]>2016-03-17 23:58:29 +0000
commitcf22b690004e67d523a72ef72994b1248ca0bd4b (patch)
tree0034280fdaff87f538fdc975b04330895b89219f /lib
parent1238c8b65e15972f9746863b8b3b5a6161b34770 (diff)
downloadfaker-cf22b690004e67d523a72ef72994b1248ca0bd4b.tar.xz
faker-cf22b690004e67d523a72ef72994b1248ca0bd4b.zip
Bitcoin support
Diffstat (limited to 'lib')
-rw-r--r--lib/finance.js15
-rw-r--r--lib/random.js9
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/finance.js b/lib/finance.js
index 9b478573..6083e64b 100644
--- a/lib/finance.js
+++ b/lib/finance.js
@@ -134,6 +134,21 @@ var Finance = function (faker) {
}
return symbol;
}
+
+ /**
+ * bitcoinAddress
+ *
+ * @method faker.finance.bitcoinAddress
+ */
+ self.bitcoinAddress = function () {
+ var addressLength = Math.floor(Math.random() * (36 - 27 + 1)) + 27;
+ var address = faker.random.arrayElement(['1', '3']);
+
+ for (var i = 0; i < addressLength - 1; i++)
+ address += faker.random.alphaNumeric().toUpperCase();
+
+ return address;
+ }
}
module['exports'] = Finance;
diff --git a/lib/random.js b/lib/random.js
index b152ddbd..d3cbf3ea 100644
--- a/lib/random.js
+++ b/lib/random.js
@@ -189,6 +189,15 @@ function Random (faker, seed) {
return faker.random.arrayElement(Object.keys(faker.locales));
};
+ /**
+ * alphaNumeric
+ *
+ * @method faker.random.alphaNumeric
+ */
+ 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"]);
+ }
+
return this;
}