diff options
| author | Josef Salyer <[email protected]> | 2013-07-28 20:46:38 -0400 |
|---|---|---|
| committer | Josef Salyer <[email protected]> | 2013-07-28 20:46:38 -0400 |
| commit | 23d415779e9c20552aee5d66a69bd5f93737f079 (patch) | |
| tree | 6f2427d0c8aa036e918b440b3bab99e7ce8e0ca7 /lib | |
| parent | d21bb4156b44b619c8d207714ea42727441e88b4 (diff) | |
| download | faker-23d415779e9c20552aee5d66a69bd5f93737f079.tar.xz faker-23d415779e9c20552aee5d66a69bd5f93737f079.zip | |
added tests and cleaned up at 100% in istanbul (not constantinople)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/finance.js | 15 | ||||
| -rw-r--r-- | lib/helpers.js | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/finance.js b/lib/finance.js index 61262125..daf2cc9e 100644 --- a/lib/finance.js +++ b/lib/finance.js @@ -25,10 +25,8 @@ var finance = { mask: function(length, parens, elipsis){ //set defaults - length = (length === null) ? 4 : length; - + length = length || 4; parens = (parens === null) ? true : parens; - elipsis = (elipsis === null) ? true : elipsis; //create a template for length @@ -56,18 +54,17 @@ var finance = { amount: function(min, max, dec, symbol){ - if(!min) min = 1; - if(!max) max = 1000; - if(!dec) dec = 2; - if(!symbol) symbol = ''; //default to nothing - + min = min || 1; + max = max || 1000; + dec = dec || 2; + symbol = symbol || ''; return symbol + Math.round((Math.random() * (max - min) + min)*Math.pow(10,dec))/Math.pow(10,dec); }, transactionType: function(){ - return Helpers.randomize(definitions.transaction_type()); + return Helpers.randomize(definitions.transaction_type); } }; diff --git a/lib/helpers.js b/lib/helpers.js index bc6f5b62..aef9746a 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -121,7 +121,7 @@ exports.createTransaction = function(){ "date" : new Date(2012, 1, 2), //TODO: add a ranged date method "business": Faker.Company.companyName(), "name": [Faker.Finance.accountName(), Faker.Finance.mask()].join(' '), - "type" : exports.randomize(Faker.definitions.transaction_type()), + "type" : exports.randomize(Faker.definitions.transaction_type), "account" : Faker.Finance.account() }; }; |
