Git Product home page Git Product logo

full-name-generator's Introduction

Full Name Generator - Generate Random Names

npm-version npm-downloads

Generate random names effortlessly using various data sources of popular first names and surnames from multiple countries.

If you find this package helpful, please consider โญ starring it on GitHub.

Installation

$ npm install full-name-generator --save

Usage

import { firstName, lastName, fullName } from 'full-name-generator';

// Generate Full Names
const maleFullName = fullName('US', 0);
const femaleFullName = fullName('US', 1);

// Generate First Names
const maleFirstName = firstName('US', 0);
const femaleFirstName = firstName('US', 1);

// Generate Surnames
const turkishSurname = lastName('TR');
const czechFemaleSurname = lastName('CZ', 1);

// Generate Multiple Names
const twoAmericanMaleFirstNames = firstName('US', 0, 2);
const twoAmericanLastNames = lastName('US', null, 2);
const twoAmericanNamesThreeSurnamesFemaleFullName = fullName('US', 1, 2, 3);

Countries

  • ๐Ÿ‡ฆ๐Ÿ‡ท Argentina (AR)
  • ๐Ÿ‡ฆ๐Ÿ‡น Austria (AT)
  • ๐Ÿ‡ง๐Ÿ‡ช Belgium (BE)
  • ๐Ÿ‡ง๐Ÿ‡ท Brazil (BR)
  • ๐Ÿ‡จ๐Ÿ‡ณ China (CN)
  • ๐Ÿ‡จ๐Ÿ‡ฟ Czechia (CZ)
  • ๐Ÿ‡ฉ๐Ÿ‡ฐ Denmark (DK)
  • ๐Ÿ‡ซ๐Ÿ‡ฎ Finland (FI)
  • ๐Ÿ‡ซ๐Ÿ‡ท France (FR)
  • ๐Ÿ‡ฉ๐Ÿ‡ช Germany (DE)
  • ๐Ÿ‡ฌ๐Ÿ‡ท Greece (GR)
  • ๐Ÿ‡ฎ๐Ÿ‡ณ India (IN)
  • ๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesia (ID)
  • ๐Ÿ‡ฎ๐Ÿ‡ฑ Israel (IL)
  • ๐Ÿ‡ฎ๐Ÿ‡น Italy (IT)
  • ๐Ÿ‡ฏ๐Ÿ‡ต Japan (JP)
  • ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico (MX)
  • ๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands (NL)
  • ๐Ÿ‡ณ๐Ÿ‡ด Norway (NO)
  • ๐Ÿ‡ต๐Ÿ‡ฑ Poland (PL)
  • ๐Ÿ‡ต๐Ÿ‡น Portugal (PT)
  • ๐Ÿ‡ท๐Ÿ‡บ Russia (RU)
  • ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Arabia (SA)
  • ๐Ÿ‡ฐ๐Ÿ‡ท South Korea (KR)
  • ๐Ÿ‡ช๐Ÿ‡ธ Spain (ES)
  • ๐Ÿ‡ธ๐Ÿ‡ช Sweden (SE)
  • ๐Ÿ‡น๐Ÿ‡ผ Taiwan (TW)
  • ๐Ÿ‡น๐Ÿ‡ญ Thailand (TH)
  • ๐Ÿ‡น๐Ÿ‡ท Tรผrkiye (TR)
  • ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom (GB)
  • ๐Ÿ‡บ๐Ÿ‡ธ United States (US)
  • ๐Ÿ‡ป๐Ÿ‡ณ Vietnam (VN)

Functions

fullName

Generates a full name based on the provided parameters.

fullName(isoCode: string, gender: Gender, firstN: number = 1, lastN: number = 1, space: string = ' '): string
  • isoCode: The ISO code for the country (e.g., BR, CZ, US).
  • gender: Gender category for the name. (0 - Male, 1 - Female).
  • firstN: Number of first names to be generated (default is 1).
  • lastN: Number of surnames to be generated (default is 1).
  • space: Separator between the first names and surnames (default is a single whitespace).

firstName

Generates one or more first names based on the provided country code and gender.

firstName(isoCode: string, gender: Gender, n: number = 1): string
  • isoCode: The ISO code for the country (e.g., BR, CZ, US).
  • gender: Gender category for the name. (0 - Male, 1 - Female).
  • n: Number of first names to generate (default is 1).

lastName

Generates one or more surnames. For some countries like the Czech Republic or Poland, gender is considered.

lastName(isoCode: string, gender?: Gender, n: number = 1): string
  • isoCode: The ISO code for the country (e.g., BR, CZ, US).
  • gender: (Optional) Gender category for the surname. Required for countries like the Czech Republic. (0 - Male, 1 - Female).
  • n: Number of surnames to generate (default is 1).

License

The MIT License (MIT). Please see License File for more information.

To reference this project, use the code snippet below:

<a href="https://fullnamegenerator.com">Full Name Generator</a>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.