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

master-utils-lib

v1.0.2

Published

A professional, lightweight, and compatible utility library for H5 and PC web development with TypeScript support

Readme

H5 Utils Lib

A professional, lightweight, and compatible utility library for H5 and PC web development.

Features

  • 📱 Mobile First: Optimized for iOS and Android (compatible down to iOS 9, Android 4.4).
  • 💻 PC Compatible: Supports IE11+ and modern browsers.
  • 📦 Tree Shaking: ES Module support for smaller bundle sizes.
  • 🛡️ TypeScript: Full type definitions included.
  • 🔧 Developer Friendly: Includes source code and development tools for easy extension.

Installation

作为依赖使用

npm install h5-utils-lib
# 或
yarn add h5-utils-lib
# 或
pnpm add h5-utils-lib

作为开发模板使用

安装后,你可以直接基于此项目继续开发:

npm install h5-utils-lib
cd node_modules/h5-utils-lib
npm install  # 安装开发依赖
npm run build  # 构建项目
npm test  # 运行测试

或者直接克隆项目到本地进行开发。

Usage

ES Modules (Vue/React/Vite/Webpack)

import { isIOS, getQueryString, formatMoney } from 'h5-utils-lib';

if (isIOS()) {
  console.log('Running on iOS');
}

const id = getQueryString('id');
const price = formatMoney(1234.56); // ¥1,234.56

Browser ()

<script src="path/to/h5-utils-lib/dist/index.min.js"></script>
<script>
  if (H5Utils.isIOS()) {
    console.log('Running on iOS');
  }
</script>

API

Device

  • isIOS(): Check if device is iOS.
  • isAndroid(): Check if device is Android.
  • isWeChat(): Check if running in WeChat.

URL

  • getQueryString(name): Get URL parameter by name.
  • stringifyQuery(obj): Convert object to query string.

Storage

  • setStorage(key, value, expire?): Set LocalStorage with optional expiration (ms).
  • getStorage(key): Get value from LocalStorage (returns null if expired).
  • removeStorage(key): Remove item.

Format

  • formatMoney(amount, decimals?, symbol?): Format number as currency.
  • formatDate(date, fmt?): Format date (default YYYY-MM-DD).

Validate

  • isPhone(phone): Validate Chinese phone number.
  • isEmail(email): Validate email address.

Development

如果你想基于此项目继续开发或扩展功能,请查看 开发指南

快速开始

# 安装依赖
npm install

# 开发模式(监听文件变化)
npm run dev

# 构建项目
npm run build

# 运行测试
npm test

# 测试覆盖率
npm run test:coverage

项目结构

  • src/ - 源代码目录
  • tests/ - 测试文件
  • dist/ - 构建输出(自动生成)
  • rollup.config.js - 构建配置
  • tsconfig.json - TypeScript 配置
  • jest.config.js - 测试配置

更多开发信息请参考 开发指南使用示例

License

ISC