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

@isdk/identifier-variants

v0.2.0

Published

Identifier variant normalization: TensorFlow / tensor_flow / tensor-flow → one form

Readme

@isdk/identifier-variants

English | 中文

标识符变体归一:TensorFlow ≡ tensor_flow ≡ tensor-flow

它解决什么

同一个标识符在不同地方写作不同形式。难点在两个方向的不对称:

合并 Hello World → HelloWorld   普通词组被并掉      ❌
拆分 HelloWorld  → Hello World  只在缺空格处插入    ✅

关键理由:自然文本里不会出现两个词紧贴无空格(thecourt 不是合法英文), 所以"无空格 + 驼峰"是标识符的强信号;而"有空格 + 驼峰"在标题、人名里到处都是。

同样地,hello_world / hello-world 的拆分必须限定在标识符语境 (两侧都是 [A-Za-z0-9]),否则 北京-上海 会被并成 北京上海 —— 那正是第一个问题的镜像。

用法

npm i @isdk/identifier-variants
import { normalizeIdentifier, findIdentifierBreaks } from '@isdk/identifier-variants';

normalizeIdentifier('tensor_flow');  // 'tensor flow'
normalizeIdentifier('TensorFlow');   // 'Tensor Flow'
normalizeIdentifier('北京-上海');     // '北京-上海'(跨脚本不合并)

// 带坐标映射的场景用 findIdentifierBreaks
findIdentifierBreaks('TensorFlow');
// → [{ at: 6, kind: 'insert', sourceLength: 0 }]
findIdentifierBreaks('hello_world');
// → [{ at: 5, kind: 'replace', sourceLength: 1 }]

边界与取舍

  • Hello World 也会被当成 HelloWorld(同样是驼峰形状)。是否启用取决于你的语料里 TensorFlow 多还是 Hello World 多 —— 主包默认关闭
  • findIdentifierBreaks 的存在理由:只导出"最终字符串"的话,高亮/diff 这类带坐标场景 根本用不了,会导致同一规则被写两遍

相关