diff options
| author | nhassan <[email protected]> | 2010-07-12 12:50:20 -0400 |
|---|---|---|
| committer | nhassan <[email protected]> | 2010-07-12 12:50:20 -0400 |
| commit | 2bc7417008c5265e162665c63856bb32bdd4a779 (patch) | |
| tree | 3cfedd9a476011d6f74b72c704d2c4bdc82ca2dd /lib | |
| parent | b70601b60b1974bf4771a4649a6d25e96a95ac29 (diff) | |
| download | faker-2bc7417008c5265e162665c63856bb32bdd4a779.tar.xz faker-2bc7417008c5265e162665c63856bb32bdd4a779.zip | |
changes + additions zipCodeFormat, usState, phoneNumberFormat, companyName, companySuffix
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/address.js | 11 | ||||
| -rw-r--r-- | lib/company.js | 6 | ||||
| -rw-r--r-- | lib/phone_number.js | 3 |
3 files changed, 14 insertions, 6 deletions
diff --git a/lib/address.js b/lib/address.js index 8ced6331..ef3c0c29 100644 --- a/lib/address.js +++ b/lib/address.js @@ -5,6 +5,10 @@ exports.zipCode = function() { return Helpers.replaceSymbolWithNumber(Helpers.randomize(["#####", '#####-####'])); }; +exports.zipCodeFormat = function ( format ) { + return Helpers.replaceSymbolWithNumber( ["#####", '#####-####'][format] ); +}; + exports.city = function() { switch(Helpers.randomNumber(3)) { @@ -69,6 +73,7 @@ exports.ukCounty = function(){ return Helpers.randomize(definitions.uk_county()); }; -exports.ukCountry = function(){ - return Helpers.randomize(definitions.uk_country()); -};
\ No newline at end of file + +exports.usState = function( abbr ) { + return Helpers.randomize( definitions[ abbr ? 'us_state_abbr' : 'us_state']() ); +}
\ No newline at end of file diff --git a/lib/company.js b/lib/company.js index d66faaec..fd807061 100644 --- a/lib/company.js +++ b/lib/company.js @@ -1,8 +1,8 @@ var Helpers = require('./helpers'); var definitions = require('../lib/definitions'); -exports.companyName = function() { - switch(Helpers.randomNumber(3)) +exports.companyName = function ( format ) { + switch( ( format ? format : Helpers.randomNumber(3) ) ) { case 0: return Helpers.randomize(definitions.last_name()) + " " + this.companySuffix(); @@ -17,7 +17,7 @@ exports.companyName = function() { }; exports.companySuffix = function() { - return Helpers.randomize(["Inc", "and\ Sons", "LLC", "Group"]); + return Helpers.randomize(["Inc", "and\ Sons", "LLC", "Group", "and\ Daughters"]); }; exports.catchPhrase = function() { diff --git a/lib/phone_number.js b/lib/phone_number.js index 756d5fd8..ed3660a8 100644 --- a/lib/phone_number.js +++ b/lib/phone_number.js @@ -7,3 +7,6 @@ exports.phoneNumber = function(){ }; +exports.phoneNumberFormat = function ( format ){ + return Helpers.replaceSymbolWithNumber(definitions.phone_formats()[format]); +};
\ No newline at end of file |
