- 📅 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.
npm install --save-dev mockado
// 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(),
};
}
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.
// 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
// 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
// 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
// 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
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const email = mockado.email();
console.log(email);
// output: william96@gmail.com
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const email = mockado.email({type: "yahoo.com"});
console.log(email);
// output: patrick162@yahoo.com
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const email = mockado.email({type: "yahoo.com", gender: "female"});
console.log(email);
// output: ella648@yahoo.com
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const password = mockado.password();
console.log(password);
// output: Dkoq>kfk
// 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&
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const date = mockado.date();
console.log(date)
// output: 1974-01-24
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const date = mockado.date({format: "DD MMM YYYY"});
console.log(date)
// 02 Dec 1994
// 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
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const phone = mockado.phone()
console.log(phone)
// +55 89 81370-2069
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const phone = mockado.phone({code: "EUA"})
console.log(phone)
// +1 730 773-6805
// 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
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const location = mockado.location("street")
console.log(location)
// Praça XV de Novembro
// ESM
import mockado from 'mockado';
// CJS
const mockado = require('mockado');
const location = mockado.location("zipCode")
console.log(location)
// 51011-000