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

@yh-kit/utils

v1.14.0

Published

<!-- * @Description: 实用程序合集 * @Author: YH * @Date: 2025-10-17 17:13:02 * @LastEditors: YH * @LastEditTime: 2025-10-21 14:54:58 * @FilePath: \vite-project\packages\utils\README.md -->

Readme

实用程序合集

实用程序合集

安装

    npm i @yh-kit/utils

包含的工具函数

此库包含以下工具函数,及其函数名如下:

| 函数对象名 | 描述 | 函数实现方式 | | :------ | :------ | :------ | | arrayUtils | 数组相关操作工具函数 | js对象函数 | | Base64Utils | Base64 相关操作工具函数 | class类 | | booleanUtils | 布尔值相关操作工具函数 | js对象函数 | | cookieUtils | Cookie 相关操作工具函数 | js对象函数 | | dateUtils | 日期相关操作工具函数 | js对象函数 | | documentUtils | 文档相关操作工具函数 | js对象函数 | | downloadUtils | 下载相关操作工具函数 | js对象函数 | | echartsUtils | Echarts 相关操作工具函数 | | letterUtils | 字母相关操作工具函数 | js对象函数 | | mapUtils | 地图相关操作工具函数 | js对象函数 | | MoneyFormatter | 金额格式化工具函数 | class类 | | nameUtils | 姓名相关操作工具函数 | namespace | | numberUtils | 数字相关操作工具函数 | js对象函数 | | objectUtils | 对象相关操作工具函数 | js对象函数 | | phoneUtils | 手机号相关操作工具函数 | js对象函数 | | randomUtils | 随机数相关操作工具函数 | js对象函数 | | regexpUtils | 常用正则表达式 | js对象函数 | | storageUtils | 本地存储相关操作工具函数 | js对象函数 | | stringUtils | 字符串相关操作工具函数 | js对象函数 | | urlUtils | URL 相关操作工具函数 | js对象函数 | | waterfallUtils | 瀑布流相关操作工具函数 | js对象函数 |

使用

你可以通过以下方式引入库中的工具函数并使用它们:

    import { arrayUtils, numberUtils, urlUtils } from "@yh-kit/utils";
    
    const queryId = urlUtils.getQueryInfoByName("id");
    console.log(queryId); //  123 地址为:http://localhost:5173/?id=123
    const toEnumObj = arrayUtils.toEnumObj([
        {
            value: "1",
            label: "壹"
        }
    ]);
    console.log(toEnumObj); // {1: {label: '壹', text: '壹', value: '1'}}
    const toEnumObj2 = arrayUtils.toEnumObj(
        [
            {
                value: "1",
                label: "壹"
            }
        ],
        "label"
    );
    console.log(toEnumObj2); // {'壹': {label: '壹', text: '壹', value: '1'}}
    const toMoney = numberUtils.toMoney(123456789);
    console.log(toMoney); // 123,456,789.00