Skip to content

A library for generating fake data such as names, addresses, and phone numbers.

License

Notifications You must be signed in to change notification settings

hastebrot/Charlatan

 
 

Repository files navigation

build status Charlatan

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.

Installation

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

Usage

'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

Locales

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.

Credits

Author Eugene Shkuropat

Initially started as fork of Faker.js

Released under the MIT license. See LICENSE for details.

About

A library for generating fake data such as names, addresses, and phone numbers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%