@clampy-js/clampy

中文文档
1.0.10发布于 2019/06/06MITESM + CJS零依赖近 30 天下载 2044

Clamps an HTML element by adding ellipsis to it if the content inside is too long.

原始使用文档
文档目录3 节
  1. Clamps an HTML element by adding ellipsis to it if the cont…
  2. Documentation
  3. Examples

clampy

Clamps an HTML element by adding ellipsis to it if the content inside is too long.

Build Status GitHub issues GitHub license npm

This is basically a fork of the (unfortunately abandoned) project Clamp.js partially converted to Typescript and bundled using the excellent Typescript library starter from Alex Jover.

Most fixes from pull requests on the original project were included.

*Note that the following options were removed from the original library:

  • useNativeClamp
  • animate

Documentation

Documentation is available here.

Examples

A demo is available here.

版本与发布记录

@clampy-js/clampy 共发布 11 个版本,首次发布于 2017/09/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.10latest2019/06/067 年前
1.0.92018/05/148 年前
1.0.82018/04/268 年前
1.0.72018/01/178 年前
1.0.62017/11/089 年前
1.0.52017/09/209 年前

关于 @clampy-js/clampy 的常见问题

@clampy-js/clampy 是什么?

Clamps an HTML element by adding ellipsis to it if the content inside is too long.

如何安装 @clampy-js/clampy?

在项目目录运行 npm install @clampy-js/clampy,或使用 pnpm add / yarn add / bun add。

@clampy-js/clampy 支持 TypeScript 吗?

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

@clampy-js/clampy 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@clampy-js/clampy 需要什么版本的 Node.js?

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

@clampy-js/clampy 可以商用吗?

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

@clampy-js/clampy 的下载量有多少?

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

@clampy-js/clampy 还在维护吗?

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