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

dingtalk-masker

v1.1.3

Published

钉钉姓名脱敏工具 - 从文本中提取姓名并替换为部门+姓名某格式

Readme

dingtalk-masker

钉钉姓名脱敏工具 - 从文本中提取姓名并替换为"部门+姓名某"格式,同时支持组织架构和人员查询。

功能特性

  • 姓名脱敏:从文本中提取中文姓名,替换为"部门+姓名某"格式
  • 邮箱脱敏
    • 企业内用户邮箱:首****尾@原始域名首****尾.域名后缀
    • 非企业用户但域名在脱敏列表:首****尾@域名首***尾.域名后缀
  • 手机号脱敏:138****5678 格式
  • 组织架构:查询部门列表、部门详情、获取部门下用户
  • 人员管理:查询人员列表、人员详情、搜索人员(支持模糊/精确)

安装

npm install -g dingtalk-masker

配置

创建配置文件 ~/.dingtalk-masker/config.json

{
  "dingtalk": {
    "appKey": "your_app_key",
    "appSecret": "your_app_secret"
  },
  "mask": {
    "maskedDomains": ["qq.com", "163.com"],
    "domainMaskMode": "domain_only"
  }
}

脱敏配置说明

| 配置项 | 说明 | 示例 | |--------|------|------| | maskedDomains | 需要脱敏的域名列表 | ["qq.com", "example.com"] | | domainMaskMode | 脱敏模式:domain_onlyfull | domain_only |

脱敏效果示例

| 原始邮箱 | domain_only | full | |---------|-------------|------| | [email protected] | test@e***e.com | t****t@e***e.com | | [email protected] | john@q***q.com | j****n@q***q.com |

使用

姓名脱敏

# 处理文本,将姓名替换为"部门+姓名某"格式
dingtalk-masker mask process "今天张三出去了"
# 今天项目部张某出去了

# 提取文本中的姓名候选
dingtalk-masker mask extract "今天张三出去了"
# ["张三", "张三出"]

邮箱脱敏

# 企业内用户邮箱脱敏
dingtalk-masker mask process "张三邮箱[email protected]"
# 张三邮箱z****n@e***e.com

# 非企业用户但域名在脱敏列表
dingtalk-masker mask process "联系人邮箱[email protected]"
# 联系人邮箱t***t@q***q.com

组织架构

# 获取部门列表
dingtalk-masker org list

# 获取部门详情
dingtalk-masker org get <deptId>

# 获取部门下用户
dingtalk-masker org users <deptId>

人员管理

# 获取所有人员列表
dingtalk-masker user list

# 获取用户详情
dingtalk-masker user get <userId>

# 搜索用户(默认模糊匹配)
dingtalk-masker user search 张三

# 精确搜索
dingtalk-masker user search 张三 --exact

输出格式

# 默认格式化输出(友好阅读)
dingtalk-masker user list

# JSON 格式输出(程序调用)
dingtalk-masker user list --json

工作原理

姓名提取

  1. 支持复姓(欧阳、司马、诸葛等 20 个)
  2. 支持单字姓氏 + 1-2 个汉字
  3. 按长度排序,优先匹配完整姓名

邮箱脱敏逻辑

  1. 匹配企业内用户邮箱 → 脱敏为 首****尾@原始域名首****尾.域名后缀
  2. 未匹配但域名在 maskedDomains → 按 domainMaskMode 脱敏
  3. 未匹配且域名不在列表 → 不脱敏

部门匹配

  1. 获取用户部门完整路径
  2. 优先返回以"部"结尾的部门
  3. 无"部"结尾则返回最近一层

姓名格式化

  • 单姓:张三 → 张某
  • 复姓:欧阳娜娜 → 欧阳某