@empyria/name

中文文档
0.1.22发布于 2026/11/01MITES Module

Name and title manipulation library for Empyria

原始使用文档
文档目录6 节
  1. Requirements
  2. Install
  3. Usage
  4. Modules
  5. Scripts
  6. License

@empyria/name

Name and title manipulation utilities for Empyria, a nanoservice framework built primarily on Bun.

Provides a curated list of honorifics/titles (TITLE_LIST/TITLES) spanning common, formal, academic, and religious usage, plus findTitle to resolve free-text input (any case, punctuation, or transliterable script) to its canonical form. The generic string helpers TRANS, capitalise, and shortify, and transliterate/slugify from the transliteration package, are re-exported here for convenience since name/title handling relies on them heavily.

Requirements

  • Bun >=1.4.0 or Node.js >=26
  • Plain ESM, no build step, no TypeScript

Install

bun add @empyria/name

Usage

import { findTitle, TITLES, capitalise, slugify } from '@empyria/name'

findTitle('dr.') // 'Dr'
findTitle('Vice-Chancellor') // 'Vice-Chancellor'
findTitle('Wizard') // undefined — not a recognised title

TITLES.DR // 'Dr'

capitalise('jean') // 'Jean'
slugify('Jean Pierre') // 'jean-pierre'

Modules

ModulePurpose
index.jsPackage entry point; re-exports lib/Name.js.
lib/Name.jsTITLE_LIST/TITLES (the full title catalog), findTitle, plus TRANS/capitalise/shortify/transliterate/slugify re-exported from @empyria/classification/transliteration for convenience.

Tests live under test/, one file per module, separate from the lib/ sources.

Scripts

bun run format       # check formatting (oxfmt)
bun run format:fix   # apply formatting
bun run lint         # lint (oxlint)
bun run lint:fix     # lint and fix
bun run test         # run tests with coverage

License

MIT © Imre Fazekas

版本与发布记录

@empyria/name 共发布 22 个版本,首次发布于 2026/09/05;过去 12 个月发布了 22 个版本。

版本发布日期距今
0.1.22latest2026/11/012 天前
0.1.212026/10/295 天前
0.1.202026/10/259 天前
0.1.192026/10/2311 天前
0.1.182026/10/1815 天前
0.1.172026/10/1618 天前

关于 @empyria/name 的常见问题

@empyria/name 是什么?

Empyria的名称和标题操作库

如何安装 @empyria/name?

在项目目录运行 npm install @empyria/name,或使用 pnpm add / yarn add / bun add。

@empyria/name 支持 TypeScript 吗?

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

@empyria/name 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@empyria/name 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=26。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@empyria/name 可以商用吗?

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

@empyria/name 还在维护吗?

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