Skip to content

S-PRO/node-elizabeth

Repository files navigation

logo

NPM

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.

Flag Code Name Native name
1 🇨🇿 cs Czech Česky
2 🇩🇰 da Danish Dansk
3 🇩🇪 de German Deutsch
4 🇦🇹 de-at Austrian German Deutsch
5 🇨🇭 de-ch Swiss German Deutsch
6 🇺🇸 en English English
7 🇦🇺 en-au Australian English English
8 🇨🇦 en-ca Canadian English English
9 🇬🇧 en-gb British English English
10 🇪🇸 es Spanish Español
11 🇲🇽 es-mx Mexican Spanish Español
12 🇮🇷 fa Farsi فارسی
13 🇫🇮 fi Finnish Suomi
14 🇫🇷 fr French Français
15 🇭🇺 hu Hungarian Magyar
16 🇮🇸 is Icelandic Íslenska
17 🇮🇹 it Italian Italiano
18 🇯🇵 ja Japanese 日本語
19 🇰🇷 ko Korean 한국어
20 🇳🇱 nl Dutch Nederlands
21 🇧🇪 nl-be Belgium Dutch Nederlands
22 🇳🇴 no Norwegian Norsk
23 🇵🇱 pl Polish Polski
24 🇵🇹 pt Portuguese Português
25 🇧🇷 pt-br Brazilian Portuguese Português Brasileiro
26 🇷🇺 ru Russian Русский
27 🇸🇪 sv Swedish Svenska
28 🇹🇷 tr Turkish Türkçe
29 🇺🇦 uk Ukrainian Український
30 🇨🇳 zh Chinese 汉语

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