npm.io
0.2.3 • Published 8 years ago

mockachino

Licence
MIT
Version
0.2.3
Deps
0
Size
55 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

Mockachino logo

  • Faker
  • Mocker
  • Mocha?
  • Mochachino?!

Mockachino

Generate mock data for your apps, take a sip and relax!

* People
* Addresses
* Phone Numbers
* Jobs
* Sentences
* Paragraphs
* Texts
* Cities
* & more

Based on US data; other countries to come.

Documentation

How to use

Script tag
<script src="mockachino.min.js"></script>
<script>
    let mocka = new Mockachino().mock();
    //show mocked data in the console
    console.log(mocka.person);
    /*
    e.g: 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.1", … }
    */
</script>
npm
npm i --save-dev mockachino
import or require
//for import remember to transpile your code with babel
const mocka = require('Mockachino');

let mocka = new Mockachino({
    locale: 'us',
    person: {
        sex: 'man',
        height: 'tall',
        age: '20s'
    }
});

console.log(mocka.mock().person);
/*
e.g: Object { name: "Elias", middlename: "Ethan", middleInitial: "E.", lastname: "Coleman", initials: "E.C", email: "elias.coleman@hotmail.com", academicTitle: "Dr.", sex: "man", age: 25, height: "5.10", … }
*/

Options

Option 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
Person
sex woman, man
height tall, short
age young, old, 20s, 30s

Badges

Build Status

Shout outs

lunapic and frankie on Unsplash for the amazing editor and pic that allowed me to make the awesome logo.

jsdoc and minami for being awesome at generating awesome websites from simple comments.

makever for making creating releases on github super easy.

Author

2018 Simao Nziaka

Licence

The MIT License MIT

Keywords