From 23d415779e9c20552aee5d66a69bd5f93737f079 Mon Sep 17 00:00:00 2001 From: Josef Salyer Date: Sun, 28 Jul 2013 20:46:38 -0400 Subject: added tests and cleaned up at 100% in istanbul (not constantinople) --- lib/finance.js | 15 ++++++--------- lib/helpers.js | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'lib') 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() }; }; -- cgit v1.2.3