1.1.0 β€’ Published 1 year ago

random-chinese-name v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Introduction

🍭 Hello, this is a random name generator library for Chinese online literature authors.

πŸ‰ Currently supported name types include: Human, Animal, Clothes, Cheats, Elixir, Organize, Place, Plant, and weapon.

δΈ­ζ–‡ζ–‡ζ‘£

Installation

Use npm to install the package, as shown below:

npm install random-chinese-name --save

Types

Before using the library, we need to know the names of the name types, as shown in the table below:

TypeNameTypeNameTypeName
HumanhumanAnimalanimalClothesclothes
CheatscheatsElixirelixirOrganizeorganize
PlaceplacePlantplantWeaponweapon

Import

To use the library in a CommonJS project, import it as follows:

const { <type name> } = require('random-chinese-name');

To use the library in a Module project, import it as follows:

import { <type name> } from "random-chinese-name";

Parameters

There are only two common parameters, as shown in the table below:

FieldMeaningRangeDefault
limitNumber of characters in the nameHuman 2, 4 , others 2, 7 2
countNumber of names to generate 1, 100 100

For the human type, which is the most special type, with distinctions between single and compound surnames and gender, two additional parameters are added:

FieldMeaningDefault
maleWhether the name is for a maletrue
singleWhether the surname is a single surnametrue

Examples

Human names:

/** Male, single surname, two characters, 100 names */ 
human.getName();

/** Female, single surname, two characters, 100 names */ 
human.getName({ male: false });

/** Female, compound surname, three characters, 100 names */ 
human.getName({ male: false, single: false });

/** Female, compound surname, three characters, 100 names */ 
/** Note: when using a compound surname, limit defaults to 3, so limit does not need to be set here */ 
human.getName({ male: false, single: false, limit: 3 });

/** Female, compound surname, four characters, 20 names */ 
human.getName({ male: false, single: false, limit: 4, count: 20 });

Other names:

<type name>.getName();
<type name>.getName({ limit: 6 });
<type name>.getName({ limit: 6, count: 50 });
1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago