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

@nhz/utils

v1.0.0

Published

【@nhz/utils】Collection of common JavaScript / TypeScript utils 🌏

Downloads

15

Readme

nhz-utils

【@nhz/utils】Collection of common JavaScript / TypeScript utils 🌏

  • use typescript
  • build with rollup
  • support esmodules and commonjs
  • support tree-shaking

Installation

Use the package manager npm to install @nhz/utils.

npm install @nhz/utils

Usage

import { /* ... */ } from '@nhz/utils'

or import from what module you need

import { /* ... */ } from '@nhz/utils/xxx' // xxx is a module name

Modules

| module name | description | | ----------------- | -------------- | | array | 数组模块 | | file | 文件处理模块 | | date | 日期与时间模块 | | format | 格式化模块 | | generic | 泛型集成模块 | | handle | handle模块 | | is | 判断模块 | | log | 日志模块 | | object | 对象操作模块 | | random | 随机模块 | | throttle-debounce | 防抖节流模块 | | transfor | 变换模块 | | url | 地址模块 | | watch | 监听模块 |

Debug

在src目录中修改或编写相应的模块,并对新功能编写单元测试,测试满足条件后使用命令 npm run build:对应模块名 进行打包和 npm run readme 更新模块README文件。

单元测试执行命令

npm run test
npm run test:dev

...

https://plantuml.com/

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

All Functions

| Function | Description | Function | Description | | ------------------------------------ | -------------------- | ---------------------------------- | ---------------------- | | array/arr() | 数组拓展方法装饰器 | array/toArray() | 转化为数组 | | date/getMonth() | 获取月份 | date/getNextDate() | 获取下一日期 | | date/sleep() | 异步等待 | date/timestamp() | 获取当前时间戳 | | file/readFileAsJSON() | 读取文件JSON格式内容 | file/readFileAsText() | 读取文件内容 | | format/formatCash() | 现金格式化 | format/formatChineseNumber() | 中文数字格式化 | | format/formatDate() | 日期格式化 | generic/Arrayable<> | 可能为数组类型 | | generic/Concrete<> | 递归必选类型 | generic/Fn<> | 函数类型 | | generic/IsomorphicDestructurable<> | 数据对象解构类型 | generic/NonArray<> | 非数组类型 | | generic/Nullable<> | 可能为空类型 | generic/Optional<> | 递归可选类型 | | generic/ReturnPromiseType<> | Promise返回类型 | handle/makeEventListener() | Dom监听 | | handle/makeInterval() | setInterval处理器 | handle/makeObservable() | Observable.on处理器 | | handle/makeTimeout() | setTimeout处理器 | is/isBoolean() | 是否为bool类型 | | is/isFunction() | 是否为函数类型 | is/isNullable() | 是否为null或未定义类型 | | is/isNumber() | 是否为数值类型 | is/isObject() | 是否为对象类型 | | is/isPromise() | 是否为Promise类型 | is/isString() | 是否为字符串类型 | | log/warn() | 提醒 | object/deepCopy() | 深度复制 | | object/deepCopyJSON() | 深度复制 | object/extend() | 深度扩展 | | object/filterObjectIncludeKeys() | 对象成员过滤 | object/filterObjectExcludeKeys() | 对象成员过滤 | | random/createRandomBool() | 创建随机bool值 | random/createRandomInt() | 创建随机整数 | | random/createUid() | 创建随机Uid | random/getArrayItemRandom() | 随机获取数组一集合 | | return/makeDestructurable() | Destructuring with object or array | throttle-debounce/debounce() | 防抖 | | throttle-debounce/throttle() | 节流 | transfor/toLowerCaseFirstIndex() | 首字母变小写 | | url/loadCss() | 加载css | url/loadJs() | 记载js | | url/createUrlFromBlob() | 创建缓存路径 | url/createJSONUrl() | 创建缓存地址 |