@anonymitybot/is-educational-email-domain

中文文档
1.0.6发布于 2020/10/29MITCommonJS零依赖近 30 天下载 1.5万

Check if an email domain belongs to an educational instutition

原始使用文档
文档目录8 节
  1. Why?
  2. Why Open Source?
  3. API
  4. hasCommonEducationalTld(domain)
  5. hasAdhocEducationalTld(domain)
  6. isEducationalEmailDomain(domain)
  7. Where is the data coming from?
  8. Example

is-educational-email-domain

Check if an email domain belongs to an educational institution.

CircleCI Coverage Status version

Why?

We offer AnonymityBot for free for educational workspaces but couldn't find an efficient way to detect email domains of educational institutions.

Why Open Source?

Why not?

We’ve been students and lecturers ourselves and personally felt the communicational hardships affecting both sides (the fear of being ridiculed for asking a question, the moment no one asks questions - not knowing if they got it, etc.) and therefore think that more software should offer Pro Bono tiers for educational purposes.

For this reason, we decided to open source our software that automatically detects if an email domain belongs to an educational institution.

You can read more here.

API

hasCommonEducationalTld(domain)

We call a TLD Common Educational TLD if it is either .edu, .edu.xx or .ac.xx and was fetched from publicsuffix.org.

hasAdhocEducationalTld(domain)

Some institutions don't use edu or ac TLDs, and (usually) use their own country code. For instance, University of Oslo has an email domain for each department - math.uio.no, fys.uio.no - in order to capture all such departments we simply check for uio.no.

isEducationalEmailDomain(domain)

Combines hasCommonEducationalTld and hasAdhocEducationalTld:

const isEducationalEmailDomain = (domain) =>
  hasCommonEducationalTld(domain) || hasAdhocEducationalTld(domain);

Where is the data coming from?

See ./assets.

Example

Install with yarn add @anonymitybot/is-educational-email-domain:

const {
  isEducationalEmailDomain,
  hasAdhocEducationalTld,
  hasCommonEducationalTld,
} = require('@anonymitybot/is-educational-email-domain');

(async () => {
  hasCommonEducationalTld('stanford.edu'); // true
  hasCommonEducationalTld('u-tokyo.ac.jp'); // true
  hasCommonEducationalTld('cuhk.edu.cn'); // true

  hasCommonEducationalTld('bla.cc'); // false - .ac is a ccTLD

  hasAdhocEducationalTld('math.ethz.cz'); // true - etch.cz is an ad-hoc educational domain
  hasAdhocEducationalTld('stanford.edu'); // false - .edu is a common educational tld (but not an ad-hoc one)

  isEducationalEmailDomain('stanford.edu'); // true
  isEducationalEmailDomain('math.ethz.cz'); // true

  isEducationalEmailDomain('bla.cc'); // false - .ac is a ccTLD
})()

版本与发布记录

@anonymitybot/is-educational-email-domain 共发布 7 个版本,首次发布于 2020/10/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.6latest2020/10/296 年前
1.0.52020/10/296 年前
1.0.42020/10/276 年前
1.0.32020/10/226 年前
1.0.22020/10/226 年前
1.0.12020/10/226 年前

关于 @anonymitybot/is-educational-email-domain 的常见问题

@anonymitybot/is-educational-email-domain 是什么?

Check if an email domain belongs to an educational instutition

如何安装 @anonymitybot/is-educational-email-domain?

在项目目录运行 npm install @anonymitybot/is-educational-email-domain,或使用 pnpm add / yarn add / bun add。

@anonymitybot/is-educational-email-domain 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/anonymitybot__is-educational-email-domain 是否存在。

@anonymitybot/is-educational-email-domain 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@anonymitybot/is-educational-email-domain 可以商用吗?

@anonymitybot/is-educational-email-domain 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@anonymitybot/is-educational-email-domain 的下载量有多少?

根据 npm 官方下载统计,@anonymitybot/is-educational-email-domain 在 2026/10/06 – 2026/11/04 这 30 天内被下载 15,469 次,日均约 516 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@anonymitybot/is-educational-email-domain 还在维护吗?

最新版本 1.0.6 发布于 2020/10/29(6 年前);至今共发布 7 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/10/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。