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

@vhen2023/fs-helper

v0.0.0

Published

| 函数 | 举例 | 描述 | | -------------------- | --------------------------------------------------------- | -----------------------------------

Readme

@vhen/fs-helper

工具类

| 函数 | 举例 | 描述 | | -------------------- | --------------------------------------------------------- | ---------------------------------------------------- | | convertToRMB | convertToRMB(120) | 数字金额转化为大写金额 | | hideMobile | hideMobile('15612345678') | 隐藏手机号 | | toCase | toCase('test',3) | 大小写转化(1-大写,2-小写,3-首字母大写) | | trim | trim(' t e s t ', 4) | 去除空格 (1-所有空格 2-前后空格 3-前空格 4-后空格) | | LoadScript | LoadScript('test.ts', () => {}) | 异步加载 JS | | padZero | padZero(1, 2) | 数字补位 001 | | setObjToUrlParams | setObjToUrlParams('http://www.baidu.com', { a: 1, b: 2 }) | 将对象作为参数添加到 URL | | setUrlParamsToObj | setUrlParamsToObj('http://www.baidu.com?a=1&b=2') | 将 URL 中的参数转为对象 | | onlyDecimalOrInteger | onlyDecimalOrInteger('432.356',true) | 小数或整数(不可以负数) ,第二个参数控制是否四舍五入 | | onlyInteger | onlyInteger('222') | 正整数 | | randomRangeInteger | randomRangeInteger(10,30) | 在某个区间随机一个整数 | | greetings | greetings() | 问候语:早中晚等 | | thousandSeparator | thousandSeparator(1215455.1234, ',') | 千分位分隔符 |

时间类

// 依赖 dayjs库,抛出 dayjs,
import { toTimeFormat, getPastTime, getDateDiff, dayjs } from "@vhen/fs-helper";

| 函数 | 举例 | 描述 | | ------------ | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | | toTimeFormat | toTimeFormat(new Date(),'YYYY-MM-DD HH:mm:ss') | 时间格式化默认:YYYY-MM-DD HH:mm:ss | | getPastTime | getPastTime('2012-01-02 12:12:30', 2) | 过去日期(刚刚,几分钟之前等),第二个参数为 0 不格式时间,否则 2 表示大于 2 年显示格式化时间 YYYY-MM-DD HH:mm:ss | | getDateDiff | getDateDiff('2024-05-01', new Date(), 'day') | 判断相差天、月、年 ,类型:('day'、'months'、'years') | | getZodiac | getZodiac(2024) | 生肖 |

验证类

| 函数 | 举例 | 描述 | | ---------- | ---------------------------------- | ------------------ | | isPhone | isPhone('19606066920') | 是否为手机号码 | | isExternal | isExternal('http://www.baidu.com') | 是否是外部链接 | | isUrl | isUrl('http://www.baidu.com') | 验证是否是 url | | isImageUrl | isImageUrl('http://xxx.xxx.png') | 验证图片路径 | | isIdCard | isIdCard('350423199906154973') | 验证是否是身份证号 |