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

uve-utils

v1.1.26

Published

通用工具库

Readme

uve-utils

一个功能丰富的通用工具库,专为现代 Web 开发和政务端(浙政钉、浙里办)应用设计。

特性

  • 🚀 单文件打包:基于 Vite 构建,输出精简的 ESM 和 CJS 单文件。
  • 🛠️ 通用工具:包含正则表达式校验、日期格式化、数据类型判断、金额格式化等常用工具。
  • 🔒 加密算法:集成 AES 以及国密算法(SM2, SM3, SM4)。
  • 🏛️ 政务端支持:专门针对浙政钉浙里办环境的初始化、埋点和授权封装。
  • 📦 开箱即用:支持 TypeScript,提供完整的类型定义。

安装

npm install uve-utils
# 或者
yarn add uve-utils

快速使用

通用工具

import { utils } from 'uve-utils';

// 手机号校验
utils.checkPhoneNumber('13800138000'); // true

// 身份证校验
utils.checkIdentityId('330101199001011234');

// 日期格式化
utils.dateFormat(new Date(), 'YYYY-MM-DD HH:mm:ss');

// AES 加密
const encrypted = utils.encryptAes('Hello World');
const decrypted = utils.decryptAes(encrypted);

浙政钉/浙里办初始化

import { initZhezhengding, initZheliban } from 'uve-utils';

// 初始化浙政钉配置
initZhezhengding({
  enable: true,
  bid: 'your_bid',
  signkey: 'your_signkey',
  sapp_id: 'your_sapp_id',
  sapp_name: 'your_sapp_name'
});

// 初始化浙里办配置
initZheliban({
  enable: true,
  appTitle: '应用名称',
  bid: 'your_bid'
});

API 说明

utils (常用工具)

| 方法 | 说明 | | --- | --- | | checkPhoneNumber(phone) | 验证手机号码格式 | | checkIdentityId(id) | 验证身份证号码合法性 | | isNumber(val) | 判断是否为纯数字 | | numberChinese(num) | 数字转中文大写 | | dateFormat(date, format) | 日期格式化 | | getOsType() | 获取系统类型 (1:IOS, 2:Android, 3:Win, 4:Mac) | | getBrowserType() | 获取浏览器环境 (浙里办, 浙政钉, 微信等) | | hideString(str, start, len) | 字符串脱敏 | | uuid() | 生成唯一标识 | | moneyFormat(num) | 金额千分位格式化 | | encryptAes / decryptAes | AES 加解密 | | encryptSm2 / decryptSm2 | 国密 SM2 加解密 | | encryptSm4 / decryptSm4 | 国密 SM4 加解密 |

浙政钉埋点与授权

| 方法 | 说明 | | --- | --- | | createBaseBurialPointZzd(config) | 基础埋点 | | createUserInfoBurialPointZzd(config) | 用户信息埋点 | | getAuthCodeZzd() | 获取免登授权码 (Promise) |

浙里办埋点

| 方法 | 说明 | | --- | --- | | zwlogGlobalZlb(config) | 浙里办全局日志埋点 |

开发与构建

项目采用 Vite 进行构建,输出单文件 bundle。

# 安装依赖
yarn install

# 构建项目
yarn build

构建产物位于 dist 目录:

  • index.js: ESM 模块
  • index.cjs: CommonJS 模块
  • index.d.ts: 类型声明文件
  • zzd.html/zlb.html: 预置资产文件

License

ISC