Skip to content

Commit

Permalink
Merge pull request #123 from MQuy/master
Browse files Browse the repository at this point in the history
[feature] - add faker for currency
  • Loading branch information
FotoVerite committed Sep 17, 2014
2 parents 392c709 + ea627d9 commit 7fb1370
Show file tree
Hide file tree
Showing 6 changed files with 725 additions and 12 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var _definitions = {
"lorem": ["words"],
"phone_number": ["formats"],
"internet": ["avatar_uri", "domain_suffix", "free_email"],
"finance": ["account_type", "transaction_type"],
"finance": ["account_type", "transaction_type", "currency"],
};

// Create a Getter for all definitions.foo.bar propetries
Expand Down
21 changes: 19 additions & 2 deletions lib/finance.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ var finance = {

mask: function (length, parens, elipsis) {


//set defaults
length = (length == 0 || !length || typeof length == 'undefined') ? 4 : length;
parens = (parens === null) ? true : parens;
elipsis = (elipsis === null) ? true : elipsis;

//create a template for length
var template = '';

Expand Down Expand Up @@ -64,6 +64,23 @@ var finance = {

transactionType: function () {
return Helpers.randomize(faker.definitions.finance.transaction_type);
},

currencyCode: function () {
return faker.random.object_element(faker.definitions.finance.currency)['code'];
},

currencyName: function () {
return faker.random.object_element(faker.definitions.finance.currency, 'key');
},

currencySymbol: function () {
var symbol;

while (!symbol) {
symbol = faker.random.object_element(faker.definitions.finance.currency)['symbol'];
}
return symbol;
}
};

Expand Down
Loading

0 comments on commit 7fb1370

Please sign in to comment.