@gosavetool/text

中文文档
1.0.0发布于 2026/11/01MITTypeScriptCommonJS零依赖

字数,阅读时间,社交媒体字符限制,标题大小写,鼻涕虫(土耳其语和重音字母)和空白清理。零依赖关系。

中文使用文档
文档目录6 节
  1. 安装
  2. 计数和阅读时间
  3. 社交媒体和SEO限制
  4. 套管和段塞
  5. 相关
  6. 许可证

@gosavetool /文本

没有依赖的小文本助手:单词和字符计数,阅读时间,社交媒体字符限制,大小写更改,URL标记和空白清理。

由 GoSaveTool. 不需要代码吗?试 字符计数器.

安装

npm install @gosavetool/text

计数和阅读时间

const { stats } = require('@gosavetool/text');

stats('Hello world. It’s 2026!');
// { words: 4, chars: 23, charsNoSpaces: 20, lines: 1, sentences: 2, readSeconds: 1 }

阅读时间为每分钟238个单词,这是非小说类读物的平均默读速度。

社交媒体和SEO限制

const { limits } = require('@gosavetool/text');

limits(caption, ['x-post', 'instagram-caption']);
// { 'x-post': { limit: 280, used: 312, left: -32, fits: false }, 'instagram-caption': { … fits: true } }
名字限制
x-post280
instagram-caption2200年
tiktok-caption4000年
youtube-title100
youtube-description5000年
linkedin-post3,000
pinterest-description500
seo-title60
meta-description160

套管和段塞

const t = require('@gosavetool/text');

t.title('the lord of the rings: return of the king'); // 'The Lord of the Rings: Return of the King'
t.sentence('HELLO WORLD. how ARE you?');               // 'Hello world. How are you?'
t.slug('Ölçü Birimi & Çeviri!');                       // 'olcu-birimi-ceviri'
t.camel('best posting time');                          // 'bestPostingTime'
t.snake('bestPostingTime');                            // 'best_posting_time'
t.kebab('Best Posting_Time');                          // 'best-posting-time'
t.clean('a   b  \n\n\n\nc');                            // 'a b\n\nc'

slug() 将土耳其语(' ',' ',' ‘ ‘,ç, ö, ü),德语(’ ’)和重音字母转换为纯ASCII。

包括TypeScript类型。

许可证

麻省理工学院

版本与发布记录

@gosavetool/text 共发布 2 个版本,首次发布于 2026/11/01;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.0.0latest2026/11/012 天前
0.0.0-stage2026/11/012 天前

关于 @gosavetool/text 的常见问题

@gosavetool/text 是什么?

字数,阅读时间,社交媒体字符限制,标题大小写,鼻涕虫(土耳其语和重音字母)和空白清理。零依赖关系。

如何安装 @gosavetool/text?

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

@gosavetool/text 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gosavetool/text 支持 ESM 还是 CommonJS?

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

@gosavetool/text 需要什么版本的 Node.js?

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

@gosavetool/text 可以商用吗?

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

@gosavetool/text 还在维护吗?

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