npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

moleculer-fake

v1.0.18

Published

Fake data generator by Fakerator

Downloads

49

Readme

Moleculer logo

moleculer-fake NPM version

Fake data generator by Fakerator

Install

npm install moleculer-fake --save

Usage

"use strict";

const { ServiceBroker } = require("moleculer");

const broker = new ServiceBroker();

broker.createService(require("moleculer-fake"), { settings: { locale: "es-ES" }});

// Generate a full name
broker.call("fake.name").then(console.log);
/* Result: "Soledad Lozada Tejada" */

// Generate 5 numbers between 0 and 20
broker.call("fake.number", { max: 20, times: 5 }).then(console.log);
/* Result: [ 18, 4, 16, 11, 11 ] */

// Generate 5 unique number between 0 and 10
broker.call("fake.number", { max: 10, utimes: 5 }).then(console.log);
/* Result: [ 5, 1, 4, 8, 0 ] */

// Generate a user name in a specified locale
broker.call("fake.name", { locale: "ru-RU"}).then(console.log);
/* Result: "Лобанова Матвей Николаевна" */

// Generate a complete user object
broker.call("fake.user").then(console.log);
/* Result:
    { 
        firstName: 'Marsha',
        lastName: 'Berge',
        userName: 'marsha_berge35',
        password: 'huhefehuje',
        email: '[email protected]',
        phone: '319.071.6645 x2269',
        dob: 2005-04-07T17:10:26.030Z,
        website: 'http://laurence.biz',
        ip: '236.82.114.84',
        avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/guillemboti/128.jpg',
        gravatar: 'https://www.gravatar.com/avatar/c89beff0132a6eaad9d03e9058b5378e',
        address: 
        { 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

Settings

| 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 |

Actions

| 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 | | fake.name | - | 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 | | fake.country | - | String | Give a random country name | | fake.countryCode | - | String | Give a random country code | | fake.countryAndCode | - | Object | Give a random country object | | fake.city | - | 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 | | fake.email | 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 | | fake.company | - | String | Generate a Company entity | | fake.post | - | String | Generate a Post entity | | fake.populate | template | String | Populate a template string |

(*) - if supported by localization

Test

$ npm test

In development with watching

$ npm run ci

License

The project is available under the MIT license.

Contact

Copyright (c) 2016-2019 MoleculerJS

@moleculerjs @MoleculerJS