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

mockado

v2.0.3

Published

Have fictitious yet realistic data for your development tests or other needs.

Downloads

118

Readme

npm version npm downloads

Built with

🚀 Features

  • 📅 Dates in different formats - YYYY-MM-DD, DD/MM/YYYY, DD MMM YYYY, YYYY-MM-DD HH:mm:ss
  • 🪪 Identification - CPF, SSN, SIN.
  • 📧 Emails on different domains - gmail.com, hotmail.com, yahoo.com.
  • 🧑 Names based on usability - first name, full name or username.
  • 🔑 Password with whatever charset you want - With or without letters, with or without special characters, with or without numbers.
  • 🌏 Location - A complete location or just the street, neighborhood, state or zipCode.
  • 📱 Phone number - Numbers in BRA or US format.

Note: The data generated seeks to be as realistic as possible, without being obvious. It is possible that real emails, phone numbers or addresses will be generated. Use them responsibly. Don't implement anything in your code that could upset the owners of this data.

📦 Install

npm install --save-dev mockado

🪄 Usage

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

export function createRandomUser() {
  return {
    username: mockado.name({type: "username"}),
    email: mockado.email(),
    password: mockado.password(),
    birthdate: mockado.date(),
  };
}

Scenarios

Mockado always returns default data. To receive personalized data, you need to pass your preferences as a parameter. The type of data returned varies depending on the function called.

First name

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const firstName = mockado.name({type: "firstName"});

console.log(`Hello my name is ${firstName}`);

// output: Hello my name is Ethan

First name with choice of gender

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const firstName = mockado.name({type: "firstName", gender: "female"});

console.log(`Hello my name is ${firstName}`);

// output: Hello my name is Naomi

Full name

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const fullName = mockado.name({type: "fullName"});

console.log(`Hello my name is ${fullName}`);

// output: Hello my name is Casey Pacheco

username

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const username = mockado.name({type: "username"});

console.log(`Hi, my username is ${username}`);

// output: Hi, my username is matthew715

Email

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const email = mockado.email();

console.log(email);

// output: [email protected]

Email with defined domain

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const email = mockado.email({type: "yahoo.com"});

console.log(email);

// output: [email protected]

Email with defined domain and gender

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const email = mockado.email({type: "yahoo.com", gender: "female"});

console.log(email);

// output: [email protected]

Password

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const password = mockado.password();

console.log(password);

// output: Dkoq>kfk

Custom password

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const password = mockado.password({
  letters: true,
  capitalLetters: true,
  numbers: false,
  specialCharacters: true,
  length: 21,
})

console.log(password)

// output: mXjQbfFOMOAbkfejXUoE&

Date

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const date = mockado.date();

console.log(date)

// output: 1974-01-24

Date with custom format

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const date = mockado.date({format: "DD MMM YYYY"});

console.log(date)

// 02 Dec 1994

Date between a specified start and end

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const date = mockado.date({
  start: new Date(1995, 0, 1),
  end: new Date(2018, 0, 1),
})

console.log(date)

// 2011-10-11

Phone number

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const phone = mockado.phone()

console.log(phone)

// +55 89 81370-2069

Telephone number with specified code

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const phone = mockado.phone({code: "EUA"})

console.log(phone)

// +1 730 773-6805

Location

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const location = mockado.location()

console.log(location)

// Estr. das Paineiras, 1 - Alto da Boa Vista, Rio de Janeiro - Rio de Janeiro, 22241-330

Get just the street

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const location = mockado.location("street")

console.log(location)

// Praça XV de Novembro

Get just the zipCode

// ESM
import mockado from 'mockado';

// CJS
const mockado = require('mockado');

const location = mockado.location("zipCode")

console.log(location)

// 51011-000