aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarak Squires <[email protected]>2011-12-28 03:45:01 -0800
committerMarak Squires <[email protected]>2011-12-28 03:45:01 -0800
commit3ee94bb7ec0fbfe46c1bffac2e0658d103e03e4f (patch)
tree535f415dc893e2a0bed430ce45bab4c9bb28e25b /lib
parentaf47db9be83e285d0728447dbd8d8813cf58fd72 (diff)
parent84ab59342f333bc33a992ec5ca37d8716295a536 (diff)
downloadfaker-3ee94bb7ec0fbfe46c1bffac2e0658d103e03e4f.tar.xz
faker-3ee94bb7ec0fbfe46c1bffac2e0658d103e03e4f.zip
Merge pull request #14 from aratak/trailing_spaces
[dist] Code cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/company.js30
-rw-r--r--lib/definitions.js154
-rw-r--r--lib/helpers.js28
-rw-r--r--lib/internet.js22
-rw-r--r--lib/lorem.js24
-rw-r--r--lib/name.js34
-rw-r--r--lib/phone_number.js8
7 files changed, 150 insertions, 150 deletions
diff --git a/lib/company.js b/lib/company.js
index fd807061..a1e5d56a 100644
--- a/lib/company.js
+++ b/lib/company.js
@@ -2,28 +2,28 @@ var Helpers = require('./helpers');
var definitions = require('../lib/definitions');
exports.companyName = function ( format ) {
- switch( ( format ? format : Helpers.randomNumber(3) ) )
- {
- case 0:
- return Helpers.randomize(definitions.last_name()) + " " + this.companySuffix();
- break;
- case 1:
- return Helpers.randomize(definitions.last_name()) + "-" + Helpers.randomize(definitions.last_name()) ;
- break;
- case 2:
- return Helpers.randomize(definitions.last_name()) + "," + Helpers.randomize(definitions.last_name()) + " and " + Helpers.randomize(definitions.last_name());
- break;
- }
+ switch( ( format ? format : Helpers.randomNumber(3) ) )
+ {
+ case 0:
+ return Helpers.randomize(definitions.last_name()) + " " + this.companySuffix();
+ break;
+ case 1:
+ return Helpers.randomize(definitions.last_name()) + "-" + Helpers.randomize(definitions.last_name()) ;
+ break;
+ case 2:
+ return Helpers.randomize(definitions.last_name()) + "," + Helpers.randomize(definitions.last_name()) + " and " + Helpers.randomize(definitions.last_name());
+ break;
+ }
};
exports.companySuffix = function() {
- return Helpers.randomize(["Inc", "and\ Sons", "LLC", "Group", "and\ Daughters"]);
+ return Helpers.randomize(["Inc", "and\ Sons", "LLC", "Group", "and\ Daughters"]);
};
exports.catchPhrase = function() {
- return Helpers.randomize(definitions.catch_phrase_adjective()) + " " + Helpers.randomize(definitions.catch_phrase_descriptor()) + " "+ Helpers.randomize(definitions.catch_phrase_noun());
+ return Helpers.randomize(definitions.catch_phrase_adjective()) + " " + Helpers.randomize(definitions.catch_phrase_descriptor()) + " "+ Helpers.randomize(definitions.catch_phrase_noun());
};
exports.bs = function() {
- return Helpers.randomize(definitions.bs_adjective()) + " " + Helpers.randomize(definitions.bs_buzz()) + " "+ Helpers.randomize(definitions.bs_noun());
+ return Helpers.randomize(definitions.bs_adjective()) + " " + Helpers.randomize(definitions.bs_buzz()) + " "+ Helpers.randomize(definitions.bs_noun());
}; \ No newline at end of file
diff --git a/lib/definitions.js b/lib/definitions.js
index 9a05f8ff..5478af21 100644
--- a/lib/definitions.js
+++ b/lib/definitions.js
@@ -12,67 +12,67 @@ exports.name_suffix = function(){return ["Jr.", "Sr.", "I", "II", "III", "IV",
// address.js definitions
exports.br_state = function () {
- return [
- 'Acre',
- 'Alagoas',
- 'Amapá',
- 'Amazonas',
- 'Bahia',
- 'Ceará',
- 'Distrito Federal',
- 'Espírito Santo',
- 'Goiás',
- 'Maranhão',
- 'Mato Grosso',
- 'Mato Grosso do Sul',
- 'Minas Gerais',
- 'Paraná',
- 'Paraíba',
- 'Pará',
- 'Pernambuco',
- 'Piauí',
- 'Rio de Janeiro',
- 'Rio Grande do Norte',
- 'Rio Grande do Sul',
- 'Rondônia',
- 'Roraima',
- 'Santa Catarina',
- 'Sergipe',
- 'São Paulo',
- 'Tocantins'
- ];
+ return [
+ 'Acre',
+ 'Alagoas',
+ 'Amapá',
+ 'Amazonas',
+ 'Bahia',
+ 'Ceará',
+ 'Distrito Federal',
+ 'Espírito Santo',
+ 'Goiás',
+ 'Maranhão',
+ 'Mato Grosso',
+ 'Mato Grosso do Sul',
+ 'Minas Gerais',
+ 'Paraná',
+ 'Paraíba',
+ 'Pará',
+ 'Pernambuco',
+ 'Piauí',
+ 'Rio de Janeiro',
+ 'Rio Grande do Norte',
+ 'Rio Grande do Sul',
+ 'Rondônia',
+ 'Roraima',
+ 'Santa Catarina',
+ 'Sergipe',
+ 'São Paulo',
+ 'Tocantins'
+ ];
};
exports.br_state_abbr = function () {
- return [
- 'AC',
- 'AL',
- 'AP',
- 'AM',
- 'BA',
- 'CE',
- 'DF',
- 'ES',
- 'GO',
- 'MA',
- 'MT',
- 'MS',
- 'MG',
- 'PR',
- 'PB',
- 'PA',
- 'PE',
- 'PI',
- 'RJ',
- 'RN',
- 'RS',
- 'RO',
- 'RR',
- 'SC',
- 'SE',
- 'SP',
- 'TO'
- ];
+ return [
+ 'AC',
+ 'AL',
+ 'AP',
+ 'AM',
+ 'BA',
+ 'CE',
+ 'DF',
+ 'ES',
+ 'GO',
+ 'MA',
+ 'MT',
+ 'MS',
+ 'MG',
+ 'PR',
+ 'PB',
+ 'PA',
+ 'PE',
+ 'PI',
+ 'RJ',
+ 'RN',
+ 'RS',
+ 'RO',
+ 'RR',
+ 'SC',
+ 'SE',
+ 'SP',
+ 'TO'
+ ];
};
exports.us_state = function(){return ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'];};
@@ -113,23 +113,23 @@ exports.lorem = function(){return ["alias","consequatur","aut","perferendis","si
exports.phone_formats = function(){return [
'###-###-####',
- '(###)###-####',
- '1-###-###-####',
- '###.###.####',
- '###-###-####',
- '(###)###-####',
- '1-###-###-####',
- '###.###.####',
- '###-###-#### x###',
- '(###)###-#### x###',
- '1-###-###-#### x###',
- '###.###.#### x###',
- '###-###-#### x####',
- '(###)###-#### x####',
- '1-###-###-#### x####',
- '###.###.#### x####',
- '###-###-#### x#####',
- '(###)###-#### x#####',
- '1-###-###-#### x#####',
- '###.###.#### x#####'
+ '(###)###-####',
+ '1-###-###-####',
+ '###.###.####',
+ '###-###-####',
+ '(###)###-####',
+ '1-###-###-####',
+ '###.###.####',
+ '###-###-#### x###',
+ '(###)###-#### x###',
+ '1-###-###-#### x###',
+ '###.###.#### x###',
+ '###-###-#### x####',
+ '(###)###-#### x####',
+ '1-###-###-#### x####',
+ '###.###.#### x####',
+ '###-###-#### x#####',
+ '(###)###-#### x#####',
+ '1-###-###-#### x#####',
+ '###.###.#### x#####'
];};
diff --git a/lib/helpers.js b/lib/helpers.js
index d057ea53..812d1567 100644
--- a/lib/helpers.js
+++ b/lib/helpers.js
@@ -1,25 +1,25 @@
var Faker = require('../Faker');
-// returns a single random number based on a range
+// returns a single random number based on a range
exports.randomNumber = function(range) {
- r = Math.floor(Math.random()*range);
- return r;
+ r = Math.floor(Math.random()*range);
+ return r;
};
// takes an array and returns the array randomly sorted
exports.randomize = function(array) {
- r = Math.floor(Math.random()*array.length);
- return array[r];
+ r = Math.floor(Math.random()*array.length);
+ return array[r];
};
-// parses string for a symbol and replace it with a random number from 1-10
+// parses string for a symbol and replace it with a random number from 1-10
exports.replaceSymbolWithNumber = function(string, symbol){
-
- // default symbol is '#'
+
+ // default symbol is '#'
if(typeof symbol == 'undefined'){
var symbol = '#';
}
-
+
var str = '';
for(var i = 0; i < string.length; i++){
if(string[i] == symbol){
@@ -32,15 +32,15 @@ exports.replaceSymbolWithNumber = function(string, symbol){
return str;
};
-// takes an array and returns it randomized
-exports.shuffle = function(o){
- for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
- return o;
+// takes an array and returns it randomized
+exports.shuffle = function(o){
+ for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
+ return o;
};
exports.generateDataSet = function(size){
-
+
};
exports.createCard = function(){
diff --git a/lib/internet.js b/lib/internet.js
index e3c48fec..ac462f76 100644
--- a/lib/internet.js
+++ b/lib/internet.js
@@ -2,23 +2,23 @@ var Helpers = require('./helpers');
var definitions = require('./definitions');
exports.email = function() {
- return this.userName() + "@" + this.domainName();
+ return this.userName() + "@" + this.domainName();
};
exports.userName = function() {
- switch(Helpers.randomNumber(2))
- {
- case 0:
- return Helpers.randomize(definitions.first_name());
- break;
- case 1:
- return Helpers.randomize(definitions.first_name()) + Helpers.randomize([".", "_"]) + Helpers.randomize(definitions.last_name()) ;
- break;
- }
+ switch(Helpers.randomNumber(2))
+ {
+ case 0:
+ return Helpers.randomize(definitions.first_name());
+ break;
+ case 1:
+ return Helpers.randomize(definitions.first_name()) + Helpers.randomize([".", "_"]) + Helpers.randomize(definitions.last_name()) ;
+ break;
+ }
};
exports.domainName = function() {
- return this.domainWord() + "." + Helpers.randomize(definitions.domain_suffix());
+ return this.domainWord() + "." + Helpers.randomize(definitions.domain_suffix());
};
exports.domainWord = function() {
diff --git a/lib/lorem.js b/lib/lorem.js
index 3d05535c..8a408ec2 100644
--- a/lib/lorem.js
+++ b/lib/lorem.js
@@ -2,15 +2,15 @@ var Helpers = require('./helpers');
var definitions = require('../lib/definitions');
exports.words = function(num){
- if( typeof num == 'undefined'){ var num = 3;}
+ if( typeof num == 'undefined'){ var num = 3;}
return Helpers.shuffle(definitions.lorem()).slice(0, num);
//Words.shuffle[0, num]
};
exports.sentence = function(wordCount){
- if( typeof wordCount == 'undefined'){ var wordCount = 3;}
+ if( typeof wordCount == 'undefined'){ var wordCount = 3;}
- // strange issue with the node_min_test failing for captialize, please fix and add this back
+ // strange issue with the node_min_test failing for captialize, please fix and add this back
//return this.words(wordCount + Helpers.randomNumber(7)).join(' ').capitalize();
return this.words(wordCount + Helpers.randomNumber(7)).join(' ');
@@ -18,23 +18,23 @@ exports.sentence = function(wordCount){
exports.sentences = function(sentenceCount){
if( typeof sentenceCount == 'undefined'){ var sentenceCount = 3;}
- var sentences = [];
- for(sentenceCount; sentenceCount >= 0; sentenceCount--){
- sentences.push(this.sentence());
- }
+ var sentences = [];
+ for(sentenceCount; sentenceCount >= 0; sentenceCount--){
+ sentences.push(this.sentence());
+ }
return sentences.join("\n");
};
exports.paragraph = function(sentenceCount){
if( typeof sentenceCount == 'undefined'){ var sentenceCount = 3;}
- return this.sentences(sentenceCount + Helpers.randomNumber(3));
+ return this.sentences(sentenceCount + Helpers.randomNumber(3));
};
exports.paragraphs = function(paragraphCount){
if( typeof paragraphCount == 'undefined'){ var paragraphCount = 3;}
- var paragraphs = [];
- for(paragraphCount; paragraphCount >= 0; paragraphCount--){
- paragraphs.push(this.paragraph());
- }
+ var paragraphs = [];
+ for(paragraphCount; paragraphCount >= 0; paragraphCount--){
+ paragraphs.push(this.paragraph());
+ }
return paragraphs.join("\n \r\t");
};
diff --git a/lib/name.js b/lib/name.js
index ad2a078d..0965b80e 100644
--- a/lib/name.js
+++ b/lib/name.js
@@ -1,35 +1,35 @@
var Helpers = require('./helpers');
var definitions = require('./definitions');
-/*
+/*
exports.first_name = function(){
-
+
return definitions.first_name()[0];
//Math.floor(Math.random()*10);
-
+
};
*/
exports.findName = function() {
- var r = Helpers.randomNumber(8);
- switch(r)
- {
- case 0:
- return Helpers.randomize(definitions.name_prefix()) + " " + Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.last_name());
- break;
- case 1:
- return Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.last_name()); + " " + Helpers.randomize(definitions.name_suffix);
- break;
- }
-
- return Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.last_name());
+ var r = Helpers.randomNumber(8);
+ switch(r)
+ {
+ case 0:
+ return Helpers.randomize(definitions.name_prefix()) + " " + Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.last_name());
+ break;
+ case 1:
+ return Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.last_name()); + " " + Helpers.randomize(definitions.name_suffix);
+ break;
+ }
+
+ return Helpers.randomize(definitions.first_name()) + " " + Helpers.randomize(definitions.last_name());
};
exports.firstName = function () {
- return Helpers.randomize(definitions.first_name());
+ return Helpers.randomize(definitions.first_name());
};
exports.lastName = function () {
- return Helpers.randomize(definitions.last_name());
+ return Helpers.randomize(definitions.last_name());
};
diff --git a/lib/phone_number.js b/lib/phone_number.js
index ed3660a8..6fbf65bb 100644
--- a/lib/phone_number.js
+++ b/lib/phone_number.js
@@ -1,12 +1,12 @@
var Helpers = require('./helpers');
var definitions = require('./definitions');
-
+
exports.phoneNumber = function(){
-
+
return Helpers.replaceSymbolWithNumber(Helpers.randomize(definitions.phone_formats()));
-
+
};
exports.phoneNumberFormat = function ( format ){
- return Helpers.replaceSymbolWithNumber(definitions.phone_formats()[format]);
+ return Helpers.replaceSymbolWithNumber(definitions.phone_formats()[format]);
}; \ No newline at end of file