Socket
Socket
Sign inDemoInstall

faker

Package Overview
Dependencies
0
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 5.1.0

lib/image_providers/lorempicsum.js

21

lib/address.js

@@ -198,5 +198,16 @@ /**

* @method faker.address.countryCode
* @param {string} alphaCode default alpha-2
*/
this.countryCode = function () {
this.countryCode = function (alphaCode) {
if (typeof alphaCode === 'undefined' || alphaCode === 'alpha-2') {
return faker.random.arrayElement(faker.definitions.address.country_code);
}
if (alphaCode === 'alpha-3') {
return faker.random.arrayElement(faker.definitions.address.country_code_alpha_3);
}
return faker.random.arrayElement(faker.definitions.address.country_code);
}

@@ -377,2 +388,10 @@

/**
* Return a random time zone
* @method faker.address.timeZone
*/
this.timeZone = function() {
return faker.random.arrayElement(faker.definitions.address.time_zone);
}
return this;

@@ -379,0 +398,0 @@ }

@@ -227,3 +227,3 @@ /**

* Credit card CVV
* @method faker.finance.creditCardNumber
* @method faker.finance.creditCardCVV
*/

@@ -313,4 +313,20 @@ self.creditCardCVV = function() {

};
/**
* description
*
* @method faker.finance.transactionDescription
*/
self.transactionDescription = function() {
var account = Helpers.createTransaction().account
var card = faker.finance.mask();
var currency = faker.finance.currencyCode();
var amount = Helpers.createTransaction().amount
var transactionType = Helpers.createTransaction().type
var company = Helpers.createTransaction().business
return transactionType + " transaction at " + company + " using card ending with ***" + card + " for " + currency + " " + amount + " in account ***" + account
}
};
module['exports'] = Finance;

13

lib/helpers.js

@@ -197,3 +197,5 @@ /**

/**
* takes an array and returns it randomized
* takes an array and randomizes it in place then returns it
*
* uses the modern version of the Fisher–Yates algorithm
*

@@ -205,6 +207,11 @@ * @method faker.helpers.shuffle

if (typeof o === 'undefined' || o.length === 0) {
return [];
return o || [];
}
o = o || ["a", "b", "c"];
for (var j, x, i = o.length-1; i; j = faker.random.number(i), x = o[--i], o[i] = o[j], o[j] = x);
for (var x, j, i = o.length - 1; i > 0; --i) {
j = faker.random.number(i);
x = o[i];
o[i] = o[j];
o[j] = x;
}
return o;

@@ -211,0 +218,0 @@ };

@@ -6,2 +6,3 @@ /**

* @property {object} unsplash - faker.image.unsplash
* @property {object} unsplash - faker.image.lorempicsum
* @default Default provider is unsplash image provider

@@ -14,2 +15,3 @@ */

var Unsplash = require('./image_providers/unsplash');
var LoremPicsum = require('./image_providers/lorempicsum');

