diff options
| author | alexpts <[email protected]> | 2017-02-11 09:28:15 +0300 |
|---|---|---|
| committer | alexpts <[email protected]> | 2017-02-11 09:28:15 +0300 |
| commit | 53520a79ba4623199b2e059708806aae01f482db (patch) | |
| tree | 8bed503bdee9f201a0f083d3adf63e064a60e50a /lib | |
| parent | 434b3174b1cd3cf568c06aefbc2e8d000b397adf (diff) | |
| parent | fe2c0fd5cbdb49ec97b51b040a357ec4d6318571 (diff) | |
| download | faker-53520a79ba4623199b2e059708806aae01f482db.tar.xz faker-53520a79ba4623199b2e059708806aae01f482db.zip | |
Merge branch 'master' into patch-1
# Conflicts:
# lib/finance.js
Diffstat (limited to 'lib')
53 files changed, 2414 insertions, 23 deletions
diff --git a/lib/database.js b/lib/database.js new file mode 100644 index 00000000..18e68f85 --- /dev/null +++ b/lib/database.js @@ -0,0 +1,64 @@ +/** + * + * @namespace faker.database + */ +var Database = function (faker) { + var self = this; + /** + * column + * + * @method faker.database.column + */ + self.column = function () { + return faker.random.arrayElement(faker.definitions.database.column); + }; + + self.column.schema = { + "description": "Generates a column name.", + "sampleResults": ["id", "title", "createdAt"] + }; + + /** + * type + * + * @method faker.database.type + */ + self.type = function () { + return faker.random.arrayElement(faker.definitions.database.type); + }; + + self.type.schema = { + "description": "Generates a column type.", + "sampleResults": ["byte", "int", "varchar", "timestamp"] + }; + + /** + * collation + * + * @method faker.database.collation + */ + self.collation = function () { + return faker.random.arrayElement(faker.definitions.database.collation); + }; + + self.collation.schema = { + "description": "Generates a collation.", + "sampleResults": ["utf8_unicode_ci", "utf8_bin"] + }; + + /** + * engine + * + * @method faker.database.engine + */ + self.engine = function () { + return faker.random.arrayElement(faker.definitions.database.engine); + }; + + self.engine.schema = { + "description": "Generates a storage engine.", + "sampleResults": ["MyISAM", "InnoDB"] + }; +}; + +module["exports"] = Database; diff --git a/lib/finance.js b/lib/finance.js index 56b74e8a..87a89411 100644 --- a/lib/finance.js +++ b/lib/finance.js @@ -2,6 +2,7 @@ * @namespace faker.finance */ var Finance = function (faker) { + var ibanLib = require("./iban"); var Helpers = faker.helpers, self = this; @@ -40,14 +41,14 @@ var Finance = function (faker) { * @method faker.finance.mask * @param {number} length * @param {boolean} parens - * @param {boolean} elipsis + * @param {boolean} ellipsis */ - self.mask = function (length, parens, elipsis) { + self.mask = function (length, parens, ellipsis) { //set defaults length = (length == 0 || !length || typeof length == 'undefined') ? 4 : length; parens = (parens === null) ? true : parens; - elipsis = (elipsis === null) ? true : elipsis; + ellipsis = (ellipsis === null) ? true : ellipsis; //create a template for length var template = ''; @@ -56,8 +57,8 @@ var Finance = function (faker) { template = template + '#'; } - //prefix with elipsis - template = (elipsis) ? ['...', template].join('') : template; + //prefix with ellipsis + template = (ellipsis) ? ['...', template].join('') : template; template = (parens) ? ['(', template, ')'].join('') : template; @@ -148,6 +149,71 @@ var Finance = function (faker) { return address; }; + + /** + * iban + * + * @method faker.finance.iban + */ + self.iban = function (formatted) { + var ibanFormat = faker.random.arrayElement(ibanLib.formats); + var s = ""; + var count = 0; + for (var b = 0; b < ibanFormat.bban.length; b++) { + var bban = ibanFormat.bban[b]; + var c = bban.count; + count += bban.count; + while (c > 0) { + if (bban.type == "a") { + s += faker.random.arrayElement(ibanLib.alpha); + } else if (bban.type == "c") { + if (faker.random.number(100) < 80) { + s += faker.random.number(9); + } else { + s += faker.random.arrayElement(ibanLib.alpha); + } + } else { + if (c >= 3 && faker.random.number(100) < 30) { + if (faker.random.boolean()) { + s += faker.random.arrayElement(ibanLib.pattern100); + c -= 2; + } else { + s += faker.random.arrayElement(ibanLib.pattern10); + c--; + } + } else { + s += faker.random.number(9); + } + } + c--; + } + s = s.substring(0, count); + } + var checksum = 98 - ibanLib.mod97(ibanLib.toDigitString(s + ibanFormat.country + "00")); + if (checksum < 10) { + checksum = "0" + checksum; + } + var iban = ibanFormat.country + checksum + s; + return formatted ? iban.match(/.{1,4}/g).join(" ") : iban; + }; + + /** + * bic + * + * @method faker.finance.bic + */ + self.bic = function () { + var vowels = ["A", "E", "I", "O", "U"]; + var prob = faker.random.number(100); + return Helpers.replaceSymbols("???") + + faker.random.arrayElement(vowels) + + faker.random.arrayElement(ibanLib.iso3166) + + Helpers.replaceSymbols("?") + "1" + + (prob < 10 ? + Helpers.replaceSymbols("?" + faker.random.arrayElement(vowels) + "?") : + prob < 40 ? + Helpers.replaceSymbols("###") : ""); + }; }; module['exports'] = Finance; diff --git a/lib/helpers.js b/lib/helpers.js index cec043bc..635c4ecc 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -61,14 +61,14 @@ var Helpers = function (faker) { */ self.replaceSymbols = function (string) { string = string || ""; - var alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] + var alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] var str = ''; for (var i = 0; i < string.length; i++) { if (string.charAt(i) == "#") { str += faker.random.number(9); - } else if (string.charAt(i) == "?") { - str += faker.random.arrayElement(alpha); + } else if (string.charAt(i) == "?") { + str += faker.random.arrayElement(alpha); } else { str += string.charAt(i); } @@ -83,7 +83,7 @@ var Helpers = function (faker) { * @param {array} o */ self.shuffle = function (o) { - if (o.length === 0) { + if (typeof o === 'undefined' || o.length === 0) { return []; } o = o || ["a", "b", "c"]; diff --git a/lib/iban.js b/lib/iban.js new file mode 100644 index 00000000..92cd08b0 --- /dev/null +++ b/lib/iban.js @@ -0,0 +1,1136 @@ +module["exports"] = { + alpha: [ + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' + ], + pattern10: [ + "01", "02", "03", "04", "05", "06", "07", "08", "09" + ], + pattern100: [ + "001", "002", "003", "004", "005", "006", "007", "008", "009" + ], + toDigitString: function (str) { + return str.replace(/[A-Z]/gi, function(match) { + return match.toUpperCase().charCodeAt(0) - 55; + }); + }, + mod97: function (digitStr) { + var m = 0; + for (var i = 0; i < digitStr.length; i++) { + m = ((m * 10) + (digitStr[i] |0)) % 97; + } + return m; + }, + formats: [ + { + country: "AL", + total: 28, + bban: [ + { + type: "n", + count: 8 + }, + { + type: "c", + count: 16 + } + ], + format: "ALkk bbbs sssx cccc cccc cccc cccc" + }, + { + country: "AD", + total: 24, + bban: [ + { + type: "n", + count: 8 + }, + { + type: "c", + count: 12 + } + ], + format: "ADkk bbbb ssss cccc cccc cccc" + }, + { + country: "AT", + total: 20, + bban: [ + { + type: "n", + count: 5 + }, + { + type: "n", + count: 11 + } + ], + format: "ATkk bbbb bccc cccc cccc" + }, + { + country: "AZ", + total: 28, + bban: [ + { + type: "c", + count: 4 + }, + { + type: "n", + count: 20 + } + ], + format: "AZkk bbbb cccc cccc cccc cccc cccc" + }, + { + country: "BH", + total: 22, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "c", + count: 14 + } + ], + format: "BHkk bbbb cccc cccc cccc cc" + }, + { + country: "BE", + total: 16, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "n", + count: 9 + } + ], + format: "BEkk bbbc cccc ccxx" + }, + { + country: "BA", + total: 20, + bban: [ + { + type: "n", + count: 6 + }, + { + type: "n", + count: 10 + } + ], + format: "BAkk bbbs sscc cccc ccxx" + }, + { + country: "BR", + total: 29, + bban: [ + { + type: "n", + count: 13 + }, + { + type: "n", + count: 10 + }, + { + type: "a", + count: 1 + }, + { + type: "c", + count: 1 + } + ], + format: "BRkk bbbb bbbb ssss sccc cccc ccct n" + }, + { + country: "BG", + total: 22, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "n", + count: 6 + }, + { + type: "c", + count: 8 + } + ], + format: "BGkk bbbb ssss ddcc cccc cc" + }, + { + country: "CR", + total: 21, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "n", + count: 14 + } + ], + format: "CRkk bbbc cccc cccc cccc c" + }, + { + country: "HR", + total: 21, + bban: [ + { + type: "n", + count: 7 + }, + { + type: "n", + count: 10 + } + ], + format: "HRkk bbbb bbbc cccc cccc c" + }, + { + country: "CY", + total: 28, + bban: [ + { + type: "n", + count: 8 + }, + { + type: "c", + count: 16 + } + ], + format: "CYkk bbbs ssss cccc cccc cccc cccc" + }, + { + country: "CZ", + total: 24, + bban: [ + { + type: "n", + count: 10 + }, + { + type: "n", + count: 10 + } + ], + format: "CZkk bbbb ssss sscc cccc cccc" + }, + { + country: "DK", + total: 18, + bban: [ + { + type: "n", + count: 4 + }, + { + type: "n", + count: 10 + } + ], + format: "DKkk bbbb cccc cccc cc" + }, + { + country: "DO", + total: 28, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "n", + count: 20 + } + ], + format: "DOkk bbbb cccc cccc cccc cccc cccc" + }, + { + country: "TL", + total: 23, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "n", + count: 16 + } + ], + format: "TLkk bbbc cccc cccc cccc cxx" + }, + { + country: "EE", + total: 20, + bban: [ + { + type: "n", + count: 4 + }, + { + type: "n", + count: 12 + } + ], + format: "EEkk bbss cccc cccc cccx" + }, + { + country: "FO", + total: 18, + bban: [ + { + type: "n", + count: 4 + }, + { + type: "n", + count: 10 + } + ], + format: "FOkk bbbb cccc cccc cx" + }, + { + country: "FI", + total: 18, + bban: [ + { + type: "n", + count: 6 + }, + { + type: "n", + count: 8 + } + ], + format: "FIkk bbbb bbcc cccc cx" + }, + { + country: "FR", + total: 27, + bban: [ + { + type: "n", + count: 10 + }, + { + type: "c", + count: 11 + }, + { + type: "n", + count: 2 + } + ], + format: "FRkk bbbb bggg ggcc cccc cccc cxx" + }, + { + country: "GE", + total: 22, + bban: [ + { + type: "c", + count: 2 + }, + { + type: "n", + count: 16 + } + ], + format: "GEkk bbcc cccc cccc cccc cc" + }, + { + country: "DE", + total: 22, + bban: [ + { + type: "n", + count: 8 + }, + { + type: "n", + count: 10 + } + ], + format: "DEkk bbbb bbbb cccc cccc cc" + }, + { + country: "GI", + total: 23, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "c", + count: 15 + } + ], + format: "GIkk bbbb cccc cccc cccc ccc" + }, + { + country: "GR", + total: 27, + bban: [ + { + type: "n", + count: 7 + }, + { + type: "c", + count: 16 + } + ], + format: "GRkk bbbs sssc cccc cccc cccc ccc" + }, + { + country: "GL", + total: 18, + bban: [ + { + type: "n", + count: 4 + }, + { + type: "n", + count: 10 + } + ], + format: "GLkk bbbb cccc cccc cc" + }, + { + country: "GT", + total: 28, + bban: [ + { + type: "c", + count: 4 + }, + { + type: "c", + count: 4 + }, + { + type: "c", + count: 16 + } + ], + format: "GTkk bbbb mmtt cccc cccc cccc cccc" + }, + { + country: "HU", + total: 28, + bban: [ + { + type: "n", + count: 8 + }, + { + type: "n", + count: 16 + } + ], + format: "HUkk bbbs sssk cccc cccc cccc cccx" + }, + { + country: "IS", + total: 26, + bban: [ + { + type: "n", + count: 6 + }, + { + type: "n", + count: 16 + } + ], + format: "ISkk bbbb sscc cccc iiii iiii ii" + }, + { + country: "IE", + total: 22, + bban: [ + { + type: "c", + count: 4 + }, + { + type: "n", + count: 6 + }, + { + type: "n", + count: 8 + } + ], + format: "IEkk aaaa bbbb bbcc cccc cc" + }, + { + country: "IL", + total: 23, + bban: [ + { + type: "n", + count: 6 + }, + { + type: "n", + count: 13 + } + ], + format: "ILkk bbbn nncc cccc cccc ccc" + }, + { + country: "IT", + total: 27, + bban: [ + { + type: "a", + count: 1 + }, + { + type: "n", + count: 10 + }, + { + type: "c", + count: 12 + } + ], + format: "ITkk xaaa aabb bbbc cccc cccc ccc" + }, + { + country: "JO", + total: 30, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "n", + count: 4 + }, + { + type: "n", + count: 18 + } + ], + format: "JOkk bbbb nnnn cccc cccc cccc cccc cc" + }, + { + country: "KZ", + total: 20, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "c", + count: 13 + } + ], + format: "KZkk bbbc cccc cccc cccc" + }, + { + country: "XK", + total: 20, + bban: [ + { + type: "n", + count: 4 + }, + { + type: "n", + count: 12 + } + ], + format: "XKkk bbbb cccc cccc cccc" + }, + { + country: "KW", + total: 30, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "c", + count: 22 + } + ], + format: "KWkk bbbb cccc cccc cccc cccc cccc cc" + }, + { + country: "LV", + total: 21, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "c", + count: 13 + } + ], + format: "LVkk bbbb cccc cccc cccc c" + }, + { + country: "LB", + total: 28, + bban: [ + { + type: "n", + count: 4 + }, + { + type: "c", + count: 20 + } + ], + format: "LBkk bbbb cccc cccc cccc cccc cccc" + }, + { + country: "LI", + total: 21, + bban: [ + { + type: "n", + count: 5 + }, + { + type: "c", + count: 12 + } + ], + format: "LIkk bbbb bccc cccc cccc c" + }, + { + country: "LT", + total: 20, + bban: [ + { + type: "n", + count: 5 + }, + { + type: "n", + count: 11 + } + ], + format: "LTkk bbbb bccc cccc cccc" + }, + { + country: "LU", + total: 20, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "c", + count: 13 + } + ], + format: "LUkk bbbc cccc cccc cccc" + }, + { + country: "MK", + total: 19, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "c", + count: 10 + }, + { + type: "n", + count: 2 + } + ], + format: "MKkk bbbc cccc cccc cxx" + }, + { + country: "MT", + total: 31, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "n", + count: 5 + }, + { + type: "c", + count: 18 + } + ], + format: "MTkk bbbb ssss sccc cccc cccc cccc ccc" + }, + { + country: "MR", + total: 27, + bban: [ + { + type: "n", + count: 10 + }, + { + type: "n", + count: 13 + } + ], + format: "MRkk bbbb bsss sscc cccc cccc cxx" + }, + { + country: "MU", + total: 30, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "n", + count: 4 + }, + { + type: "n", + count: 15 + }, + { + type: "a", + count: 3 + } + ], + format: "MUkk bbbb bbss cccc cccc cccc 000d dd" + }, + { + country: "MC", + total: 27, + bban: [ + { + type: "n", + count: 10 + }, + { + type: "c", + count: 11 + }, + { + type: "n", + count: 2 + } + ], + format: "MCkk bbbb bsss sscc cccc cccc cxx" + }, + { + country: "MD", + total: 24, + bban: [ + { + type: "c", + count: 2 + }, + { + type: "c", + count: 18 + } + ], + format: "MDkk bbcc cccc cccc cccc cccc" + }, + { + country: "ME", + total: 22, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "n", + count: 15 + } + ], + format: "MEkk bbbc cccc cccc cccc xx" + }, + { + country: "NL", + total: 18, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "n", + count: 10 + } + ], + format: "NLkk bbbb cccc cccc cc" + }, + { + country: "NO", + total: 15, + bban: [ + { + type: "n", + count: 4 + }, + { + type: "n", + count: 7 + } + ], + format: "NOkk bbbb cccc ccx" + }, + { + country: "PK", + total: 24, + bban: [ + { + type: "c", + count: 4 + }, + { + type: "n", + count: 16 + } + ], + format: "PKkk bbbb cccc cccc cccc cccc" + }, + { + country: "PS", + total: 29, + bban: [ + { + type: "c", + count: 4 + }, + { + type: "n", + count: 9 + }, + { + type: "n", + count: 12 + } + ], + format: "PSkk bbbb xxxx xxxx xccc cccc cccc c" + }, + { + country: "PL", + total: 28, + bban: [ + { + type: "n", + count: 8 + }, + { + type: "n", + count: 16 + } + ], + format: "PLkk bbbs sssx cccc cccc cccc cccc" + }, + { + country: "PT", + total: 25, + bban: [ + { + type: "n", + count: 8 + }, + { + type: "n", + count: 13 + } + ], + format: "PTkk bbbb ssss cccc cccc cccx x" + }, + { + country: "QA", + total: 29, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "c", + count: 21 + } + ], + format: "QAkk bbbb cccc cccc cccc cccc cccc c" + }, + { + country: "RO", + total: 24, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "c", + count: 16 + } + ], + format: "ROkk bbbb cccc cccc cccc cccc" + }, + { + country: "SM", + total: 27, + bban: [ + { + type: "a", + count: 1 + }, + { + type: "n", + count: 10 + }, + { + type: "c", + count: 12 + } + ], + format: "SMkk xaaa aabb bbbc cccc cccc ccc" + }, + { + country: "SA", + total: 24, + bban: [ + { + type: "n", + count: 2 + }, + { + type: "c", + count: 18 + } + ], + format: "SAkk bbcc cccc cccc cccc cccc" + }, + { + country: "RS", + total: 22, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "n", + count: 15 + } + ], + format: "RSkk bbbc cccc cccc cccc xx" + }, + { + country: "SK", + total: 24, + bban: [ + { + type: "n", + count: 10 + }, + { + type: "n", + count: 10 + } + ], + format: "SKkk bbbb ssss sscc cccc cccc" + }, + { + country: "SI", + total: 19, + bban: [ + { + type: "n", + count: 5 + }, + { + type: "n", + count: 10 + } + ], + format: "SIkk bbss sccc cccc cxx" + }, + { + country: "ES", + total: 24, + bban: [ + { + type: "n", + count: 10 + }, + { + type: "n", + count: 10 + } + ], + format: "ESkk bbbb gggg xxcc cccc cccc" + }, + { + country: "SE", + total: 24, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "n", + count: 17 + } + ], + format: "SEkk bbbc cccc cccc cccc cccc" + }, + { + country: "CH", + total: 21, + bban: [ + { + type: "n", + count: 5 + }, + { + type: "c", + count: 12 + } + ], + format: "CHkk bbbb bccc cccc cccc c" + }, + { + country: "TN", + total: 24, + bban: [ + { + type: "n", + count: 5 + }, + { + type: "n", + count: 15 + } + ], + format: "TNkk bbss sccc cccc cccc cccc" + }, + { + country: "TR", + total: 26, + bban: [ + { + type: "n", + count: 5 + }, + { + type: "c", + count: 1 + }, + { + type: "c", + count: 16 + } + ], + format: "TRkk bbbb bxcc cccc cccc cccc cc" + }, + { + country: "AE", + total: 23, + bban: [ + { + type: "n", + count: 3 + }, + { + type: "n", + count: 16 + } + ], + format: "AEkk bbbc cccc cccc cccc ccc" + }, + { + country: "GB", + total: 22, + bban: [ + { + type: "a", + count: 4 + }, + { + type: "n", + count: 6 + }, + { + type: "n", + count: 8 + } + ], + format: "GBkk bbbb ssss sscc cccc cc" + }, + { + country: "VG", + total: 24, + bban: [ + { + type: "c", + count: 4 + }, + { + type: "n", + count: 16 + } + ], + format: "VGkk bbbb cccc cccc cccc cccc" + } + ], + iso3166: [ + "AC", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", + "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", + "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BU", "BV", "BW", "BY", + "BZ", "CA", "CC", "CD", "CE", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", + "CO", "CP", "CR", "CS", "CS", "CU", "CV", "CW", "CX", "CY", "CZ", "DD", "DE", + "DG", "DJ", "DK", "DM", "DO", "DZ", "EA", "EC", "EE", "EG", "EH", "ER", "ES", + "ET", "EU", "FI", "FJ", "FK", "FM", "FO", "FR", "FX", "GA", "GB", "GD", "GE", + "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", + "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "IC", "ID", "IE", "IL", "IM", + "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", + "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", + "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", + "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", + "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", + "NT", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", + "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", + "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", + "SS", "ST", "SU", "SV", "SX", "SY", "SZ", "TA", "TC", "TD", "TF", "TG", "TH", + "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", + "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", + "YE", "YT", "YU", "ZA", "ZM", "ZR", "ZW" + ] +}
\ No newline at end of file diff --git a/lib/index.js b/lib/index.js index ed0a664b..306275dc 100644 --- a/lib/index.js +++ b/lib/index.js @@ -42,7 +42,7 @@ function Faker (opts) { self.fake = new Fake(self).fake; var Random = require('./random'); - self.random = new Random(self); + self.random = new Random(self, opts.seed); // self.random = require('./random'); var Helpers = require('./helpers'); @@ -73,6 +73,9 @@ function Faker (opts) { var Internet = require('./internet'); self.internet = new Internet(self); + var Database = require('./database'); + self.database = new Database(self); + var Phone = require('./phone_number'); self.phone = new Phone(self); @@ -92,16 +95,17 @@ function Faker (opts) { "lorem": ["words"], "hacker": ["abbreviation", "adjective", "noun", "verb", "ingverb"], "phone_number": ["formats"], - "finance": ["account_type", "transaction_type", "currency"], + "finance": ["account_type", "transaction_type", "currency", "iban"], "internet": ["avatar_uri", "domain_suffix", "free_email", "example_email", "password"], "commerce": ["color", "department", "product_name", "price", "categories"], + "database": ["collation", "column", "engine", "type"], "system": ["mimeTypes"], "date": ["month", "weekday"], "title": "", "separator": "" }; - // Create a Getter for all definitions.foo.bar propetries + // Create a Getter for all definitions.foo.bar properties Object.keys(_definitions).forEach(function(d){ if (typeof self.definitions[d] === "undefined") { self.definitions[d] = {}; @@ -117,7 +121,7 @@ function Faker (opts) { get: function () { if (typeof self.locales[self.locale][d] === "undefined" || typeof self.locales[self.locale][d][p] === "undefined") { // certain localization sets contain less data then others. - // in the case of a missing defintion, use the default localeFallback to substitute the missing set data + // in the case of a missing definition, use the default localeFallback to substitute the missing set data // throw new Error('unknown property ' + d + p) return self.locales[localeFallback][d][p]; } else { diff --git a/lib/internet.js b/lib/internet.js index 4b0bfd8a..0de5ef65 100644 --- a/lib/internet.js +++ b/lib/internet.js @@ -1,5 +1,4 @@ -var password_generator = require('../vendor/password-generator.js'), - random_ua = require('../vendor/user-agent'); +var random_ua = require('../vendor/user-agent'); /** * @@ -332,13 +331,56 @@ var Internet = function (faker) { * @param {string} pattern * @param {string} prefix */ - self.password = function (len, memorable, pattern, prefix) { - len = len || 15; - if (typeof memorable === "undefined") { - memorable = false; - } - return password_generator(len, memorable, pattern, prefix); - } + self.password = function (len, memorable, pattern, prefix) { + len = len || 15; + if (typeof memorable === "undefined") { + memorable = false; + } + /* + * password-generator ( function ) + * Copyright(c) 2011-2013 Bermi Ferrer <[email protected]> + * MIT Licensed + */ + var consonant, letter, password, vowel; + letter = /[a-zA-Z]$/; + vowel = /[aeiouAEIOU]$/; + consonant = /[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/; + var _password = function (length, memorable, pattern, prefix) { + var char, n; + if (length == null) { + length = 10; + } + if (memorable == null) { + memorable = true; + } + if (pattern == null) { + pattern = /\w/; + } + if (prefix == null) { + prefix = ''; + } + if (prefix.length >= length) { + return prefix; + } + if (memorable) { + if (prefix.match(consonant)) { + pattern = vowel; + } else { + pattern = consonant; + } + } + n = faker.random.number(94) + 33; + char = String.fromCharCode(n); + if (memorable) { + char = char.toLowerCase(); + } + if (!char.match(pattern)) { + return _password(length, memorable, pattern, prefix); + } + return _password(length, memorable, pattern, "" + prefix + char); + }; + return _password(len, memorable, pattern, prefix); + } self.password.schema = { "description": "Generates a random password.", diff --git a/lib/locales.js b/lib/locales.js index 77b1bff1..8ff2d025 100644 --- a/lib/locales.js +++ b/lib/locales.js @@ -1,3 +1,4 @@ +exports['az'] = require('./locales/az'); exports['cz'] = require('./locales/cz'); exports['de'] = require('./locales/de'); exports['de_AT'] = require('./locales/de_AT'); diff --git a/lib/locales/az/address/building_number.js b/lib/locales/az/address/building_number.js new file mode 100644 index 00000000..401fa206 --- /dev/null +++ b/lib/locales/az/address/building_number.js @@ -0,0 +1,3 @@ +module["exports"] = [ + "###" +]; diff --git a/lib/locales/az/address/city.js b/lib/locales/az/address/city.js new file mode 100644 index 00000000..841b37dc --- /dev/null +++ b/lib/locales/az/address/city.js @@ -0,0 +1,3 @@ +module["exports"] = [ + "#{Address.city_name}" +]; diff --git a/lib/locales/az/address/city_name.js b/lib/locales/az/address/city_name.js new file mode 100644 index 00000000..26df6a2e --- /dev/null +++ b/lib/locales/az/address/city_name.js @@ -0,0 +1,80 @@ +module["exports"] = [ + "Ağcabədi", + "Ağdam", + "Ağdaş", + "Ağdərə", + "Ağstafa", + "Ağsu", + "Astara", + "Bakı", + "Balakən", + "Beyləqan", + "Bərdə", + "Biləsuvar", + "Cəbrayıl", + "Cəlilabad", + "Culfa", + "Daşkəsən", + "Dəliməmmədli", + "Füzuli", + "Gədəbəy", + "Gəncə", + "Goranboy", + "Göyçay", + "Göygöl", + "Göytəpə", + "Hacıqabul", + "Horadiz", + "Xaçmaz", + "Xankəndi", + "Xocalı", + "Xocavənd", + "Xırdalan", + "Xızı", + "Xudat", + "İmişli", + "İsmayıllı", + "Kəlbəcər", + "Kürdəmir", + "Qax", + "Qazax", + "Qəbələ", + "Qobustan", + "Qovlar", + "Quba", + "Qubadlı", + "Qusar", + "Laçın", + "Lerik", + "Lənkəran", + "Liman", + "Masallı", + "Mingəçevir", + "Naftalan", + "Naxçıvan (şəhər)", + "Neftçala", + "Oğuz", + "Ordubad", + "Saatlı", + "Sabirabad", + "Salyan", + "Samux", + "Siyəzən", + "Sumqayıt", + "Şabran", + "Şahbuz", + "Şamaxı", + "Şəki", + "Şəmkir", + "Şərur", + "Şirvan", + "Şuşa", + "Tərtər", + "Tovuz", + "Ucar", + "Yardımlı", + "Yevlax", + "Zaqatala", + "Zəngilan", + "Zərdab" +]; diff --git a/lib/locales/az/address/country.js b/lib/locales/az/address/country.js new file mode 100644 index 00000000..08908316 --- /dev/null +++ b/lib/locales/az/address/country.js @@ -0,0 +1,241 @@ +module["exports"] = [ + "Akrotiri və Dekeliya", + "Aland adaları", + "Albaniya", + "Almaniya", + "Amerika Samoası", + "Andorra", + "Angilya", + "Anqola", + "Antiqua və Barbuda", + "Argentina", + "Aruba", + "Avstraliya", + "Avstriya", + "Azərbaycan", + "Baham adaları", + "Banqladeş", + "Barbados", + "Belçika", + "Beliz", + "Belarus", + "Benin", + "Bermud adaları", + "BƏƏ", + "ABŞ", + "Boliviya", + "Bolqarıstan", + "Bosniya və Herseqovina", + "Botsvana", + "Böyük Britaniya", + "Braziliya", + "Bruney", + "Burkina-Faso", + "Burundi", + "Butan", + "Bəhreyn", + "Cersi", + "Cəbəli-Tariq", + "CAR", + "Cənubi Sudan", + "Cənubi Koreya", + "Cibuti", + "Çad", + "Çexiya", + "Monteneqro", + "Çili", + "ÇXR", + "Danimarka", + "Dominika", + "Dominikan Respublikası", + "Efiopiya", + "Ekvador", + "Ekvatorial Qvineya", + "Eritreya", + "Ermənistan", + "Estoniya", + "Əfqanıstan", + "Əlcəzair", + "Farer adaları", + "Fələstin Dövləti", + "Fici", + "Kot-d’İvuar", + "Filippin", + "Finlandiya", + "Folklend adaları", + "Fransa", + "Fransa Polineziyası", + "Gernsi", + "Gürcüstan", + "Haiti", + "Hindistan", + "Honduras", + "Honkonq", + "Xorvatiya", + "İndoneziya", + "İordaniya", + "İraq", + "İran", + "İrlandiya", + "İslandiya", + "İspaniya", + "İsrail", + "İsveç", + "İsveçrə", + "İtaliya", + "Kabo-Verde", + "Kamboca", + "Kamerun", + "Kanada", + "Kayman adaları", + "Keniya", + "Kipr", + "Kiribati", + "Kokos adaları", + "Kolumbiya", + "Komor adaları", + "Konqo Respublikası", + "KDR", + "Kosovo", + "Kosta-Rika", + "Kuba", + "Kuk adaları", + "Küveyt", + "Qabon", + "Qambiya", + "Qana", + "Qətər", + "Qayana", + "Qazaxıstan", + "Qərbi Sahara", + "Qırğızıstan", + "Qrenada", + "Qrenlandiya", + "Quam", + "Qvatemala", + "Qvineya", + "Qvineya-Bisau", + "Laos", + "Latviya", + "Lesoto", + "Liberiya", + "Litva", + "Livan", + "Liviya", + "Lixtenşteyn", + "Lüksemburq", + "Macarıstan", + "Madaqaskar", + "Makao", + "Makedoniya", + "Malavi", + "Malayziya", + "Maldiv adaları", + "Mali", + "Malta", + "Marşall adaları", + "Mavriki", + "Mavritaniya", + "Mayotta", + "Meksika", + "Men adası", + "Mərakeş", + "MAR", + "Mikroneziya", + "Milad adası", + "Misir", + "Myanma", + "Moldova", + "Monako", + "Monqolustan", + "Montserrat", + "Mozambik", + "Müqəddəs Yelena, Askenson və Tristan-da-Kunya adaları", + "Namibiya", + "Nauru", + "Nepal", + "Niderland", + "Niderland Antil adaları", + "Niger", + "Nigeriya", + "Nikaraqua", + "Niue", + "Norfolk adası", + "Norveç", + "Oman", + "Özbəkistan", + "Pakistan", + "Palau", + "Panama", + "Papua-Yeni Qvineya", + "Paraqvay", + "Peru", + "Pitkern adaları", + "Polşa", + "Portuqaliya", + "Prednestroviya", + "Puerto-Riko", + "Ruanda", + "Rumıniya", + "Rusiya", + "Salvador", + "Samoa", + "San-Marino", + "San-Tome və Prinsipi", + "Seneqal", + "Sen-Bartelemi", + "Sent-Kits və Nevis", + "Sent-Lüsiya", + "Sen-Marten", + "Sen-Pyer və Mikelon", + "Sent-Vinsent və Qrenadina", + "Serbiya", + "Seyşel adaları", + "Səudiyyə Ərəbistanı", + "Sinqapur", + "Slovakiya", + "Sloveniya", + "Solomon adaları", + "Somali", + "Somalilend", + "Sudan", + "Surinam", + "Suriya", + "Svazilend", + "Syerra-Leone", + "Şərqi Timor", + "Şimali Marian adaları", + "Şpisbergen və Yan-Mayen", + "Şri-Lanka", + "Tacikistan", + "Tanzaniya", + "Tailand", + "Çin Respublikası", + "Törks və Kaykos adaları", + "Tokelau", + "Tonqa", + "Toqo", + "Trinidad və Tobaqo", + "Tunis", + "Tuvalu", + "Türkiyə", + "Türkmənistan", + "Ukrayna", + "Uollis və Futuna", + "Uqanda", + "Uruqvay", + "Vanuatu", + "Vatikan", + "Venesuela", + "Amerika Virgin adaları", + "Britaniya Virgin adaları", + "Vyetnam", + "Yamayka", + "Yaponiya", + "Yeni Kaledoniya", + "Yeni Zelandiya", + "Yəmən", + "Yunanıstan", + "Zambiya", + "Zimbabve" +]; diff --git a/lib/locales/az/address/default_country.js b/lib/locales/az/address/default_country.js new file mode 100644 index 00000000..25857898 --- /dev/null +++ b/lib/locales/az/address/default_country.js @@ -0,0 +1,3 @@ +module["exports"] = [ + "Azərbaycan" +]; diff --git a/lib/locales/az/address/index.js b/lib/locales/az/address/index.js new file mode 100644 index 00000000..0dd71270 --- /dev/null +++ b/lib/locales/az/address/index.js @@ -0,0 +1,14 @@ +var address = {}; +module['exports'] = address; +address.country = require("./country"); +address.building_number = require("./building_number"); +address.street_suffix = require("./street_suffix"); +address.secondary_address = require("./secondary_address"); +address.postcode = require("./postcode"); +address.state = require("./state"); +address.street_title = require("./street_title"); +address.city_name = require("./city_name"); +address.city = require("./city"); +address.street_name = require("./street_name"); +address.street_address = require("./street_address"); +address.default_country = require("./default_country"); diff --git a/lib/locales/az/address/postcode.js b/lib/locales/az/address/postcode.js new file mode 100644 index 00000000..1b57b699 --- /dev/null +++ b/lib/locales/az/address/postcode.js @@ -0,0 +1,3 @@ +module["exports"] = [ + "AZ####" +]; diff --git a/lib/locales/az/address/secondary_address.js b/lib/locales/az/address/secondary_address.js new file mode 100644 index 00000000..862bf14f --- /dev/null +++ b/lib/locales/az/address/secondary_address.js @@ -0,0 +1,3 @@ +module["exports"] = [ + "m. ###" +]; diff --git a/lib/locales/az/address/state.js b/lib/locales/az/address/state.js new file mode 100644 index 00000000..4b06d3fa --- /dev/null +++ b/lib/locales/az/address/state.js @@ -0,0 +1,3 @@ +module["exports"] = [ + +]; diff --git a/lib/locales/az/address/street_address.js b/lib/locales/az/address/street_address.js new file mode 100644 index 00000000..5b311286 --- /dev/null +++ b/lib/locales/az/address/street_address.js @@ -0,0 +1,3 @@ +module["exports"] = [ + "#{street_name}, #{building_number}" +]; diff --git a/lib/locales/az/address/street_name.js b/lib/locales/az/address/street_name.js new file mode 100644 index 00000000..6e8ceb6d --- /dev/null +++ b/lib/locales/az/address/street_name.js @@ -0,0 +1,4 @@ +module["exports"] = [ + "#{street_suffix} #{Address.street_title}", + "#{Address.street_title} #{street_suffix}" +]; diff --git a/lib/locales/az/address/street_suffix.js b/lib/locales/az/address/street_suffix.js new file mode 100644 index 00000000..f9da8102 --- /dev/null +++ b/lib/locales/az/address/street_suffix.js @@ -0,0 +1,8 @@ +module["exports"] = [ + "küç.", + "küçəsi", + "prospekti", + "pr.", + "sahəsi", + "sh." +]; diff --git a/lib/locales/az/address/street_title.js b/lib/locales/az/address/street_title.js new file mode 100644 index 00000000..a0a8349c --- /dev/null +++ b/lib/locales/az/address/street_title.js @@ -0,0 +1,237 @@ +module["exports"] = [ + "Abbas Fətullayev", + "Abbas Mirzə Şərifzadə", + "Abbas Səhhət", + "Abdulla Şaiq", + "Afiyəddin Cəlilov", + "Axundov", + "Ağa Nemətulla", + "Ağadadaş Qurbanov", + "Akademik Həsən Əliyev", + "Akademik Lətif İmanov", + "Alı Mustafayev", + "Almas İldırım", + "Asəf Zeynallı", + "Asif Əsədullayev", + "Aşıq Alı", + "Aşıq Ələsgər", + "Azadlıq prospekti", + "Bakıxanov", + "Balababa Məcidov", + "Balaəmi Dadaşov", + "Behbud Şaxtantinski", + "Bəkir Çobanzadə", + "Bəsti Bağırova", + "Bəşir Səfəroğlu", + "Böyük Qala", + "Cabir Əliyev", + "Camal Hacıəliyev", + "Cavadxan", + "Cavanşir", + "Ceyhun Səlimov", + "Ceyhunbəy Hacıbəyli", + "Cəbiyev", + "Cəfər Xəndan", + "Cəfər Cabbarlı", + "Cəlal Qurbanov", + "Cəlil Məmmədquluzadə", + "Çingiz Mustafayev", + "Çobanzadə", + "Dadaş Bünyadzadə", + "Dağlı Yunus", + "Dilarə Əliyeva", + "Elçin Əzimov", + "Eldar və Abdulla Əlibəyovlar", + "Elxan Həsənov", + "Elşən Mehdiyev", + "Elşən Süleymanov", + "Etibar Bəkirov", + "Əbdüləzəl Dəmirçizadə", + "Əbdülhəsən Anaplı", + "Əbdülkərim Əlizadə", + "Əhməd bəy Ağaoğlu", + "Əhməd Cavad", + "Əhməd Cəmil", + "Əhməd Mehbalıyev", + "Əhməd Rəcəbli", + "Əjdər Xanbabayev", + "Əkrəm Cəfərov", + "Ələsgər Qayıbov", + "Əliağa Vahid", + "Əli Bəy Hüseynzadə", + "Əlimərdan bəy Topçubaşov", + "Əliyar Əliyev", + "Əlövsət Abdulrəhimov", + "Əlövsət Quliyev", + "Əmir Bağırov", + "Əsəd Əhmədov", + "Əşrəf Yunusov", + "Əzim Əzimzadə", + "Əziz Əliyev", + "Heybət Heybətov", + "Həqiqət Rzayeva", + "Həmid Araslı", + "Hənifə Ələsgərova", + "Hərbçilər", + "Həsənoğu", + "Həsən Seyidbəyli", + "Hətəm Allahverdiyev", + "Həzi Aslanov", + "Hüsü Hacıyev", + "Hüseynqulu Sarabski", + "Fətəli xan Xoyski", + "Fəzail Bayramov", + "Fikrət Əmirov", + "Fuad İbrahimbəyov", + "Fuad Yusifov", + "General Əliağa Şıxlinski", + "Gülayə Qədirbəyova", + "Gənclik", + "Xaqani", + "Xan Şuşinski", + "Xanlar", + "Xudu Məmmədov", + "İbrahimpaşa Dadaşov", + "İdris Süleymanov", + "İlqar Abbasov", + "İlqar İsmayılov", + "İmran Qasımov", + "İnqilab İsmayılov", + "İsfəndiyar Zülalov", + "İslam Abışov", + "İslam Səfərli", + "İsmayıl bəy Qutqaşınlı", + "İsmayıl Mirzəgülov", + "İstiqlaliyyət", + "28 May", + "İsgəndərov", + "İvan Turgenev", + "İzmir", + "İzzət Həmidov", + "İzzət Orucova", + "Kamal Rəhimov", + "Kazım Kazımzadə", + "Kazımağa Kərimov", + "Kərəm İsmayılov", + "Kiçik Qala", + "Koroğlu Rəhimov", + "Qaçaq Nəbi", + "Qarabağ", + "Qədirbəyov", + "Qəzənfər Musabəyov", + "Qəzənfər Vəliyev", + "Leyla Məmmədbəyova", + "Mahmud İbrahimov", + "Malik Məmmədov", + "Mehdi Abbasov", + "Mehdi Mehdizadə", + "Məhəmməd Əmin Rəsulzadə", + "Məhəmməd Hadi", + "Məhəmməd Xiyabani", + "Məhəmməd ibn Hinduşah Naxçıvani", + "Məhsəti Gəncəvi", + "Məmmədyarov", + "Mərdanov qardaşları", + "Mətləb Ağayev", + "Məşədi Hilal", + "Məzahir Rüstəmov", + "Mikayıl Müşviq", + "Mingəçevir", + "Mirəli Qaşqay", + "Mirəli Seyidov", + "Mirzağa Əliyev", + "Mirzə İbrahimov", + "Mirzə Mənsur", + "Mirzə Mustafayev", + "Murtuza Muxtarov", + "Mustafa Topçubaşov", + "Müqtədir Aydınbəyov", + "Müslüm Maqomayev", + "Müzəffər Həsənov", + "Nabat Aşurbəyova", + "Naxçıvani", + "Naximov", + "Nazim İsmaylov", + "Neapol", + "Neftçi Qurban Abbasov", + "Neftçilər prospekti", + "Nəcəfbəy Vəzirov", + "Nəcəfqulu Rəfiyev", + "Nəriman Nərimanov", + "Nəsirəddin Tusi", + "Nigar Rəfibəyli", + "Niyazi", + "Nizami", + "Nizami Abdullayev", + "Nobel prospekti", + "Novruz", + "Novruzov qardaşları", + "Oqtay Vəliyev", + "Parlament", + "Puşkin", + "Rafiq Ağayev", + "Ramiz Qəmbərov", + "Rəşid Behbudov", + "Rəşid Məcidov", + "Ruhulla Axundov", + "Ruslan Allahverdiyev", + "Rüstəm Rüstəmov", + "Tahir Bağırov", + "Tarzan Hacı Məmmədov", + "Tbilisi prospekti", + "Təbriz (Bakı)", + "Təbriz Xəlilbəyli", + "Tofiq Məmmədov", + "Tolstoy", + "Sabit Orucov", + "Sabit Rəhman", + "Sahib Hümmətov", + "Salatın Əsgərova", + "Sarayevo", + "Seyid Əzim Şirvani", + "Seyid Şuşinski", + "Seyidov", + "Səməd bəy Mehmandarov", + "Səməd Vurğun", + "Səttar Bəhlulzadə", + "Sona xanım Vəlixanlı", + "Sübhi Salayev", + "Süleyman Əhmədov", + "Süleyman Rəhimov", + "Süleyman Rüstəm", + "Süleyman Sani Axundov", + "Süleyman Vəzirov", + "Şahin Səmədov", + "Şamil Əzizbəyov", + "Şamil Kamilov", + "Şeyx Şamil", + "Şəfayət Mehdiyev", + "Şəmsi Bədəlbəyli", + "Şirin Mirzəyev", + "Şıxəli Qurbanov", + "Şövkət Ələkbərova", + "Ülvi Bünyadzadə", + "Üzeyir Hacıbəyov", + "Vasif Əliyev", + "Vəli Məmmədov", + "Vladislav Plotnikov", + "Vüqar Quliyev", + "Vunq Tau", + "Yaqub Əliyev", + "Yaşar Abdullayev", + "Yaşar Əliyev", + "Yavər Əliyev", + "Yesenin", + "Yəhya Hüseynov", + "Yılmaz Axundzadə", + "Yüsif Eyvazov", + "Yusif Qasımov", + "Yusif Məmmədəliyev", + "Yusif Səfərov", + "Yusif Vəzir Çəmənzəminli", + "Zahid Əliyev", + "Zahid Xəlilov", + "Zaur Kərimov", + "Zavod", + "Zərgərpalan" +]; diff --git a/lib/locales/az/commerce/color.js b/lib/locales/az/commerce/color.js new file mode 100644 index 00000000..3cd306d9 --- /dev/null +++ b/lib/locales/az/commerce/color.js @@ -0,0 +1,20 @@ +module["exports"] = [ + "ala", + "açıq bənövşəyi", + "ağ", + "mavi", + "boz", + "bənövşəyi", + "göy rəng", + "gümüşü", + "kardinal", + "narıncı", + "qara", + "qırmızı", + "qəhvəyi", + "tünd göy", + "tünd qırmızı", + "xlorofil", + "yaşıl", + "çəhrayı" +]; diff --git a/lib/locales/az/commerce/department.js b/lib/locales/az/commerce/department.js new file mode 100644 index 00000000..67b0e18b --- /dev/null +++ b/lib/locales/az/commerce/department.js @@ -0,0 +1,20 @@ +module["exports"] = [ + "Kitablar", + "Filmlər", + "musiqi", + "oyunlar", + "Elektronika", + "Kompyuterlər", + "Ev", + "садинструмент", + "Səhiyyə", + "gözəllik", + "Oyuncaqlar", + "uşaq üçün", + "Geyim", + "Ayyaqqabı", + "bəzək", + "İdman", + "turizm", + "Avtomobil", +]; diff --git a/lib/locales/az/commerce/index.js b/lib/locales/az/commerce/index.js new file mode 100644 index 00000000..c05b5272 --- /dev/null +++ b/lib/locales/az/commerce/index.js @@ -0,0 +1,5 @@ +var commerce = {}; +module['exports'] = commerce; +commerce.color = require("./color"); +commerce.department = require("./department"); +commerce.product_name = require("./product_name"); diff --git a/lib/locales/az/commerce/product_name.js b/lib/locales/az/commerce/product_name.js new file mode 100644 index 00000000..e93af1b9 --- /dev/null +++ b/lib/locales/az/commerce/product_name.js @@ -0,0 +1,33 @@ +module["exports"] = { + "adjective": [ + "Balaca", + "Ergonomik", + "Kobud", + "İntellektual", + "Möhtəşəm", + "İnanılmaz", + "Fantastik", + "Əlverişli", + "Parlaq", + "Mükəmməl" + ], + "material": [ + "Polad", + "Ağac", + "Beton", + "Plastik", + "Pambıq", + "Qranit", + "Rezin" + ], + "product": [ + "Stul", + "Avtomobil", + "Kompyuter", + "Beret", + "Kulon", + "Stol", + "Sviter", + "Kəmər", + ] +}; diff --git a/lib/locales/az/company/index.js b/lib/locales/az/company/index.js new file mode 100644 index 00000000..1aa59cc4 --- /dev/null +++ b/lib/locales/az/company/index.js @@ -0,0 +1,5 @@ +var company = {}; +module['exports'] = company; +company.prefix = require("./prefix"); +company.suffix = require("./suffix"); +company.name = require("./name"); diff --git a/lib/locales/az/company/name.js b/lib/locales/az/company/name.js new file mode 100644 index 00000000..6ebeeebb --- /dev/null +++ b/lib/locales/az/company/name.js @@ -0,0 +1,10 @@ +module["exports"] = [ + "#{prefix} #{Name.female_first_name}", + "#{prefix} #{Name.male_first_name}", + "#{prefix} #{Name.male_last_name}", + "#{prefix} #{suffix}#{suffix}", + "#{prefix} #{suffix}#{suffix}#{suffix}", + "#{prefix} #{Address.city_name}#{suffix}", + "#{prefix} #{Address.city_name}#{suffix}#{suffix}", + "#{prefix} #{Address.city_name}#{suffix}#{suffix}#{suffix}" +]; diff --git a/lib/locales/az/company/prefix.js b/lib/locales/az/company/prefix.js new file mode 100644 index 00000000..89fc5b99 --- /dev/null +++ b/lib/locales/az/company/prefix.js @@ -0,0 +1,5 @@ +module["exports"] = [ + "ASC", + "MMC", + "QSC", +]; diff --git a/lib/locales/az/company/suffix.js b/lib/locales/az/company/suffix.js new file mode 100644 index 00000000..4b06d3fa --- /dev/null +++ b/lib/locales/az/company/suffix.js @@ -0,0 +1,3 @@ +module["exports"] = [ + +]; diff --git a/lib/locales/az/date/index.js b/lib/locales/az/date/index.js new file mode 100644 index 00000000..8c45d3f6 --- /dev/null +++ b/lib/locales/az/date/index.js @@ -0,0 +1,4 @@ +var date = {}; +module["exports"] = date; +date.month = require("./month"); +date.weekday = require("./weekday"); diff --git a/lib/locales/az/date/month.js b/lib/locales/az/date/month.js new file mode 100644 index 00000000..00d3d271 --- /dev/null +++ b/lib/locales/az/date/month.js @@ -0,0 +1,59 @@ +// source: http://unicode.org/cldr/trac/browser/tags/release-27/common/main/ru.xml#L1734 +module["exports"] = { + wide: [ + "yanvar", + "fevral", + "mart", + "aprel", + "may", + "iyun", + "iyul", + "avqust", + "sentyabr", + "oktyabr", + "noyabr", + "dekabr" + ], + wide_context: [ + "января", + "февраля", + "марта", + "апреля", + "мая", + "июня", + "июля", + "августа", + "сентября", + "октября", + "ноября", + "декабря" + ], + abbr: [ + "янв.", + "февр.", + "март", + "апр.", + "май", + "июнь", + "июль", + "авг.", + "сент.", + "окт.", + "нояб.", + "дек." + ], + abbr_context: [ + "янв.", + "февр.", + "марта", + "апр.", + "мая", + "июня", + "июля", + "авг.", + "сент.", + "окт.", + "нояб.", + "дек." + ] +}; diff --git a/lib/locales/az/date/weekday.js b/lib/locales/az/date/weekday.js new file mode 100644 index 00000000..e8ad8bec --- /dev/null +++ b/lib/locales/az/date/weekday.js @@ -0,0 +1,39 @@ +// source: http://unicode.org/cldr/trac/browser/tags/release-27/common/main/ru.xml#L1825 +module["exports"] = { + wide: [ + "Bazar", + "Bazar ertəsi", + "Çərşənbə axşamı", + "Çərşənbə", + "Cümə axşamı", + "Cümə", + "Şənbə" + ], + wide_context: [ + "воскресенье", + "понедельник", + "вторник", + "среда", + "четверг", + "пятница", + "суббота" + ], + abbr: [ + "Ba", + "BE", + "ÇA", + "Çə", + "CA", + "Cü", + "Şə" + ], + abbr_context: [ + "вс", + "пн", + "вт", + "ср", + "чт", + "пт", + "сб" + ] +}; diff --git a/lib/locales/az/index.js b/lib/locales/az/index.js new file mode 100644 index 00000000..41ccda9d --- /dev/null +++ b/lib/locales/az/index.js @@ -0,0 +1,11 @@ +var az = {}; +module['exports'] = az; +az.title = "Azerbaijani"; +az.separator = " və "; +az.address = require("./address"); +az.internet = require("./internet"); +az.name = require("./name"); +az.phone_number = require("./phone_number"); +az.commerce = require("./commerce"); +az.company = require("./company"); +az.date = require("./date"); diff --git a/lib/locales/az/internet/domain_suffix.js b/lib/locales/az/internet/domain_suffix.js new file mode 100644 index 00000000..f3749b6b --- /dev/null +++ b/lib/locales/az/internet/domain_suffix.js @@ -0,0 +1,8 @@ +module["exports"] = [ + "com", + "az", + "com.az", + "info", + "net", + "org" +]; diff --git a/lib/locales/az/internet/free_email.js b/lib/locales/az/internet/free_email.js new file mode 100644 index 00000000..b5f920af --- /dev/null +++ b/lib/locales/az/internet/free_email.js @@ -0,0 +1,7 @@ +module["exports"] = [ + "box.az", + "mail.az", + "gmail.com", + "yahoo.com", + "hotmail.com" +]; diff --git a/lib/locales/az/internet/index.js b/lib/locales/az/internet/index.js new file mode 100644 index 00000000..8a337d64 --- /dev/null +++ b/lib/locales/az/internet/index.js @@ -0,0 +1,4 @@ +var internet = {}; +module['exports'] = internet; +internet.free_email = require("./free_email"); +internet.domain_suffix = require("./domain_suffix"); diff --git a/lib/locales/az/name/female_first_name.js b/lib/locales/az/name/female_first_name.js new file mode 100644 index 00000000..99a65531 --- /dev/null +++ b/lib/locales/az/name/female_first_name.js @@ -0,0 +1,75 @@ +module["exports"] = [ + "Anna", + "Adeliya", + "Afaq", + "Afət", + "Afərim", + "Aidə", + "Aygün", + "Aynur", + "Alsu", + "Ayan", + "Aytən", + "Aygül", + "Aydan", + "Aylin", + "Bahar", + "Banu", + "Bəyaz", + "Billurə", + "Cansu", + "Ceyla", + "Damla", + "Dəniz", + "Diana", + "Dilarə", + "Ella", + "Elza", + "Elyanora", + "Ellada", + "Elvira", + "Elnarə", + "Esmira", + "Estella", + "Fatimə", + "Fəxriyyə", + "Fərəh", + "Fərqanə", + "Fidan", + "Firuzə", + "Gövhər", + "Günay", + "Gülay", + "Gülçin", + "Gülər", + "Gülsüm", + "Humay", + "Hüriyə", + "Hülya", + "Jalə", + "Jasmin", + "Kübra", + "Ləman", + "Lamiyə", + "Lalə", + "Liliya", + "Laura", + "Leyla", + "Maya", + "Mehriban", + "Mələk", + "Nuray", + "Nurgün", + "Nərgiz", + "Nigar", + "Ofelya", + "Pəri", + "Röya", + "Səbinə", + "Selcan", + "Tansu", + "Tuba", + "Ülviyyə", + "Ulduz", + "Ülkər" +]; diff --git a/lib/locales/az/name/female_last_name.js b/lib/locales/az/name/female_last_name.js new file mode 100644 index 00000000..848263cd --- /dev/null +++ b/lib/locales/az/name/female_last_name.js @@ -0,0 +1,12 @@ +module["exports"] = [ + "Qasımova", + "Əfəndiyeva", + "Soltanova", + "Abdullayeva", + "Rəşidova", + "Ələkbərova", + "Əliyeva", + "Tahirova", + "Seyidova", + "Vəsiyeva" +]; diff --git a/lib/locales/az/name/index.js b/lib/locales/az/name/index.js new file mode 100644 index 00000000..daccf09b --- /dev/null +++ b/lib/locales/az/name/index.js @@ -0,0 +1,9 @@ +var name = {}; +module['exports'] = name; +name.male_first_name = require("./male_first_name"); +name.male_last_name = require("./male_last_name"); +name.female_first_name = require("./female_first_name"); +name.female_last_name = require("./female_last_name"); +name.prefix = require("./prefix"); +name.suffix = require("./suffix"); +name.name = require("./name"); diff --git a/lib/locales/az/name/male_first_name.js b/lib/locales/az/name/male_first_name.js new file mode 100644 index 00000000..6a7c8830 --- /dev/null +++ b/lib/locales/az/name/male_first_name.js @@ -0,0 +1,37 @@ +module["exports"] = [ + "Anar", + "Amid", + "Afəl", + "Abbas", + "Abdulla", + "Adil", + "Akif", + "Aqil", + "Bəhram", + "Nurlan", + "Rafiq", + "Tərlan", + "Zaur", + "Emin", + "Emil", + "Kamran", + "Elnur", + "Natiq", + "Rəşad", + "Rəşid", + "Tahir", + "Əhməd", + "Zahir", + "İlham", + "İlqar", + "Nahid", + "Nihad", + "Faiq", + "İxtiyar", + "Şəhriyar", + "Şaiq", + "Bəxtiyar", + "Bəhruz", + "Tunar", + "Nadir" +]; diff --git a/lib/locales/az/name/male_last_name.js b/lib/locales/az/name/male_last_name.js new file mode 100644 index 00000000..d4d5186e --- /dev/null +++ b/lib/locales/az/name/male_last_name.js @@ -0,0 +1,12 @@ +module["exports"] = [ + "Əhmədov", + "Ələkbərov", + "Əliyev", + "Vəliyev", + "Soltanov", + "Quliyev", + "Məmmədov", + "Xəlilov", + "Nəzərov", + "Rəhimov" +]; diff --git a/lib/locales/az/name/name.js b/lib/locales/az/name/name.js new file mode 100644 index 00000000..4c17361d --- /dev/null +++ b/lib/locales/az/name/name.js @@ -0,0 +1,8 @@ +module["exports"] = [ + "#{male_first_name}", + "#{male_last_name} #{male_first_name}", + "#{male_first_name} #{male_last_name}", + "#{female_first_name}", + "#{female_first_name} #{female_last_name}", + "#{female_last_name} #{female_first_name}", +]; diff --git a/lib/locales/az/name/prefix.js b/lib/locales/az/name/prefix.js new file mode 100644 index 00000000..688be216 --- /dev/null +++ b/lib/locales/az/name/prefix.js @@ -0,0 +1 @@ +module["exports"] = []; diff --git a/lib/locales/az/name/suffix.js b/lib/locales/az/name/suffix.js new file mode 100644 index 00000000..688be216 --- /dev/null +++ b/lib/locales/az/name/suffix.js @@ -0,0 +1 @@ +module["exports"] = []; diff --git a/lib/locales/az/phone_number/formats.js b/lib/locales/az/phone_number/formats.js new file mode 100644 index 00000000..ffdb56d8 --- /dev/null +++ b/lib/locales/az/phone_number/formats.js @@ -0,0 +1,3 @@ +module["exports"] = [ + "(9##)###-##-##" +]; diff --git a/lib/locales/az/phone_number/index.js b/lib/locales/az/phone_number/index.js new file mode 100644 index 00000000..8d35e011 --- /dev/null +++ b/lib/locales/az/phone_number/index.js @@ -0,0 +1,3 @@ +var phone_number = {}; +module['exports'] = phone_number; +phone_number.formats = require("./formats"); diff --git a/lib/locales/en/database/collation.js b/lib/locales/en/database/collation.js new file mode 100644 index 00000000..fe597128 --- /dev/null +++ b/lib/locales/en/database/collation.js @@ -0,0 +1,9 @@ +module["exports"] = [ + "utf8_unicode_ci", + "utf8_general_ci", + "utf8_bin", + "ascii_bin", + "ascii_general_ci", + "cp1250_bin", + "cp1250_general_ci" +]; diff --git a/lib/locales/en/database/column.js b/lib/locales/en/database/column.js new file mode 100644 index 00000000..1d0e5563 --- /dev/null +++ b/lib/locales/en/database/column.js @@ -0,0 +1,16 @@ +module["exports"] = [ + "id", + "title", + "name", + "email", + "phone", + "token", + "group", + "category", + "password", + "comment", + "avatar", + "status", + "createdAt", + "updatedAt" +]; diff --git a/lib/locales/en/database/engine.js b/lib/locales/en/database/engine.js new file mode 100644 index 00000000..b75f493e --- /dev/null +++ b/lib/locales/en/database/engine.js @@ -0,0 +1,8 @@ +module["exports"] = [ + "InnoDB", + "MyISAM", + "MEMORY", + "CSV", + "BLACKHOLE", + "ARCHIVE" +]; diff --git a/lib/locales/en/database/index.js b/lib/locales/en/database/index.js new file mode 100644 index 00000000..84ba719c --- /dev/null +++ b/lib/locales/en/database/index.js @@ -0,0 +1,6 @@ +var database = {}; +module['exports'] = database; +database.collation = require("./collation"); +database.column = require("./column"); +database.engine = require("./engine"); +database.type = require("./type");
\ No newline at end of file diff --git a/lib/locales/en/database/type.js b/lib/locales/en/database/type.js new file mode 100644 index 00000000..a6cdd08a --- /dev/null +++ b/lib/locales/en/database/type.js @@ -0,0 +1,26 @@ +module["exports"] = [ + "int", + "varchar", + "text", + "date", + "datetime", + "tinyint", + "time", + "timestamp", + "smallint", + "mediumint", + "bigint", + "decimal", + "float", + "double", + "real", + "bit", + "boolean", + "serial", + "blob", + "binary", + "enum", + "set", + "geometry", + "point" +]; diff --git a/lib/locales/en/index.js b/lib/locales/en/index.js index 2513a826..5cc575f9 100644 --- a/lib/locales/en/index.js +++ b/lib/locales/en/index.js @@ -6,6 +6,7 @@ en.address = require("./address"); en.credit_card = require("./credit_card"); en.company = require("./company"); en.internet = require("./internet"); +en.database = require("./database"); en.lorem = require("./lorem"); en.name = require("./name"); en.phone_number = require("./phone_number"); diff --git a/lib/lorem.js b/lib/lorem.js index 403e0e6d..db6aec72 100644 --- a/lib/lorem.js +++ b/lib/lorem.js @@ -51,6 +51,17 @@ var Lorem = function (faker) { }; /** + * slug + * + * @method faker.lorem.slug + * @param {number} wordCount number of words, defaults to 3 + */ + self.slug = function (wordCount) { + var words = faker.lorem.words(wordCount); + return Helpers.slugify(words); + }; + + /** * sentences * * @method faker.lorem.sentences diff --git a/lib/system.js b/lib/system.js index 60a55246..9ef713c8 100644 --- a/lib/system.js +++ b/lib/system.js @@ -19,6 +19,7 @@ function System (faker) { str = str.replace(/\,/g, '_'); str = str.replace(/\-/g, '_'); str = str.replace(/\\/g, '_'); + str = str.replace(/\//g, '_'); str = str.toLowerCase(); return str; }; @@ -36,6 +37,7 @@ function System (faker) { str = str.replace(/\,/g, '_'); str = str.replace(/\-/g, '_'); str = str.replace(/\\/g, '_'); + str = str.replace(/\//g, '_'); str = str.toLowerCase(); return str; }; @@ -155,4 +157,4 @@ function System (faker) { } -module['exports'] = System;
\ No newline at end of file +module['exports'] = System; |
