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

@yingzhixiaoyi/utils

v0.0.1

Published

Framework-independent browser and JavaScript utilities

Readme

@yingzhixiaoyi/utils

包定位

@yingzhixiaoyi/utils 是 @yingzhixiaoyi/* 能力体系中的底层通用工具包,提供与具体业务、框架和宿主运行时无关的基础能力。

能力边界

本包适合放置:

  • 纯函数型数据处理;
  • 数字和字符串格式化;
  • URL 参数解析;
  • 通用异步流程控制;
  • 源码迁移所需的命名异步去重、运行环境识别和日志过滤契约;
  • 可在多个项目中复用且不绑定业务身份的基础逻辑。
  • 浏览器剪贴板、UA 和 DOM 事件能力不属于本包,使用 @yingzhixiaoyi/browser-utils。

计划中的首批能力:

formatNumberWithCommas
truncateDecimal
roundUpDecimal
get_random_for_min_max
truncateMiddle(`truncateAddress` 兼容别名已弃用)
getUrlParam / getUrlParams / getAllUrlParams
createOnePromise
onePromiseFn
CustomConsole / console
queueTask

明确不负责的内容

以下能力不属于本包:

  • Vue 组件或 Vue runtime;
  • Wujie 主子应用通信和生命周期;
  • 公司 App Native Bridge;
  • Stripe 支付;
  • Cloudflare Turnstile;
  • 钱包和链特定能力;
  • 业务 API、业务状态和业务配置;
  • 默认修改全局原型或写入全局运行时状态;
  • 未经重新设计的加密实现。

如果迁移过程中发现某项能力无法满足上述边界,应暂停迁移并重新进行能力边界分析,必要时创建独立包。

运行时约束

  • 不依赖 Vue、Wujie 或业务项目。
  • 尽量支持 SSR / Node 环境安全导入。
  • 浏览器专属能力应放入独立的浏览器边界包,不能因为实现方便直接加入本包。
  • 公开 API 必须有类型声明、测试、Demo 和迁移记录。

使用方式

import {
  formatNumberWithCommas,
  onePromiseFn,
  truncateMiddle,
} from '@yingzhixiaoyi/utils'

formatNumberWithCommas(1234567.89)
truncateMiddle('0x1234567890abcdef1234567890abcdef12345678')
await onePromiseFn(() => refreshToken(), 'RefreshToken')

createOnePromise 返回可重复调用的执行器;onePromiseFn 直接返回当前命名任务的 Promise,用于保持源码项目的调用契约。console 是带日志级别过滤的共享实例, 这些 API 不负责业务登录、Native Bridge 或加密;Native App 判断请使用 @yingzhixiaoyi/native-bridge。

文档与验证