{"id":15585600,"url":"https://github.com/icebob/fakerator","last_synced_at":"2025-04-05T02:09:20.201Z","repository":{"id":44363554,"uuid":"58302246","full_name":"icebob/fakerator","owner":"icebob","description":"Random fake data generator with localization for Javascript in Node.js and browser","archived":false,"fork":false,"pushed_at":"2023-10-09T16:28:11.000Z","size":8757,"stargazers_count":140,"open_issues_count":2,"forks_count":26,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T01:09:31.627Z","etag":null,"topics":["entities","fake","faker","generator","mock"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icebob.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-08T07:57:17.000Z","updated_at":"2025-02-25T12:48:58.000Z","dependencies_parsed_at":"2024-06-18T13:34:11.243Z","dependency_job_id":"df894004-3401-4095-a85b-22d9c1ed84b6","html_url":"https://github.com/icebob/fakerator","commit_stats":{"total_commits":235,"total_committers":13,"mean_commits":"18.076923076923077","dds":"0.46382978723404256","last_synced_commit":"ec22ff06670ecce82ecd785f390fc6ce9197492e"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Ffakerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Ffakerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Ffakerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icebob%2Ffakerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icebob","download_url":"https://codeload.github.com/icebob/fakerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276164,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["entities","fake","faker","generator","mock"],"created_at":"2024-10-02T21:02:01.391Z","updated_at":"2025-04-05T02:09:20.173Z","avatar_url":"https://github.com/icebob.png","language":"JavaScript","funding_links":["https://www.paypal.me/meregnorbert"],"categories":[],"sub_categories":[],"readme":"[![](https://raw.githubusercontent.com/icebob/fakerator/gh-pages/binary-1327501.jpg)](https://github.com/icebob/fakerator)\n# fakerator [![NPM version](https://img.shields.io/npm/v/fakerator.svg)](https://www.npmjs.com/package/fakerator)\n\u003e Random fake data generator with localization\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/939fc8b138a64c65b9827543e30dab39)](https://www.codacy.com/app/mereg-norbert/fakerator?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=icebob/fakerator\u0026amp;utm_campaign=Badge_Grade)\n[![Build Status](https://travis-ci.org/icebob/fakerator.svg?branch=master)](https://travis-ci.org/icebob/fakerator)\n[![Coverage Status](https://coveralls.io/repos/github/icebob/fakerator/badge.svg?branch=master)](https://coveralls.io/github/icebob/fakerator?branch=master)\n\n[![Dependency Status](https://david-dm.org/icebob/fakerator.svg)](https://david-dm.org/icebob/fakerator)\n[![devDependency Status](https://david-dm.org/icebob/fakerator/dev-status.svg)](https://david-dm.org/icebob/fakerator#info=devDependencies)\n[![Downloads](https://img.shields.io/npm/dt/fakerator.svg)](https://www.npmjs.com/package/fakerator)\n\nfakerator was inspired by and has used data definitions from [Marak's faker.js library](https://github.com/Marak/faker.js)\n\n**If you like my work, please [donate](https://www.paypal.me/meregnorbert). Thank you!**\n\n## Demo\n[JSFiddle test page](https://jsfiddle.net/icebob/wngcbpkq/)\n\n[Tonic demo](https://tonicdev.com/icebob/574c36fc8e1b8e130072a138)\n\n## Install\n\n### Bower\n\n```bash\n$ bower install fakerator\n```\n\n### NodeJS\n\n```bash\n$ npm install fakerator\n```\n\n### Manual\nDownload the package and use the `dist/fakerator.js` or the `dist/fakerator.min.js` file in your project.\n\n## Usage\n### Browser\n```html\n\u003cscript src=\"https://rawgit.com/icebob/fakerator/master/dist/fakerator.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  var fakerator = Fakerator();\n  var name = fakerator.names.name();\n  var user = fakerator.entity.user();\n\u003c/script\u003e\n```\n\n### NodeJS\n```js\nvar Fakerator = require(\"fakerator\");\nvar fakerator = Fakerator(\"de-DE\");\nvar name = fakerator.names.name();\n// Result: 'Dr. Marcus Drechsler'\n```\n\nShortly\n```js\nvar fakerator = require(\"fakerator\")(\"hu-HU\");\nvar name = fakerator.names.name();\n// Result: 'Fülöp Magdolna'\n```\n\nOr load a specific locale\n\n```js\nvar fakerator = require(\"fakerator/locales/de-DE\")();\nvar name = fakerator.names.name();\n// Result: 'Dr. Marcus Drechsler'\n```\n\n\n## Seeding\nThe library uses the [Mersenne Twister](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) pseudorandom number generator, so set seed value, if you want to get a repeatable random sequence:\n```js\nfakerator.seed(5567832);\n```\n\n## Random\nGenerate random values or select a random element from array.\n\nFunction                           | Description                 | Sample result\n-----------------------------------| --------------------------- | -----------------------\n`fakerator.random.boolean()`                    | Generate a boolean value                              | true\n`fakerator.random.boolean(likelihoodPercent)`   | Generate a boolean value based a likelihood value.    | false\n`fakerator.random.number(max)`                  | Generate a number value between 0 and max value       |  87\n`fakerator.random.number(min, max)`             | Generate a number value between min and max           |  54\n`fakerator.random.digit()`                      | Generate a digit (0..9)                               | 5\n`fakerator.random.letter()`                     | Generate a letter (a..z)                              | \"h\"\n`fakerator.random.arrayElement(array)`          | Give a random element from the array                  |\n`fakerator.random.objectElement(obj)`           | Give a random `{ key: value }` from the object\n`fakerator.random.masked(mask)`                 | Generate a masked string ( a - lowercase letter, A - uppercase letter, 9 - digit, * - letter or digit |  \"aaa-AAA_999:*\" -\u003e \"aqa-RPG_932:6\"\n`fakerator.random.hex(length)`                  | Generate a hexadecimal number                         | \"7950a0b9\"\n`fakerator.random.string(length)`               | Generate a random string                              | \"dulgecbhrsa\"\n\n\n## Localization\nThe library supports localizations. You can set the locale code in constructor.\n\n### Usage\n```js\n  // Use default (English) localization\n  var fakerator = Fakerator();\n  console.log(fakerator.names.name());\n  // Floyd Corkery\n```\n\n```js\n  // Use german\n  var fakerator = Fakerator(\"de-DE\");\n  console.log(fakerator.names.name());\n  // Hassan vom Kumbernuss\n```\n\n```js\n  // Use russian\n  var fakerator = Fakerator(\"ru-RU\");\n  console.log(fakerator.names.name());\n  // Альберт Валентинович Архипов\n```\n\nIn production, you can load only a specific locale:\n\n```js\n  // Use french\n  var fakeratorFR = require(\"fakerator/locales/fr-FR\")();\n  console.log(fakeratorFR.names.name());\n  // Dufour Camille\n```\n\n\n### Available localizations:\nCode      | Language/Country      | Usage                     | Creator/Source\n--------- | --------------------- | ------------------------- | --------------\ndefault   | English (default)     | `Fakerator();`        | [faker.js](https://github.com/Marak/faker.js)\ncs-CZ     | Czech                 | `Fakerator(\"cs-CZ\");` | [zpiman](https://github.com/zpiman)\nde-DE     | German                | `Fakerator(\"de-DE\");` | [faker.js](https://github.com/Marak/faker.js)\nen-AU     | English (Australia)   | `Fakerator(\"en-AU\");` | [faker.js](https://github.com/Marak/faker.js)\nen-CA     | English (Canada)      | `Fakerator(\"en-CA\");` | [faker.js](https://github.com/Marak/faker.js)\nes-ES     | Spanish               | `Fakerator(\"es-ES\");` | [faker.js](https://github.com/Marak/faker.js)\nfr-FR     | French                | `Fakerator(\"fr-FR\");` | [faker.js](https://github.com/Marak/faker.js)\nhu-HU     | Hungarian             | `Fakerator(\"hu-HU\");` | [Icebob](https://github.com/icebob)\nit-IT     | Italian               | `Fakerator(\"it-IT\");` | [faker.js](https://github.com/Marak/faker.js)\nnb-NO     | Norwegian             | `Fakerator(\"nb-NO\");` | [faker.js](https://github.com/Marak/faker.js)\npl-PL     | Polish                | `Fakerator(\"pl-PL\");` | [faker.js](https://github.com/Marak/faker.js)\npt-BR     | Brazilian Portuguese  | `Fakerator(\"pt-BR\");` | [Filipe Forattini](https://github.com/filipeforattini)\nru-RU     | Russian               | `Fakerator(\"ru-RU\");` | [faker.js](https://github.com/Marak/faker.js)\nsk-SK     | Slovakian             | `Fakerator(\"sk-SK\");` | [faker.js](https://github.com/Marak/faker.js)\nsv-SE     | Swedish               | `Fakerator(\"sv-SE\");` | [faker.js](https://github.com/Marak/faker.js)\n\n### Custom locale\nPlease read this [how to add a new locale](LOCALES.md)\n\n## Generators\nUse this functions to generate fake random data\n\n### Names\nFunction                          | Description                     | Sample result\n--------------------------------- | ------------------------------- | -----------------------\n`fakerator.names.name()`          | Generate a full name            | \"Dr. Sheryl Gleichner\"\n`fakerator.names.nameM()`         | Generate a male full name (*)   | \"Bruce Weber\"\n`fakerator.names.nameF()`         | Generate a female full name (*) | \"Juanita Daniel\"\n`fakerator.names.firstName()`     | Generate a first name           | \"Marco\"\n`fakerator.names.firstNameM()`    | Generate a male first name (*)  | \"Bruce\"\n`fakerator.names.firstNameF()`    | Generate a female first name (*)| \"Kelly\"\n`fakerator.names.lastName()`      | Generate a last name            | \"Reilly\"\n`fakerator.names.lastNameM()`     | Generate a male last name (*)   | \"Collier\"\n`fakerator.names.lastNameF()`     | Generate a female last name (*) | \"Moore\"\n`fakerator.names.prefix()`        | Generate a name prefix name     | \"Mr.\"\n`fakerator.names.suffix()`        | Generate a name suffix          | \"MD\"\n(*) - if localization support\n \n### Address\nFunction                              | Description                 | Sample result\n------------------------------------- | --------------------------- | -----------------------\n`fakerator.address.country()`         | Give a country name         | \"Romania\"\n`fakerator.address.countryCode()`     | Give a country code         | \"RO\"\n`fakerator.address.countryAndCode()`  | Give a country object       | `{ code: \"RO\", name: \"Romania\" }`\n`fakerator.address.city()`            | Generate a city name        | \"Merlestad\"\n`fakerator.address.street()`          | Generate a street address   | \"96214 Annette Radial Apt. 543\"\n`fakerator.address.streetName()`      | Generate a street name      | \"Gabriel Islands\"\n`fakerator.address.buildingNumber()`  | Generate a building number  | \"196\"\n`fakerator.address.postCode()`        | Generate a post code        | \"54360-6405\"\n`fakerator.address.geoLocation()`     | Generate a geolocation      | `{ latitude: 40.4233, longitude: -131.9741 }` \n`fakerator.address.altitude()`        | Generate an altitude        | 1180\n\n### Phone\nFunction                           | Description                 | Sample result\n-----------------------------------| --------------------------- | -----------------------\n`fakerator.phone.number()`         | Generate a phone number     | \"(640) 552-0763\"\n\n### Company\nFunction                           | Description                 | Sample result\n-----------------------------------| --------------------------- | -----------------------\n`fakerator.company.name()`         | Generate a company name     | \"Weber, Gleichner and Kertzmann Inc.\"\n`fakerator.company.suffix()`       | Generate a company suffix   | \"LLC\"\n\n### Internet data\nFunction                            | Description                 | Sample result\n----------------------------------- | --------------------------- | -----------------------\n`fakerator.internet.userName()`     | Generate a username             | \"kelly.moore14\"\n`fakerator.internet.userName(firstName, lastName)`     | Generate a username based an existing name | \"johndoe19\"\n`fakerator.internet.password(length)` | Generate a password             | \n`fakerator.internet.domain()`       | Generate a domain name      | \"merle-gleichner.net\"\n`fakerator.internet.url()`       | Generate an url      | \"http://ella-parisian.com\"\n`fakerator.internet.email()`       | Generate an email address      | \"kelly.moore@gmail.com\"\n`fakerator.internet.email(firstName, lastName)`       | Generate an email address from an existing name      | \"john.doe@hotmail.com\"\n`fakerator.internet.image(width, height, category)`       | Generate a lorem image      | \"http://lorempixel.com/640/480\"\n`fakerator.internet.mac()`       | Generate a MAC address      | \"65:a1:a6:18:94:0b\"\n`fakerator.internet.ip()`       | Generate an IP v4 address      | \"69.45.112.94\"\n`fakerator.internet.ipv6()`       | Generate an IP v6 address      | \"b2e9:4275:95a9:65a1:a618:940b:a6ce:adb6\"\n`fakerator.internet.color()`       | Generate a color      | \"b76f49\"\n`fakerator.internet.avatar()`       | Give an avatar link (uifaces.com) | [Sample](https://s3.amazonaws.com/uifaces/faces/twitter/snowwrite/128.jpg)\n`fakerator.internet.gravatar()`       | Generate a gravatar link      | [Sample](https://www.gravatar.com/avatar/a91004b566f80271f0a3577f71d43cd4)\n`fakerator.internet.gravatar(email)`       | Generate a gravatar link from an email address      | [Sample](https://www.gravatar.com/avatar/e13743a7f1db7f4246badd6fd6ff54ff)\n\n### Lorem\nFunction                            | Description                 | Sample result\n----------------------------------- | --------------------------- | -----------------------\n`fakerator.lorem.word()`            | Give a lorem word           | \"dolores\"\n`fakerator.lorem.sentence()`        | Generate a lorem sentence   | \"Libero similique quam voluptas soluta.\"\n`fakerator.lorem.paragraph()`       | Give a lorem paragraph      | \"Ut velit enim vel. Unde aut sint possimus velit commodi numquam. Autem expedita dignissimos est qui consequatur et delectus. Et qui necessitatibus voluptas quam. Dicta temporibus animi optio tempora aperiam repudiandae beatae. Placeat quo voluptatibus neque repellendus dolorem.\"\n\n### Date \u0026 time\nFunction                            | Description                 | Sample result\n----------------------------------- | --------------------------- | -----------------------\n`fakerator.date.timezone()`         | Give a timezone                     | \"Asia/Bangkok\"\n`fakerator.date.past(years, refDate)`    | Generate a date in the past         | Date\n`fakerator.date.future(years, refDate)`  | Generate a date in the future       | Date\n`fakerator.date.between(from, to)`       | Generate a date between two dates   | Date\n`fakerator.date.recent(days)`       | Generate a date in recent few days  | Date\n`fakerator.date.age(min, max)`      | Generate an age number              | 26\n`fakerator.date.month()`            | Give a month name                   | \"September\"\n`fakerator.date.weekday()`          | Give a weekday name                 | \"Sunday\"\n`fakerator.date.weekdayShort()`     | Give a short weekday name           | \"Fri\"\n`fakerator.date.weekdayMin()`       | Give a min weekday name             | \"Su\"\n\n### Miscellaneous\nFunction                            | Description                 | Sample result\n----------------------------------- | --------------------------- | -----------------------\n`fakerator.misc.uuid()`             | Generate an [UUID](https://github.com/defunctzombie/node-uuid)           | \"e26717ad-1513-43c5-b7de-2849521fa195\"\n\n### Entities\nYou can generate complex entities\n\n#### User\n```js\nfakerator.entity.user()\n```\nResult:\n```js\n{\n    \"firstName\": \"Ashley\",\n    \"lastName\": \"Kautzer\",\n    \"userName\": \"ashley38\",\n    \"password\": \"yuzasimima\",\n    \"email\": \"ashleykautzer74@hotmail.com\",\n    \"phone\": \"1-485-841-6009\",\n    \"dob\": \"1939-11-22T01:15:16.735Z\",\n    \"website\": \"http://natalie-walker.info\",\n    \"ip\": \"202.26.104.4\",\n    \"avatar\": \"https://s3.amazonaws.com/uifaces/faces/twitter/jakemoore/128.jpg\",\n    \"gravatar\": \"https://www.gravatar.com/avatar/7875d665c96e5e388aa4074697cab0a0\",\n    \"address\": {\n        \"country\": \"Northern Mariana Islands\",\n        \"countryCode\": \"MP\",\n        \"state\": \"Michigan\",\n        \"city\": \"New Jamie\",\n        \"street\": \"1730 Abbott Views Apt. 460\",\n        \"zip\": \"77988\",\n        \"geo\": {\n            \"latitude\": -41.5878,\n            \"longitude\": 34.266400000000004\n        }\n    },\n    \"status\": false\n}\n```\nYou can set genre of user with first parameter.\n```js\n// F - female, M - male\nfakerator.entity.user(\"F\");\n```\n\n#### Address\n```js\nfakerator.entity.address()\n```\nResult:\n```js\n{\n    \"country\": \"Bulgaria\",\n    \"countryCode\": \"BG\",\n    \"state\": \"Indiana\",\n    \"city\": \"North Michele\",\n    \"street\": \"06169 Beer Villages Suite 302\",\n    \"zip\": \"20896\",\n    \"geo\": {\n        \"latitude\": -9.275499999999994,\n        \"longitude\": 92.53280000000001\n    }\n}\n```\n\n#### Company\n```js\nfakerator.entity.company()\n```\nResult:\n```js\n{\n    \"name\": \"Cormier, Murphy and Turcotte Ltd.\",\n    \"email\": \"cormier-murphy-and-turcotte-ltd.90@hotmail.com\",\n    \"phone\": \"044.708.8876 x834\",\n    \"website\": \"https://olgabeatty.info\",\n    \"ip\": \"54.65.201.35\",\n    \"address\": {\n        \"country\": \"Caribbean Netherlands\",\n        \"countryCode\": \"BQ\",\n        \"state\": \"Kansas\",\n        \"city\": \"East Ronnie\",\n        \"street\": \"81019 Cormier Mall\",\n        \"zip\": \"11474-0882\",\n        \"geo\": {\n            \"latitude\": 1.6444000000000045,\n            \"longitude\": 107.97910000000002\n        }\n    }\n}\n```\n\n#### Blog post\n```js\nfakerator.entity.post()\n```\nResult:\n```js\n{\n    \"title\": \"Esse excepturi eum id ab aut dolore veritatis et.\",\n    \"keywords\": [\n        \"commodi\",\n        \"odio\",\n        \"sit\"\n    ],\n    \"created\": \"2016-05-25T18:19:46.283Z\",\n    \"content\": \"Mollitia officiis quam nulla veritatis omnis eius enim quis. Dolorem est reiciendis adipisci. Laboriosam enim saepe sunt nisi. Autem tempora ullam non laborum. Qui dolorem fugiat amet. Eius consectetur ea et minus ipsam et qui unde doloremque.\\r\\nNihil minima aut. Voluptatibus neque at nulla ut expedita laboriosam. Veniam natus voluptates nulla voluptas impedit cumque qui nihil.\\r\\nMinus quos in autem facere dolorem quidem rem rerum. Animi quo eaque debitis nam non earum molestiae. Maxime vitae exercitationem doloremque.\"\n}\n```\n\n## Times\nYou can generate array of items with `times` and `utimes` (unique) functions. \nFirst parameter is the generator function. Second is the length of array. \n\u003e You can pass further parameters, they will be passed to the generator function.\n\n### Usage\n```js\n// Generate 3 names\nfakerator.times(fakerator.names.name, 3);\n// [ \"Ross Hansen\", \"Thomas Pfeffer\", \"Alexis Hauck I\" ]\n\n// Generate 5 username with populate where first name must be 'John'\nfakerator.times(fakerator.populate, 5, \"#{internet.userName}\", \"John\");\n// [ 'john.langosh8341', 'john12', 'john.howe5075', 'john_jerde', 'john.grant9923' ]\n\n// Generate 5 number from 1 to 10\nfakerator.times(fakerator.random.number, 5, 1, 10);\n// [ 10, 8, 1, 8, 5 ]\n// Note: 8 is twice!\n\n// Generator 5 UNIQUE number from 1 to 10\nfakerator.utimes(fakerator.random.number, 5, 1, 10);\n// [ 10, 2, 9, 6, 1 ]\n// Note: every number is unique!\n```\n\n## Templates\nYou can also generate fake data with templates:\n\n```js\nfakerator.populate(\"#{names.name}\")\n// Ross Hansen\n```\n\n```js\nfakerator.populate(\"#{address.street}\")\n// 0662 Ferry Drive\n```\n\n```js\nfakerator.populate(\"Hi, my name is #{names.name}. I was born in #{address.city}, #{address.country}. I am #{date.age} years old.\")\n// Hi, my name is Mrs. Rufus Shanahan. I was born in Hilpertton, Denmark. I am 44 years old.\n```\n\n### Replace symbols\nThe populate replace `#` symbol to a random number and `?` symbol to a random letter.\n```js\nfakerator.populate(\"#{names.firstName}-###-???\")\n// Mandy-802-oqs\n```\n\n\n## TODO\n\n\n## Contribution\nPlease send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.\n\n## License\nfakerator is available under the [MIT license](https://tldrlegal.com/license/mit-license).\n\n## Contact\n\nCopyright (C) 2021 Icebob\n\n[![@icebob](https://img.shields.io/badge/github-icebob-green.svg)](https://github.com/icebob) [![@icebob](https://img.shields.io/badge/twitter-Icebobcsi-blue.svg)](https://twitter.com/Icebobcsi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficebob%2Ffakerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficebob%2Ffakerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficebob%2Ffakerator/lists"}