forked from zuriby/Faker.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ad9a14
commit 92f6fae
Showing
2 changed files
with
51 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
lib/definitions.js | ||
lib/version.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,75 @@ | ||
var Helpers = require('./helpers'); | ||
var definitions = require('../lib/definitions'); | ||
|
||
exports.zipCode = function() { | ||
return Helpers.replaceSymbolWithNumber(Helpers.randomize(["#####", '#####-####'])); | ||
exports.zipCode = function () { | ||
return Helpers.replaceSymbolWithNumber(Helpers.randomize(["#####", '#####-####'])); | ||
}; | ||
|
||
exports.zipCodeFormat = function ( format ) { | ||
return Helpers.replaceSymbolWithNumber( ["#####", '#####-####'][format] ); | ||
exports.zipCodeFormat = function (format) { | ||
return Helpers.replaceSymbolWithNumber(["#####", '#####-####'][format]); | ||
}; | ||
|
||
exports.city = function() { | ||
switch(Helpers.randomNumber(3)) | ||
{ | ||
case 0: | ||
return Helpers.randomize(definitions.city_prefix()) + " " + Helpers.randomize(definitions.first_name()) + Helpers.randomize(definitions.city_suffix()); | ||
break; | ||
case 1: | ||
return Helpers.randomize(definitions.city_prefix()) + " " + Helpers.randomize(definitions.first_name()); | ||
break; | ||
case 2: | ||
return Helpers.randomize(definitions.first_name()) + Helpers.randomize(definitions.city_suffix()); | ||
break; | ||
case 3: | ||
return Helpers.randomize(definitions.last_name()) + Helpers.randomize(definitions.city_suffix()); | ||
break; | ||
} | ||
exports.city = function () { | ||
switch (Helpers.randomNumber(3)) { | ||
case 0: | ||
return Helpers.randomize(definitions.city_prefix()) + " " + Helpers.randomize(definitions.first_name()) + Helpers.randomize(definitions.city_suffix()); | ||
case 1: | ||
return Helpers.randomize(definitions.city_prefix()) + " " + Helpers.randomize(definitions.first_name()); | ||
case 2: | ||
return Helpers.randomize(definitions.first_name()) + Helpers.randomize(definitions.city_suffix()); | ||
case 3: | ||
return Helpers.randomize(definitions.last_name()) + Helpers.randomize(definitions.city_suffix()); | ||
} | ||
}; | ||
|
||
exports.streetName = function() { | ||
switch(Helpers.randomNumber(1)) | ||
{ | ||
case 0: | ||
return Helpers.randomize(definitions.last_name()) + " " + Helpers.randomize(definitions.street_suffix()); | ||
break; | ||
case 1: | ||
return Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.street_suffix()); | ||
break; | ||
} | ||
exports.streetName = function () { | ||
switch (Helpers.randomNumber(1)) { | ||
case 0: | ||
return Helpers.randomize(definitions.last_name()) + " " + Helpers.randomize(definitions.street_suffix()); | ||
case 1: | ||
return Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.street_suffix()); | ||
} | ||
}; | ||
|
||
exports.streetAddress = function(i) { | ||
if( typeof i == 'undefined'){ var i = false;} | ||
var address = ""; | ||
switch(Helpers.randomNumber(2)) | ||
{ | ||
exports.streetAddress = function (i) { | ||
if (typeof i == 'undefined') { i = false; } | ||
var address = ""; | ||
switch (Helpers.randomNumber(2)) { | ||
case 0: | ||
address = Helpers.replaceSymbolWithNumber("#####") + " " + this.streetName(); | ||
break; | ||
address = Helpers.replaceSymbolWithNumber("#####") + " " + this.streetName(); | ||
break; | ||
case 1: | ||
address = Helpers.replaceSymbolWithNumber("####") + " " + this.streetName(); | ||
break; | ||
address = Helpers.replaceSymbolWithNumber("####") + " " + this.streetName(); | ||
break; | ||
case 2: | ||
address = Helpers.replaceSymbolWithNumber("###") + " " + this.streetName(); | ||
break; | ||
address = Helpers.replaceSymbolWithNumber("###") + " " + this.streetName(); | ||
break; | ||
} | ||
var full_address = i ? address + " " + this.secondaryAddress() : address; | ||
return full_address; | ||
var full_address = i ? address + " " + this.secondaryAddress() : address; | ||
return full_address; | ||
}; | ||
|
||
exports.secondaryAddress = function() { | ||
exports.secondaryAddress = function () { | ||
return Helpers.replaceSymbolWithNumber(Helpers.randomize( | ||
[ | ||
'Apt. ###', | ||
'Suite ###' | ||
] | ||
) | ||
); | ||
[ | ||
'Apt. ###', | ||
'Suite ###' | ||
] | ||
)); | ||
}; | ||
|
||
exports.brState = function( abbr ) { | ||
return Helpers.randomize( definitions[ abbr ? 'br_state_abbr' : 'br_state']() ); | ||
} | ||
exports.brState = function (abbr) { | ||
return Helpers.randomize(definitions[abbr ? 'br_state_abbr' : 'br_state']()); | ||
}; | ||
|
||
exports.ukCounty = function(){ | ||
return Helpers.randomize(definitions.uk_county()); | ||
exports.ukCounty = function () { | ||
return Helpers.randomize(definitions.uk_county()); | ||
}; | ||
|
||
exports.ukCountry = function(){ | ||
return Helpers.randomize(definitions.uk_country()); | ||
exports.ukCountry = function () { | ||
return Helpers.randomize(definitions.uk_country()); | ||
}; | ||
|
||
exports.usState = function( abbr ) { | ||
return Helpers.randomize( definitions[ abbr ? 'us_state_abbr' : 'us_state']() ); | ||
} | ||
exports.usState = function (abbr) { | ||
return Helpers.randomize(definitions[abbr ? 'us_state_abbr' : 'us_state']()); | ||
}; |