Ninja Parading Musically
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »


1.0.12 • Public • Published

Moleculer logo

moleculer-fake NPM version

Fake data generator by Fakerator


npm install moleculer-fake --save


"use strict";
const { ServiceBroker } = require("moleculer");
const broker = new ServiceBroker();
broker.createService(require("moleculer-fake"), { settings: { locale: "es-ES" }});
// Generate a full name"").then(console.log);
/* Result: "Soledad Lozada Tejada" */
// Generate 5 numbers between 0 and 20"fake.number", { max: 20, times: 5 }).then(console.log);
/* Result: [ 18, 4, 16, 11, 11 ] */
// Generate 5 unique number between 0 and 10"fake.number", { max: 10, utimes: 5 }).then(console.log);
/* Result: [ 5, 1, 4, 8, 0 ] */
// Generate a user name in a specified locale"", { locale: "ru-RU"}).then(console.log);
/* Result: "Лобанова Матвей Николаевна" */
// Generate a complete user object"fake.user").then(console.log);
/* Result:
        firstName: 'Marsha',
        lastName: 'Berge',
        userName: 'marsha_berge35',
        password: 'huhefehuje',
        email: '',
        phone: '319.071.6645 x2269',
        dob: 2005-04-07T17:10:26.030Z,
        website: '',
        ip: '',
        avatar: '',
        gravatar: '',
        { country: 'Tristan da Cunha',
            countryCode: 'TA',
            state: 'Utah',
            city: 'Carrollview',
            street: '317 Veum Lakes Apt. 459',
            zip: '10032',
            geo: { latitude: -57.1798, longitude: -64.1921 } },
        status: false

Try it on Runkit


Property Description
locale Initial locale to Fakerator (Available values: cs-CZ, de-DE, en-AU, en-CA, es-ES, fr-FR, hu-HU, it-IT, nb-NO, pl-PL, ru-RU, sk-SK, sv-SE)
seed Initial seed value to Fakerator


Name Params Result Description
fake.boolean likelihoodPercent Boolean Generate a random boolean
fake.number min, max Number Generate a random number
fake.digit - Number Generate a digit (0..9)
fake.letter - String Generate a letter (a..z)
fake.arrayElement array any Give a random element from the array
fake.objectElement object Object Give a random { key: value } from the object
fake.masked mask String Generate a masked string ( a - lowercase letter, A - uppercase letter, 9 - digit, * - letter or digit)
fake.hex length String Generate a random hexadecimal number
fake.string length String Generate a random string - String Generate a full name
fake.nameM - String Generate a male full name (*)
fake.nameF - String Generate a female full name (*)
fake.firstName - String Generate a first name
fake.firstNameM - String Generate a male first name (*)
fake.firstNameF - String Generate a female first name (*)
fake.lastName - String Generate a last name
fake.lastNameM - String Generate a male last name (*)
fake.lastNameF - String Generate a female last name (*)
fake.prefix - String Generate a name prefix
fake.suffix - String Generate a name suffix
fake. - String Generate a name suffix - String Give a random country name
fake.countryCode - String Give a random country code
fake.countryAndCode - Object Give a random country object - String Give a random city
fake.street - String Give a random street address
fake.streetName - String Give a random street name
fake.buildingNumber - String Give a random building number
fake.postCode - String Give a random post code
fake.geoLocation - Object Give a random geolocation
fake.altitude - String Give a random altitude
fake.phoneNumber - String Generate a random phone number
fake.companyName - String Generate a random company name
fake.companySuffix - String Generate a random company name suffix
fake.companySuffix - String Generate a random company name suffix
fake.userName firstName, lastName String Generate a random username
fake.password - String Generate a random password
fake.domain - String Generate a domain name
fake.url - String Generate an URL firstName, lastName String Generate an email address
fake.image width, height, category String Generate an image URL
fake.mac - String Generate a MAC address
fake.ip - String Generate an IPv4 address
fake.ipv6 - String Generate an IPv6 address
fake.color - String Generate a random color
fake.avatar - String Give a random avatar URL
fake.gravatar email String Generate a gravatar URL
fake.word - String Give a random word
fake.sentence - String Generate a sentence
fake.paragraph - String Generate a paragraph
fake.uuid - String Generate an UUID
fake.user gender String Generate a User entity
fake.address - String Generate an Address entity - String Generate a Company entity - String Generate a Post entity
fake.populate template String Populate a template string

(*) - if supported by localization


$ npm test

In development with watching

$ npm run ci


The project is available under the MIT license.


Copyright (c) 2016-2018 MoleculerJS

@moleculerjs @MoleculerJS


npm i moleculer-fake

Downloadsweekly downloads









last publish


  • avatar
Report a vulnerability