@@ -223,2 +225,3 @@ /**

self.unsplash = new Unsplash(faker);
self.lorempicsum = new LoremPicsum(faker);

@@ -225,0 +228,0 @@ // Object.assign(self, self.unsplash);

@@ -103,3 +103,3 @@ /*

"name": ["first_name", "last_name", "prefix", "suffix", "gender", "title", "male_prefix", "female_prefix", "male_first_name", "female_first_name", "male_middle_name", "female_middle_name", "male_last_name", "female_last_name"],
"address": ["city_prefix", "city_suffix", "street_suffix", "county", "country", "country_code", "state", "state_abbr", "street_prefix", "postcode", "postcode_by_state", "direction", "direction_abbr"],
"address": ["city_prefix", "city_suffix", "street_suffix", "county", "country", "country_code", "country_code_alpha_3", "state", "state_abbr", "street_prefix", "postcode", "postcode_by_state", "direction", "direction_abbr", "time_zone"],
"company": ["adjective", "noun", "descriptor", "bs_adjective", "bs_noun", "bs_verb", "suffix"],

@@ -106,0 +106,0 @@ "lorem": ["words"],

@@ -20,2 +20,3 @@ exports['az'] = require('./locales/az');

exports['fa'] = require('./locales/fa');
exports['fi'] = require('./locales/fi');
exports['fr'] = require('./locales/fr');

@@ -22,0 +23,0 @@ exports['fr_CA'] = require('./locales/fr_CA');

module["exports"] = [
"+91###-###-####",
"+91##########",
"+91-###-#######"
"+919##-###-####",
"+919#########",
"+91-9##-#######",
"+918##-###-####",
"+918#########",
"+91-8##-#######",
"+917##-###-####",
"+917#########",
"+91-7##-#######",
"+916##-###-####",
"+916#########",
"+91-6##-#######",
];

@@ -32,3 +32,2 @@ module["exports"] = [

"BQ",
"BQ",
"BR",

@@ -35,0 +34,0 @@ "BS",

@@ -8,2 +8,3 @@ var address = {};

address.country_code = require("./country_code");
address.country_code_alpha_3 = require("./country_code_alpha_3");
address.building_number = require("./building_number");

@@ -10,0 +11,0 @@ address.street_suffix = require("./street_suffix");

@@ -515,4 +515,4 @@ module["exports"] = {

"Dobra": {
"code": "STD",
"symbol": ""
"code": "STN",
"symbol": "Db"
},

@@ -553,3 +553,3 @@ "El Salvador Colon": {

"code": "TRY",
"symbol": "TL"
"symbol": "₺"
},

@@ -556,0 +556,0 @@ "Trinidad and Tobago Dollar": {

@@ -11,3 +11,3 @@ module["exports"] = [

"Bordeaux",
"Lille13",
"Lille",
"Rennes",

@@ -14,0 +14,0 @@ "Reims",

var name = {};
module['exports'] = name;
name.first_name = require("./first_name");
name.male_first_name = require("./male_first_name")
name.female_first_name = require("./female_first_name")
name.last_name = require("./last_name");

@@ -5,0 +6,0 @@ name.prefix = require("./prefix");

var ja = {};
module['exports'] = ja;
module["exports"] = ja;
ja.title = "Japanese";

@@ -8,1 +8,2 @@ ja.address = require("./address");

ja.name = require("./name");
ja.lorem = require("./lorem");

@@ -36,2 +36,3 @@ module["exports"] = [

"Białkowski",
"Biedrzyński",
"Bielak",

@@ -173,2 +174,3 @@ "Bielawski",

"Guzik",
"Gwoździk",
"Gwóźdź",

@@ -189,2 +191,3 @@ "Góra",

"Herman",
"Iwanowski",
"Iwański",

@@ -400,2 +403,3 @@ "Izdebski",

"Mika",
"Miklaś",
"Mikołajczak",

@@ -452,2 +456,3 @@ "Mikołajczyk",

"Pakuła",
"Palacz",
"Paluch",

@@ -467,2 +472,3 @@ "Panek",

"Piechota",
"Pieczek",
"Piekarski",

@@ -614,2 +620,3 @@ "Pietras",

"Tomczyk",
"Tomys",
"Tracz",

@@ -670,2 +677,3 @@ "Trojanowski",

"Wąsik",
"Wąsowski",
"Węgrzyn",

@@ -672,0 +680,0 @@ "Włodarczyk",

module["exports"] = [
"Nova",
"Velha",
"Grande",
"Vila",
"Município de"
];
module["exports"] = [
"do Descoberto",
"de Nossa Senhora",
"do Norte",
"do Sul"
];
module["exports"] = [
"#####",
"#####-###"
];

@@ -5,7 +5,5 @@ module["exports"] = [

"Travessa",
"Ponte",
"Alameda",
"Marginal",
"Viela",
"Rodovia"
];

@@ -6,2 +6,3 @@ var pt_BR = {};

pt_BR.company = require("./company");
pt_BR.commerce = require("./commerce");
pt_BR.internet = require("./internet");

@@ -11,1 +12,2 @@ pt_BR.lorem = require("./lorem");

pt_BR.phone_number = require("./phone_number");
pt_BR.date = require("./date");
module["exports"] = [
"Alessandra",
"Alessandro",
"Alessandra",
"Alexandre",
"Alice",
"Aline",
"Alícia",
"Ana Clara",
"Ana Júlia",
"Ana Laura",
"Ana Luiza",
"Anthony",
"Antonella",
"Antônio",
"Arthur",
"Beatriz",
"Benjamin",
"Benício",
"Bernardo",
"Breno",
"Bruna",
"Bryan",
"Caio",
"Calebe",
"Carla",
"Carlos",
"Carla",
"Cauã",
"Cecília",
"Clara",
"Célia",
"Cecília",
"César",
"Dalila",
"Daniel",
"Danilo",
"Dalila",
"Davi",
"Davi Lucca",
"Deneval",
"Eduarda",
"Eduardo",
"Eduarda",
"Elisa",
"Eloá",
"Elísio",
"Emanuel",
"Emanuelly",
"Enzo",
"Enzo Gabriel",
"Esther",
"Elísio",
"Fábio",
"Fabiano",
"Fabrícia",
"Fabrício",
"Fabrícia",
"Félix",
"Feliciano",
"Felipe",
"Felícia",
"Feliciano",
"Frederico",
"Fabiano",
"Fábio",
"Félix",
"Gabriel",
"Gael",
"Giovanna",
"Guilherme",
"Gustavo",
"Guilherme",
"Gúbio",
"Heitor",
"Helena",
"Heloísa",
"Henrique",
"Hugo",
"Hélio",
"Hugo",
"Isaac",
"Isabel",
"Isabela",
"Ígor",
"Isabella",
"Isabelly",
"Isadora",
"Isis",
"Janaína",
"Joana",
"Joaquim",
"João",
"Joana",
"João Lucas",
"João Miguel",
"João Pedro",
"Júlia",
"Júlio",
"Júlio César",
"Júlio",
"Júlia",
"Janaína",
"Karla",
"Kléber",
"Lucas",
"Ladislau",
"Lara",
"Larissa",
"Laura",
"Lavínia",
"Leonardo",
"Liz",
"Lorena",
"Lorenzo",
"Lorraine",
"Larissa",
"Ladislau",
"Lucas",
"Lucca",
"Luiza",
"Lívia",
"Maitê",
"Manuela",
"Marcela",
"Marcelo",
"Marcos",
"Meire",
"Marcelo",
"Marcela",
"Margarida",
"Mércia",
"Márcia",
"Maria",
"Maria Alice",
"Maria Cecília",
"Maria Clara",
"Maria Eduarda",
"Maria Helena",
"Maria Júlia",
"Maria Luiza",
"Mariana",
"Marina",
"Marli",
"Matheus",
"Meire",
"Melissa",
"Miguel",
"Morgana",
"Maria",
"Murilo",
"Márcia",
"Mércia",
"Nataniel",
"Natália",
"Nicolas",
"Noah",
"Norberto",
"Natália",
"Nataniel",
"Núbia",
"Ofélia",
"Pablo",
"Paula",
"Paulo",
"Paula",
"Pablo",
"Pedro",
"Raul",
"Pedro Henrique",
"Pietro",
"Rafael",
"Rafaela",
"Raul",
"Rebeca",
"Ricardo",
"Roberta",
"Roberto",
"Roberta",
"Sílvia",
"Sílvia",
"Salvador",
"Samuel",
"Sara",
"Sarah",
"Silas",
"Sirineu",
"Sophia",
"Suélen",
"Sara",
"Salvador",
"Sirineu",
"Sílvia",
"Talita",
"Tertuliano",
"Théo",
"Valentina",
"Vicente",
"Vitor",
"Vitória",
"Víctor",
"Vitória",
"Warley",
"Washington",
"Yago",
"Yango",
"Yago",
"Yasmin",
"Yuri",
"Washington",
"Warley"
"Ígor"
];
module["exports"] = [
"+351 2########",
"+351 91#######",
"+351 92#######",
"+351 93#######",
"+351 96#######"
];

@@ -7,2 +7,3 @@ var ru = {};

ru.internet = require("./internet");
ru.lorem = require("./lorem");
ru.name = require("./name");

@@ -9,0 +10,0 @@ ru.phone_number = require("./phone_number");

var name = {};
module['exports'] = name;
name.female_first_name = require("./female_first_name");
name.female_last_name = require("./female_last_name");
name.female_middle_name = require("./female_middle_name");
name.male_first_name = require("./male_first_name");
name.male_last_name = require("./male_last_name");
name.male_middle_name = require("./male_middle_name");
name.male_last_name = require("./male_last_name");
name.female_first_name = require("./female_first_name");
name.female_middle_name = require("./female_middle_name");
name.female_last_name = require("./female_last_name");
name.name = require("./name");
name.prefix = require("./prefix");
name.suffix = require("./suffix");
name.name = require("./name");
name.title = require("./title");

@@ -9,3 +9,3 @@ module["exports"] = {

"Otrolig",
"Fatastisk",
"Fantastisk",
"Praktisk",

@@ -21,4 +21,4 @@ "Slimmad",

"Plast",
"Bomul",
"Grnit",
"Bomull",
"Granit",
"Gummi",

@@ -32,8 +32,8 @@ "Latex"

"Handskar",
"Pants",
"Shirt",
"Table",
"Shoes",
"Hat"
"Byxor",
"Skjorta",
"Bord",
"Skor",
"Hatt"
]
};
module["exports"] = [
"An Giang",
"Bà Rịa-Vũng Tàu",
"Bạc Liêu",
"Bắc Kạn",
"Bắc Giang",
"Bắc Kạn",
"Bắc Ninh",
"Bến Tre",
"Bình Dương",
"Bình Định",
"Bình Phước",
"Bình Thuận",
"Cà Mau",
"Cao Bằng",
"Cần Thơ",
"Đà Nẵng",
"Đắk Lắk",
"Đắk Nông",
"Điện Biên",
"Đồng Nai",
"Đồng Tháp",
"Gia Lai",
"Hà Giang",
"Hà Nam",
"Hà Tây",
"Hà Nội",
"Hà Tĩnh",
"Hải Dương",
"TP Hải Phòng",
"Hải Phòng",
"Hậu Giang",
"Hòa Bình",
"TP. Hồ Chí Minh",
"Hưng Yên",
"Khánh Hoà",
"Kiên Giang",
"Kon Tum",
"Lai Châu",
"Lạng Sơn",
"Lào Cai",
"Lạng Sơn",
"Lâm Đồng",
"Long An",
"Nam Định",
"Nghệ An",
"Ninh Bình",
"Ninh Thuận",
"Phú Thọ",
"Quảng Ninh",
"Sơn La",
"Thái Bình",
"Thái Nguyên",
"Tuyên Quang",
"Vĩnh Phúc",
"Yên Bái",
"TP Đà Nẵng",
"Bình Định",
"Đắk Lắk",
"Đắk Nông",
"Gia Lai",
"Hà Tĩnh",
"Khánh Hòa",
"Kon Tum",
"Nghệ An",
"Phú Yên",

@@ -40,27 +50,17 @@ "Quảng Bình",

"Quảng Ngãi",
"Quảng Ninh",
"Quảng Trị",
"Thanh Hóa",
"Thừa Thiên Huế",
"TP TP. Hồ Chí Minh",
"An Giang",
"Bà Rịa Vũng Tàu",
"Bạc Liêu",
"Bến Tre",
"Bình Dương",
"Bình Phước",
"Bình Thuận",
"Cà Mau",
"TP Cần Thơ",
"Đồng Nai",
"Đồng Tháp",
"Hậu Giang",
"Kiên Giang",
"Lâm Đồng",
"Long An",
"Ninh Thuận",
"Sóc Trăng",
"Sơn La",
"Tây Ninh",
"Thái Bình",
"Thái Nguyên",
"Thanh Hoá",
"Thừa Thiên-Huế",
"Tiền Giang",
"Trà Vinh",
"Vĩnh Long"
"Tuyên Quang",
"Vĩnh Long",
"Vĩnh Phúc",
"Yên Bái"
];

@@ -5,3 +5,4 @@ var address = {};

address.city = require("./city");
address.county = require("./county");
address.default_country = require("./default_country");
address.postcode = require("./postcode");
address.country = require("./country");
module["exports"] = [
"074## ######",
"075## ######",
"076## ######",
"077## ######",
"078## ######",
"079## ######"
"03# ### ####",
"05# ### ####",
"07# ### ####",
"08# ### ####",
"09# ### ####"
];

@@ -11,1 +11,2 @@ var vi = {};

vi.lorem = require("./lorem");
vi.date = require("./date");
module["exports"] = [
"01#### #####",
"01### ######",
"01#1 ### ####",
"011# ### ####",
"02# #### ####",
"03## ### ####",
"055 #### ####",
"056 #### ####",
"0800 ### ####",
"08## ### ####",
"09## ### ####",
"016977 ####",
"01### #####",
"0500 ######",
"0800 ######"
"02## #### ####"
];
module["exports"] = [
"###-########",
"####-########",
"###########"
"0##-########",
"0###-########",
"1##########"
];

@@ -11,9 +11,16 @@

/**
* word
* generates a word of a specified length
*
* @method faker.lorem.word
* @param {number} num
* @param {number} length length of the word that should be returned. Defaults to a random length
*/
self.word = function (num) {
return faker.random.arrayElement(faker.definitions.lorem.words);
self.word = function (length) {
var hasRightLength = function(word) { return word.length === length; };
var properLengthWords;
if(typeof length === 'undefined') {
properLengthWords = faker.definitions.lorem.words;
} else {
properLengthWords = faker.definitions.lorem.words.filter(hasRightLength);
}
return faker.random.arrayElement(properLengthWords);
};

@@ -20,0 +27,0 @@

@@ -18,2 +18,12 @@ /**

// we must randomly pick a name from either gender array so faker.name.firstName will return the correct locale data ( and not fallback )
if(typeof gender === 'string') {
if(gender.toLowerCase() === 'male') {
gender = 0;
}
else if(gender.toLowerCase() === 'female') {
gender = 1;
}
}
if (typeof gender !== 'number') {

@@ -20,0 +30,0 @@ if(typeof faker.definitions.name.first_name === "undefined") {

@@ -205,4 +205,4 @@ var mersenne = require('../vendor/mersenne');

var randomWordMethod = faker.random.arrayElement(wordMethods);
return faker.fake('{{' + randomWordMethod + '}}');
var result = faker.fake('{{' + randomWordMethod + '}}');
return faker.random.arrayElement(result.split(' '));
}

@@ -209,0 +209,0 @@

{
"name": "faker",
"description": "Generate massive amounts of fake contextual data",
"version": "5.0.0",
"version": "5.1.0",
"contributors": [

@@ -6,0 +6,0 @@ "Marak Squires <marak.squires@gmail.com>"

@@ -65,2 +65,3 @@ # faker.js - generate massive amounts of fake data in the browser and node.js

* nearbyGPSCoordinate
* timeZone
* commerce

@@ -118,2 +119,3 @@ * color

* bic
* transactionDescription
* git

@@ -166,2 +168,3 @@ * branch

* unsplash
* lorempicsum
* internet

@@ -293,2 +296,3 @@ * avatar

* fa
* fi
* fr

@@ -295,0 +299,0 @@ * fr_CA

@@ -46,3 +46,4 @@ /*

//returns a random element from array (a), even weighting
return a[Math.floor(Math.random() * a.length)];
var faker = require('../');
return faker.random.arrayElement(a);
}

@@ -49,0 +50,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc