Skip to content

Latest commit

 

History

History
112 lines (82 loc) · 2.84 KB

READEME.zh-en.md

File metadata and controls

112 lines (82 loc) · 2.84 KB

简体中文 | English

logo.png

🚀 Randomly generate Chinese names

Version download Coverage Status Test in Vitest PRs Welcome GitHub license

Install

npm install --save cnname

Usage

import cnname from 'cnname';

cnname();
// 李炜
cnname('彭');
// 彭天奇
cnname(5);
// ["俞俐均","王富","东方全","蒲诚","左哲"]
cnname('关', 5);
// ["关智华","关永毓","关宁","关伟星","关炎城"]

API

cnname(): string Get a random Chinese name

cnname(surname: string): string Get a random Chinese name for a specified surname

cnname(num: number): string[] Get a specified number of random Chinese names

cnname(surname: string, num: number): string[] Get the specified surname and number of random Chinese names

Resource

The following is the resource library, if the surname or words you want is missing,PR Welcome

Example

import cnname from 'cnname';

const 主角名字 = cnname();
const 反派名字 = cnname('张');

const novel = `
# 第 1 章 千人围攻

"${主角名字},你已经被我们围攻了!!!"

${反派名字}的厉啸从身后传来,随着尖锐的破空声,一声利箭没入${主角名字}身旁的黄土墙。

${主角名字}心头微凉,定睛一看。

只见阴暗的密林四处,已经隐隐约约钻出千道黑色人影。

他们分别是:

${cnname(1000).join(',')}
`;

Output

LICENSE

MIT