This is node.js port of ruby's Faker library, that generates fake data such as names, addresses and phone numbers.
See API Documentation for more details.
Install Charlatan from npm registry:
$ npm install charlatan
Or install bleeding edge version from GitHub repo:
$ git clone git://github.com/shkuropat/Charlatan.git ./node_modules/charlatan
'use strict';
var Charlatan = require('charlatan');
var name = Charlatan.Name.name(); // Joshua Lemke MD
var email = Charlatan.Internet.email(); // glover_ii@voluptas.name
var company = Charlatan.Company.name(); // Wilkinson LLC
Different country has different data formats. Charlatan support locales as solution of this problem.
Avaliable locales see here, en
is default.
'use strict';
var Charlatan = require('charlatan');
Charlatan.setLocale('en-us');
Charlatan.Name.name();
Also you can use your own locale in yaml or plain hash. Yaml format see here
var Charlatan = require('charlatan');
Charlatan.addLocale(myLocaleName, myLocaleFile);
Charlatan.setLocale(myLocaleName);
Charlatan.Name.name();
Note: If some phrase not found in current locale, then fallbacks to base language (and then to en
), for example ru_RU -> ru -> en
.
Author Eugene Shkuropat
Initially started as fork of Faker.js
Released under the MIT license. See LICENSE for details.