Skip to content

Commit

Permalink
linted address.js
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanDonovan committed Jan 6, 2013
1 parent 5ad9a14 commit 92f6fae
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 60 deletions.
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/definitions.js
lib/version.js
110 changes: 50 additions & 60 deletions lib/address.js
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']());
};

0 comments on commit 92f6fae

Please sign in to comment.