Skip to content

Commit

Permalink
tabs to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Osipenko committed Dec 28, 2011
1 parent cea0735 commit 308683c
Show file tree
Hide file tree
Showing 11 changed files with 527 additions and 527 deletions.
374 changes: 187 additions & 187 deletions Faker.js

Large diffs are not rendered by default.

374 changes: 187 additions & 187 deletions examples/js/Faker.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/node_generateSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fs.writeFile('../examples/dataSet.json', JSON.stringify(Faker.Helpers.userCard(
var bigSet = [];

for(i = 20; i >= 0; i--){
bigSet.push(Faker.Helpers.userCard());
bigSet.push(Faker.Helpers.userCard());
};

fs.writeFile('../examples/bigDataSet.json', JSON.stringify(bigSet), function() {
Expand Down
30 changes: 15 additions & 15 deletions lib/company.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
};
154 changes: 77 additions & 77 deletions lib/definitions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ var Faker = require('../Faker');

// 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
Expand All @@ -34,8 +34,8 @@ exports.replaceSymbolWithNumber = function(string, symbol){

// 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;
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;
};


Expand Down
22 changes: 11 additions & 11 deletions lib/internet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
24 changes: 12 additions & 12 deletions lib/lorem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@ 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(' ');
};

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");
};
26 changes: 13 additions & 13 deletions lib/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ exports.first_name = function(){
*/

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;
}
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());
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());
};
2 changes: 1 addition & 1 deletion lib/phone_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ exports.phoneNumber = function(){
};

exports.phoneNumberFormat = function ( format ){
return Helpers.replaceSymbolWithNumber(definitions.phone_formats()[format]);
return Helpers.replaceSymbolWithNumber(definitions.phone_formats()[format]);
};
Loading

0 comments on commit 308683c

Please sign in to comment.