0.1.1 • Published 7 years ago

node-elizabeth v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

logo

npm version Build Status Coverage Status Codacy Badge

Description

node-elizabeth is a port of Python library elizabeth for generating dummy data for a variety of purposes. This data can be particularly useful during software development and testing. For example, it could be used to populate a testing database for a web application with user information such as email addresses, usernames, first names, last names, etc.

Installation

yarn add node-elizabeth -D

Documentation

Github pages

Basic Usage

import { Personal } from 'node-elizabeth';
// default locale is 'en'
const person = new Personal();
person.fullName({ gender: 'male' });
// Inell Britt

Locales

You can specify a locale when creating providers and they will return data that is appropriate for the language or country associated with that locale. elizabeth currently includes support for 30 different locales.

FlagCodeNameNative name
1🇨🇿csCzechČesky
2🇩🇰daDanishDansk
3🇩🇪deGermanDeutsch
4🇦🇹de-atAustrian GermanDeutsch
5🇨🇭de-chSwiss GermanDeutsch
6🇺🇸enEnglishEnglish
7🇦🇺en-auAustralian EnglishEnglish
8🇨🇦en-caCanadian EnglishEnglish
9🇬🇧en-gbBritish EnglishEnglish
10🇪🇸esSpanishEspañol
11🇲🇽es-mxMexican SpanishEspañol
12🇮🇷faFarsiفارسی
13🇫🇮fiFinnishSuomi
14🇫🇷frFrenchFrançais
15🇭🇺huHungarianMagyar
16🇮🇸isIcelandicÍslenska
17🇮🇹itItalianItaliano
18🇯🇵jaJapanese日本語
19🇰🇷koKorean한국어
20🇳🇱nlDutchNederlands
21🇧🇪nl-beBelgium DutchNederlands
22🇳🇴noNorwegianNorsk
23🇵🇱plPolishPolski
24🇵🇹ptPortuguesePortuguês
25🇧🇷pt-brBrazilian PortuguesePortuguês Brasileiro
26🇷🇺ruRussianРусский
27🇸🇪svSwedishSvenska
28🇹🇷trTurkishTürkçe
29🇺🇦ukUkrainianУкраїнський
30🇨🇳zhChinese汉语

Using locales:

import { Personal } from 'node-elizabeth';

const en = new Personal();
const de = new Personal({ locale: 'de' });

en.fullName();
// Inell Britt
de.fullName();
//Sabrina Gutermuth

Port limitations

Due to JavaScript limitations there's specific method signatures - all methods take opts object as their single argument. Also first release don't include all the providers, custom providers and decorators from original library.

Running tests

npm run test

Upcoming

  • Generic provider from original library
  • Custom providers