Git Product home page Git Product logo

cnname's Introduction

简体中文 | English

logo.png

🚀 随机生成中文名

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 获取一个随机名字

cnname(surname: string): string 获取指定姓氏的随机名字

cnname(num: number): string[] 获取指定数量的随机名字

cnname(surname: string, num: number): string[] 获取指定姓氏和数量的随机名字

Resource

以下为资源库,如果缺少了你想要的姓氏或名字,欢迎补充

Example

import cnname from 'cnname';

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

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

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

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

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

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

他们分别是:

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

输出结果

LICENSE

MIT

cnname's People

Contributors

yyz945947732 avatar

Stargazers

 avatar

Watchers

 avatar

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.