From ce0455ae0c2f6009e9dc6407fcb93388272db867 Mon Sep 17 00:00:00 2001 From: dmamills Date: Sun, 8 Dec 2013 21:38:20 -0500 Subject: [PATCH] [Version, hot-fix] working 0.5.11 --- .travis.yml | 5 +++ Faker.js | 76 ++++++++++++++++++++++---------------------- MinFaker.js | 30 ++++++++--------- examples/js/Faker.js | 76 ++++++++++++++++++++++---------------------- package.json | 2 +- 5 files changed, 97 insertions(+), 92 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..1cbca686f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: node_js + +node_js: + - 0.8 + - 0.10 diff --git a/Faker.js b/Faker.js index c3b21001c..7f2e16605 100644 --- a/Faker.js +++ b/Faker.js @@ -17,7 +17,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************** AUTOGENERATED @ 1371014966634 *************** +/*************** AUTOGENERATED @ 1371016897413 *************** WARNING: THIS FILE WAS AUTOGENERATED BY THE FAKER BUILD SCRIPT MODIFYING THIS FILE IS FINE, BUT YOU REALLY SHOULD BE MODIFYING THE LIBRARY DIRECTLY AND REGENERATING THIS FILE USING BUILD.js!!!! @@ -54,12 +54,12 @@ Faker.Name.findName = function () { var r = Faker.random.number(8); switch (r) { case 0: - return Faker.random.name_prefix() + " " + _name.firstName() + " " + _name.lastName(); + return Faker.random.name_prefix() + " " + this.firstName() + " " + this.lastName(); case 1: - return _name.firstName() + " " + _name.lastName() + " " + Faker.random.name_suffix(); + return this.firstName() + " " + this.lastName() + " " + Faker.random.name_suffix(); } - return _name.firstName() + " " + _name.lastName(); + return this.firstName() + " " + this.lastName(); }; Faker.Address = {}; @@ -105,19 +105,19 @@ Faker.Address.streetName = function () { Faker.Address.streetAddress = function (useFullAddress) { if (useFullAddress === undefined) { useFullAddress = false; } - var result = ""; + var address = ""; switch (Faker.random.number(3)) { case 0: - result = Helpers.replaceSymbolWithNumber("#####") + " " + address.streetName(); + address = Helpers.replaceSymbolWithNumber("#####") + " " + this.streetName(); break; case 1: - result = Helpers.replaceSymbolWithNumber("####") + " " + address.streetName(); + address = Helpers.replaceSymbolWithNumber("####") + " " + this.streetName(); break; case 2: - result = Helpers.replaceSymbolWithNumber("###") + " " + address.streetName(); + address = Helpers.replaceSymbolWithNumber("###") + " " + this.streetName(); break; } - return useFullAddress ? (result + " " + this.secondaryAddress()) : result; + return useFullAddress ? (address + " " + this.secondaryAddress()) : address; }; Faker.Address.secondaryAddress = function () { @@ -164,7 +164,7 @@ Faker.PhoneNumber.phoneNumberFormat = function (phoneFormatsArrayIndex) { Faker.Internet = {}; Faker.Internet.email = function () { - return Faker.Helpers.slugify(internet.userName()) + "@" + Faker.Helpers.slugify(internet.domainName()); + return Faker.Helpers.slugify(this.userName()) + "@" + Faker.Helpers.slugify(this.domainName()); }; Faker.Internet.userName = function () { @@ -181,7 +181,7 @@ Faker.Internet.userName = function () { }; Faker.Internet.domainName = function () { - return internet.domainWord() + "." + Faker.random.domain_suffix(); + return this.domainWord() + "." + Faker.random.domain_suffix(); }; Faker.Internet.domainWord = function () { @@ -209,7 +209,7 @@ Faker.Company.suffixes = function () { Faker.Company.companyName = function (format) { switch ((format ? format : Faker.random.number(3))) { case 0: - return Faker.Name.lastName() + " " + company.companySuffix(); + return Faker.Name.lastName() + " " + this.companySuffix(); case 1: return Faker.Name.lastName() + "-" + Faker.Name.lastName(); case 2: @@ -218,7 +218,7 @@ Faker.Company.companyName = function (format) { }; Faker.Company.companySuffix = function () { - return Faker.random.array_element(company.suffixes()); + return Faker.random.array_element(this.suffixes()); }; Faker.Company.catchPhrase = function () { @@ -246,28 +246,28 @@ Faker.Lorem.sentence = function (wordCount, range) { // strange issue with the node_min_test failing for captialize, please fix and add this back //return this.words(wordCount + Helpers.randomNumber(range)).join(' ').capitalize(); - return lorem.words(wordCount + Faker.random.number(7)).join(' '); + return this.words(wordCount + Faker.random.number(7)).join(' '); }; Faker.Lorem.sentences = function (sentenceCount) { if (typeof sentenceCount == 'undefined') { sentenceCount = 3; } var sentences = []; for (sentenceCount; sentenceCount > 0; sentenceCount--) { - sentences.push(lorem.sentence()); + sentences.push(this.sentence()); } return sentences.join("\n"); }; Faker.Lorem.paragraph = function (sentenceCount) { if (typeof sentenceCount == 'undefined') { sentenceCount = 3; } - return lorem.sentences(sentenceCount + Faker.random.number(3)); + return this.sentences(sentenceCount + Faker.random.number(3)); }; Faker.Lorem.paragraphs = function (paragraphCount) { if (typeof paragraphCount == 'undefined') { paragraphCount = 3; } var paragraphs = []; for (paragraphCount; paragraphCount > 0; paragraphCount--) { - paragraphs.push(lorem.paragraph()); + paragraphs.push(this.paragraph()); } return paragraphs.join("\n \r\t"); }; @@ -392,87 +392,87 @@ Faker.random.array_element = function (array) { }; Faker.random.city_prefix = function () { - return random.array_element(definitions.city_prefix); + return this.array_element(definitions.city_prefix); }; Faker.random.city_suffix = function () { - return random.array_element(definitions.city_suffix); + return this.array_element(definitions.city_suffix); }; Faker.random.street_suffix = function () { - return random.array_element(definitions.street_suffix); + return this.array_element(definitions.street_suffix); }; Faker.random.br_state = function () { - return random.array_element(definitions.br_state); + return this.array_element(definitions.br_state); }; Faker.random.br_state_abbr = function () { - return random.array_element(definitions.br_state_abbr); + return this.array_element(definitions.br_state_abbr); }; Faker.random.us_state = function () { - return random.array_element(definitions.us_state); + return this.array_element(definitions.us_state); }; Faker.random.us_state_abbr = function () { - return random.array_element(definitions.us_state_abbr); + return this.array_element(definitions.us_state_abbr); }; Faker.random.uk_county = function () { - return random.array_element(definitions.uk_county); + return this.array_element(definitions.uk_county); }; Faker.random.uk_country = function () { - return random.array_element(definitions.uk_country); + return this.array_element(definitions.uk_country); }; Faker.random.first_name = function () { - return random.array_element(definitions.first_name); + return this.array_element(definitions.first_name); }; Faker.random.last_name = function () { - return random.array_element(definitions.last_name); + return this.array_element(definitions.last_name); }; Faker.random.name_prefix = function () { - return random.array_element(definitions.name_prefix); + return this.array_element(definitions.name_prefix); }; Faker.random.name_suffix = function () { - return random.array_element(definitions.name_suffix); + return this.array_element(definitions.name_suffix); }; Faker.random.catch_phrase_adjective = function () { - return random.array_element(definitions.catch_phrase_adjective); + return this.array_element(definitions.catch_phrase_adjective); }; Faker.random.catch_phrase_descriptor = function () { - return random.array_element(definitions.catch_phrase_descriptor); + return this.array_element(definitions.catch_phrase_descriptor); }; Faker.random.catch_phrase_noun = function () { - return random.array_element(definitions.catch_phrase_noun); + return this.array_element(definitions.catch_phrase_noun); }; Faker.random.bs_adjective = function () { - return random.array_element(definitions.bs_adjective); + return this.array_element(definitions.bs_adjective); }; Faker.random.bs_buzz = function () { - return random.array_element(definitions.bs_buzz); + return this.array_element(definitions.bs_buzz); }; Faker.random.bs_noun = function () { - return random.array_element(definitions.bs_noun); + return this.array_element(definitions.bs_noun); }; Faker.random.phone_formats = function () { - return random.array_element(definitions.phone_formats); + return this.array_element(definitions.phone_formats); }; Faker.random.domain_suffix = function () { - return random.array_element(definitions.domain_suffix); + return this.array_element(definitions.domain_suffix); }; Faker.definitions = {}; diff --git a/MinFaker.js b/MinFaker.js index e1308efce..4bbcd4779 100644 --- a/MinFaker.js +++ b/MinFaker.js @@ -1,19 +1,19 @@ -!function(){var a={version:"0.5.5",Name:{}};a.Name.firstName=function(){return a.random.first_name()};a.Name.lastName=function(){return a.random.last_name()};a.Name.findName=function(){switch(a.random.number(8)){case 0:return a.random.name_prefix()+" "+_name.firstName()+" "+_name.lastName();case 1:return _name.firstName()+" "+_name.lastName()+" "+a.random.name_suffix()}return _name.firstName()+" "+_name.lastName()};a.Address={};a.Address.zipCode=function(){return e.replaceSymbolWithNumber(a.random.array_element(["#####", +!function(){var a={version:"0.5.5",Name:{}};a.Name.firstName=function(){return a.random.first_name()};a.Name.lastName=function(){return a.random.last_name()};a.Name.findName=function(){switch(a.random.number(8)){case 0:return a.random.name_prefix()+" "+this.firstName()+" "+this.lastName();case 1:return this.firstName()+" "+this.lastName()+" "+a.random.name_suffix()}return this.firstName()+" "+this.lastName()};a.Address={};a.Address.zipCode=function(){return e.replaceSymbolWithNumber(a.random.array_element(["#####", "#####-####"]))};a.Address.zipCodeFormat=function(a){return e.replaceSymbolWithNumber(["#####","#####-####"][a])};a.Address.city=function(){var b;switch(a.random.number(4)){case 0:b=a.random.city_prefix()+" "+a.random.first_name()+a.random.city_suffix();break;case 1:b=a.random.city_prefix()+" "+a.random.first_name();break;case 2:b=a.random.first_name()+a.random.city_suffix();break;case 3:b=a.random.last_name()+a.random.city_suffix()}return b};a.Address.streetName=function(){var b;switch(a.random.number(2)){case 0:b= -a.random.last_name()+" "+a.random.street_suffix();break;case 1:b=a.random.first_name()+" "+a.random.street_suffix()}return b};a.Address.streetAddress=function(b){void 0===b&&(b=!1);var d="";switch(a.random.number(3)){case 0:d=e.replaceSymbolWithNumber("#####")+" "+address.streetName();break;case 1:d=e.replaceSymbolWithNumber("####")+" "+address.streetName();break;case 2:d=e.replaceSymbolWithNumber("###")+" "+address.streetName()}return b?d+" "+this.secondaryAddress():d};a.Address.secondaryAddress= -function(){return e.replaceSymbolWithNumber(a.random.array_element(["Apt. ###","Suite ###"]))};a.Address.brState=function(b){return b?a.random.br_state_abbr():a.random.br_state()};a.Address.ukCounty=function(){return a.random.uk_county()};a.Address.ukCountry=function(){return a.random.uk_country()};a.Address.usState=function(b){return b?a.random.us_state_abbr():a.random.us_state()};a.Address.latitude=function(){return(a.random.number(18E5)/1E4-90).toFixed(4)};a.Address.longitude=function(){return(a.random.number(36E5)/ -1E4-180).toFixed(4)};a.PhoneNumber={};a.PhoneNumber.phoneNumber=function(){return e.replaceSymbolWithNumber(a.random.phone_formats())};a.PhoneNumber.phoneNumberFormat=function(a){return e.replaceSymbolWithNumber(c.phone_formats[a])};a.Internet={};a.Internet.email=function(){return a.Helpers.slugify(internet.userName())+"@"+a.Helpers.slugify(internet.domainName())};a.Internet.userName=function(){var b;switch(a.random.number(2)){case 0:b=a.random.first_name();break;case 1:b=a.random.first_name()+a.random.array_element([".", -"_"])+a.random.last_name()}return b};a.Internet.domainName=function(){return internet.domainWord()+"."+a.random.domain_suffix()};a.Internet.domainWord=function(){return a.random.first_name().toLowerCase()};a.Internet.ip=function(){for(var a=[],d=0;4>d;d++)a[d]=(254*Math.random()+1).toFixed(0);return a.join(".")};a.Company={};a.Company.suffixes=function(){return["Inc","and Sons","LLC","Group","and Daughters"]};a.Company.companyName=function(b){switch(b?b:a.random.number(3)){case 0:return a.Name.lastName()+ -" "+company.companySuffix();case 1:return a.Name.lastName()+"-"+a.Name.lastName();case 2:return a.Name.lastName()+", "+a.Name.lastName()+" and "+a.Name.lastName()}};a.Company.companySuffix=function(){return a.random.array_element(company.suffixes())};a.Company.catchPhrase=function(){return a.random.catch_phrase_adjective()+" "+a.random.catch_phrase_descriptor()+" "+a.random.catch_phrase_noun()};a.Company.bs=function(){return a.random.bs_adjective()+" "+a.random.bs_buzz()+" "+a.random.bs_noun()};a.Lorem= -{};a.Lorem.words=function(a){"undefined"==typeof a&&(a=3);return e.shuffle(c.lorem).slice(0,a)};a.Lorem.sentence=function(b){"undefined"==typeof b&&(b=3);return lorem.words(b+a.random.number(7)).join(" ")};a.Lorem.sentences=function(a){"undefined"==typeof a&&(a=3);var d=[];for(a;0d;d++)a[d]=(254*Math.random()+1).toFixed(0);return a.join(".")};a.Company={};a.Company.suffixes=function(){return["Inc","and Sons","LLC","Group","and Daughters"]};a.Company.companyName=function(b){switch(b?b:a.random.number(3)){case 0:return a.Name.lastName()+" "+this.companySuffix();case 1:return a.Name.lastName()+ +"-"+a.Name.lastName();case 2:return a.Name.lastName()+", "+a.Name.lastName()+" and "+a.Name.lastName()}};a.Company.companySuffix=function(){return a.random.array_element(this.suffixes())};a.Company.catchPhrase=function(){return a.random.catch_phrase_adjective()+" "+a.random.catch_phrase_descriptor()+" "+a.random.catch_phrase_noun()};a.Company.bs=function(){return a.random.bs_adjective()+" "+a.random.bs_buzz()+" "+a.random.bs_noun()};a.Lorem={};a.Lorem.words=function(a){"undefined"==typeof a&&(a=3); +return e.shuffle(c.lorem).slice(0,a)};a.Lorem.sentence=function(b){"undefined"==typeof b&&(b=3);return this.words(b+a.random.number(7)).join(" ")};a.Lorem.sentences=function(a){"undefined"==typeof a&&(a=3);var d=[];for(a;0 0; sentenceCount--) { - sentences.push(lorem.sentence()); + sentences.push(this.sentence()); } return sentences.join("\n"); }; Faker.Lorem.paragraph = function (sentenceCount) { if (typeof sentenceCount == 'undefined') { sentenceCount = 3; } - return lorem.sentences(sentenceCount + Faker.random.number(3)); + return this.sentences(sentenceCount + Faker.random.number(3)); }; Faker.Lorem.paragraphs = function (paragraphCount) { if (typeof paragraphCount == 'undefined') { paragraphCount = 3; } var paragraphs = []; for (paragraphCount; paragraphCount > 0; paragraphCount--) { - paragraphs.push(lorem.paragraph()); + paragraphs.push(this.paragraph()); } return paragraphs.join("\n \r\t"); }; @@ -392,87 +392,87 @@ Faker.random.array_element = function (array) { }; Faker.random.city_prefix = function () { - return random.array_element(definitions.city_prefix); + return this.array_element(definitions.city_prefix); }; Faker.random.city_suffix = function () { - return random.array_element(definitions.city_suffix); + return this.array_element(definitions.city_suffix); }; Faker.random.street_suffix = function () { - return random.array_element(definitions.street_suffix); + return this.array_element(definitions.street_suffix); }; Faker.random.br_state = function () { - return random.array_element(definitions.br_state); + return this.array_element(definitions.br_state); }; Faker.random.br_state_abbr = function () { - return random.array_element(definitions.br_state_abbr); + return this.array_element(definitions.br_state_abbr); }; Faker.random.us_state = function () { - return random.array_element(definitions.us_state); + return this.array_element(definitions.us_state); }; Faker.random.us_state_abbr = function () { - return random.array_element(definitions.us_state_abbr); + return this.array_element(definitions.us_state_abbr); }; Faker.random.uk_county = function () { - return random.array_element(definitions.uk_county); + return this.array_element(definitions.uk_county); }; Faker.random.uk_country = function () { - return random.array_element(definitions.uk_country); + return this.array_element(definitions.uk_country); }; Faker.random.first_name = function () { - return random.array_element(definitions.first_name); + return this.array_element(definitions.first_name); }; Faker.random.last_name = function () { - return random.array_element(definitions.last_name); + return this.array_element(definitions.last_name); }; Faker.random.name_prefix = function () { - return random.array_element(definitions.name_prefix); + return this.array_element(definitions.name_prefix); }; Faker.random.name_suffix = function () { - return random.array_element(definitions.name_suffix); + return this.array_element(definitions.name_suffix); }; Faker.random.catch_phrase_adjective = function () { - return random.array_element(definitions.catch_phrase_adjective); + return this.array_element(definitions.catch_phrase_adjective); }; Faker.random.catch_phrase_descriptor = function () { - return random.array_element(definitions.catch_phrase_descriptor); + return this.array_element(definitions.catch_phrase_descriptor); }; Faker.random.catch_phrase_noun = function () { - return random.array_element(definitions.catch_phrase_noun); + return this.array_element(definitions.catch_phrase_noun); }; Faker.random.bs_adjective = function () { - return random.array_element(definitions.bs_adjective); + return this.array_element(definitions.bs_adjective); }; Faker.random.bs_buzz = function () { - return random.array_element(definitions.bs_buzz); + return this.array_element(definitions.bs_buzz); }; Faker.random.bs_noun = function () { - return random.array_element(definitions.bs_noun); + return this.array_element(definitions.bs_noun); }; Faker.random.phone_formats = function () { - return random.array_element(definitions.phone_formats); + return this.array_element(definitions.phone_formats); }; Faker.random.domain_suffix = function () { - return random.array_element(definitions.domain_suffix); + return this.array_element(definitions.domain_suffix); }; Faker.definitions = {}; diff --git a/package.json b/package.json index 1cb1561e5..6da651114 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Faker", "description": "Generate massive amounts of fake contextual data", - "version": "0.5.10", + "version": "0.5.11", "author": "Marak Squires ", "repository": { "type": "git",