1.0.2 • Published 11 years ago

fake.js v1.0.2

Weekly downloads
2
License
-
Repository
github
Last release
11 years ago

Fakejs

FakeJS is a module based on Chance to generate Data Model (Random) at runtime.

Quick Examples

The model to create:

var child = {
	id : 'hash',
	name : 'first',
	age : 'age',
	email : 'email',
	birthday : 'birthday',

	id : function(){
		return 'US ' + Math.ceil(Math.random() * 1000);
	},	

	fatherName: 'John Doe'
};

Using Fake.js

var fake = require('fake');
fake.create(child, 2, function(data){
	console.log(data);
});

The result :

[ 
    { 
        id: 'US 736',
        name: 'Erick',
        age: 2,
        email: 'leluzib@uta.gov',
        birthday: Sun Jul 26 1942 00:00:00 GMT-0300 (BRT),
        fatherName: 'John Doe' 
    },
  { 
        id: 'US 760',
        name: 'Gabriel',
        age: 76,
        email: 'wu@ubjurhan.org',
        birthday: Tue May 05 1953 00:00:00 GMT-0300 (BRT),
        fatherName: 'John Doe' 
    } 
]