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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wheat-common-utils

v3.8.12

Published

公共函数库

Readme

小麦前端公共方法库

(一)关于数组的方法

  1. 萃取数组对象中某属性值,返回一个数组 pluck (章艺)
  2. 遍历列表中的每个值,返回所有通过真值测试的值的数组 filter(文洁)
  3. 数组去重 (章艺)
  4. 返回某个元素在数组中出现的次数 (重嘉)
  5. 删除一个数组中的某个元素(多类型),返回新数组 (冰清)

(二)关于时间的方法

  1. 转化成(YYYY-MM-DD: H:i:s)(哲东)
  2. 获取时间与某个时间(当前,某个时间)相差几天(章艺)
  3. 创建时间和当前相差(1.相差几分几秒-几分几秒前)(2.相差几个小时-几小时几分钟前)(3.相差1天-昨天+时分秒)(4.相差几天以上 - 年月日 + 时分)(重嘉)
  4. 输入距离 某个时间(某天| 今天)差值,返回那天的日期(文洁)
  5. 获取这一周的第一天和最后一天 返回数组; (剑宇)
  6. 倒计时 (30分钟的倒计时,数字10-0的倒计时)(侯岩)

(三)防抖节流

  1. 节流 (哲东)
  2. 防抖(苏云)

(四) 关于文件的方法

  1. base64ToBlob
  2. base64ToFile

(五) 私密处理的方法

  1. 手机号私密处理
  2. 身份证私密处理
  3. 银行卡私密处理 ---(剑宇)

(六)关于数字的方法

  1. 判断是否为整数 场景充值
  2. 判断是否奇数偶数 (苏云)
  3. 判断是否为正整数 场景充值

(七)其他的方法

  1. 获取地址栏传递过来的参数 getUrlParam (冰清)
  2. 点击复制 (重嘉)
  3. 判断是否为undefined或为空 (文洁)
  4. 判断是否是微信或者支付宝 (章)
  5. 判断是否为空 (哲东、文洁)

(八)关于正则验证的方法

  1. 手机验证 不合法的验证(问阿新,内部有10开头)
  2. 身份证验证 不合法的验证
  3. 只能输入英文和数字 小麦收银进件(王涛)
  4. 验证qq号 基础验证
  5. 验证字符是否含有中文 测评作业
  6. 验证字符是否存在全角字符 测评作业
  7. 去除字符串空格 (去除全部空格)(hou)
  8. js正则为url添加http标识

(九)关于金额的方法

  1. 格式化金额为千位加逗号 金融

纯函数--- 契合业务场景 ---- 出入参