npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

funny-chinese-name

v1.0.1

Published

一个搞笑中文昵称生成器,支持多种风格和自定义配置

Readme

搞笑中文昵称生成器

一个功能强大、可配置的搞笑中文昵称生成器 npm 包,支持多种风格和自定义配置。

特性

  • 多种生成风格

  • 形容词 + 名词/动物/食物(e.g. 咸鱼王、沙雕网友)

  • 谐音梗/双关(e.g. 范统=饭桶、朱逸群=猪一群)

  • 名人/成语扭曲(e.g. 诸葛亮晶晶、唐僧洗头用飘柔)

  • 沙雕自黑(e.g. 秃头少女、单身狗子)

  • 随机混合

  • 灵活配置

  • 可自定义词汇库

  • 支持添加随机后缀

  • 可限制昵称长度

  • 支持批量生成

  • TypeScript 支持

  • 完整的类型定义

  • 类型安全

  • CLI 工具

  • 命令行快速生成

  • 丰富的参数选项

安装

npm install funny-chinese-name

快速开始

基础用法

import { generate, generateMany } from 'funny-chinese-name';

// 生成单个随机昵称
const name = generate();
console.log(name); // 输出: "咸鱼王"

// 批量生成 10 个昵称
const names = generateMany(10);
console.log(names);

指定风格

import { generate } from 'funny-chinese-name';

// 形容词 + 名词风格
const name1 = generate({ style: 'adjective' });

// 谐音梗风格
const name2 = generate({ style: 'pun' });

// 名人扭曲风格
const name3 = generate({ style: 'celebrity' });

// 自黑风格
const name4 = generate({ style: 'self-mockery' });

// 混合多种风格
const name5 = generate({ style: ['adjective', 'pun', 'self-mockery'] });

添加后缀

import { generate } from 'funny-chinese-name';

const name = generate({
  style: 'adjective',
  withSuffix: true
});
console.log(name); // 输出: "咸鱼王·小可爱"

自定义词汇

import { generate } from 'funny-chinese-name';

const name = generate({
  customAdjectives: ['暴躁', '佛系'],
  customNouns: ['程序员', '设计师'],
  customSuffixes: ['酱', '喵']
});
console.log(name); // 输出: "暴躁程序员·喵"

限制长度

import { generate } from 'funny-chinese-name';

const name = generate({
  maxLength: 6
});
console.log(name); // 输出不超过 6 个字的昵称

使用生成器类

import { FunnyNameGenerator } from 'funny-chinese-name';

// 创建生成器实例
const generator = new FunnyNameGenerator({
  style: 'adjective',
  withSuffix: true
});

// 生成昵称
const name1 = generator.generate();
const name2 = generator.generate();

// 批量生成
const names = generator.generateMany(10);

// 动态更新配置
generator.updateConfig({ style: 'pun' });
const name3 = generator.generate();

// 获取当前词汇库
const vocab = generator.getVocabulary();
console.log(vocab);

CLI 使用

安装后可以直接使用命令行工具:

# 生成单个昵称
funny-name

# 生成多个昵称
funny-name -n 10

# 指定风格
funny-name -s adjective
funny-name -s pun,celebrity

# 添加后缀
funny-name --suffix

# 限制长度
funny-name --max-length 8

# 组合使用
funny-name -n 5 -s adjective,pun --suffix --max-length 10

# 查看帮助
funny-name --help

API 文档

generate(config?: GeneratorConfig): string

生成单个昵称。

参数:

  • config - 生成配置选项

返回:

  • 生成的昵称字符串

generateMany(count: number, config?: GeneratorConfig): string[]

批量生成昵称。

参数:

  • count - 生成数量
  • config - 生成配置选项

返回:

  • 生成的昵称数组

FunnyNameGenerator

生成器类,提供更灵活的 API。

构造函数:

new FunnyNameGenerator(config?: GeneratorConfig)

方法:

  • generate(config?: GeneratorConfig): string - 生成单个昵称
  • generateMany(count: number, config?: GeneratorConfig): string[] - 批量生成昵称
  • updateConfig(config: GeneratorConfig): void - 更新配置
  • getVocabulary(): VocabularyData - 获取当前词汇库

配置选项

GeneratorConfig

interface GeneratorConfig {
  /** 生成风格 */
  style?: NameStyle | NameStyle[];

  /** 是否添加后缀 */
  withSuffix?: boolean;

  /** 自定义后缀列表 */
  customSuffixes?: string[];

  /** 自定义形容词 */
  customAdjectives?: string[];

  /** 自定义名词 */
  customNouns?: string[];

  /** 自定义谐音梗 */
  customPuns?: string[];

  /** 自定义名人/成语梗 */
  customCelebrityTwists?: string[];

  /** 自定义自黑梗 */
  customSelfMockery?: string[];

  /** 最大长度限制 */
  maxLength?: number;
}

NameStyle

生成风格类型:

  • 'adjective' - 形容词 + 名词/动物/食物
  • 'pun' - 谐音梗/双关
  • 'celebrity' - 名人/成语扭曲
  • 'self-mockery' - 沙雕自黑
  • 'random' - 随机混合(默认)

开发

# 安装依赖
npm install

# 构建
npm run build

# 运行测试
npm test

# 开发模式(监听文件变化)
npm run dev

示例

更多示例请查看 examples 目录。

许可证

MIT

贡献

欢迎提交 Issue 和 Pull Request!

作者

LLLxj


享受生成搞笑昵称的乐趣!