Generate mock data for your apps, take a sip and relax!
Based on US data; other countries to come.
<script src="mockachino.min.js"></script>
<script>
// no options provided
let mocked = Mockachino.mock();
// show mocked data in the console
console.log(mocked.phoneNumber);
/* Object { cityCode: "468", country: "us", countryCode: "+1", number: "4687012345", subNumber: "7012345", withAreaCode: "+14687012345" }
*/
</script>
npm i -D mockachino
const mockachino = require('Mockachino');
// with no options provided
let mocked = Mockachino.mock({
locale: 'us',
person: {
sex: 'man',
height: 'short',
age: '20s'
}
});
console.log(mocked.person);
/*
Object { name: "Valentina", middlename: "Nevaeh", middleInitial: "N.", lastname: "Adams", initials: "V.A", email: "valentina.adams@hotmail.com", academicTitle: "Prof.", sex: "woman", age: 23, height: "4.5", … }
*/
mockachino.mock
optionsOption | Description |
---|---|
Locale | Defines the locale the data should be based on. Defaults to 'us', more locales to come |
Person | Mock a person, define the person sex, age, and height |
-- | -- |
sex | woman, man |
height | tall, short |
age | young, old, 20s, 30s |
mockachino.random
usageData | Description | Usage |
---|---|---|
Number | Just a random number | Mockachino.random(200, 15).number; // A random number from 15 to 199 |
Title | A random placeholder title | Mockachino.random('-').title; // A-random-title separated by '-' |
ImageUrl | A random image URL from Picsum | Mockachino.random(350, 300).imageUrl; // A random image URL of 350x300 size from Picsum |
ImageBlob | A random image blob from Picsum | Mockachino.random(400, 500).imageBlob; // A random image Blob of 400x500 size from Picsum |
The MIT License MIT
© 2018 Simao Nziaka
Generated using TypeDoc