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

@mvmoo/us

v0.0.10

Published

A monorepo for reusable JavaScript utility functions for different platforms.

Readme

@movmo/us 📦 工具库

一组常用的 JavaScript 工具函数,适用于日常前端开发。

示例

import { formatBytes } from '@mvmoo/us'
// 或者 const { formatBytes } = require('@mvmoo/us') 

const num = formatBytes(1200)

console.log(num)

输出结果: '1.2k'

📚 函数说明

debounce(func, wait = 300)

  • 📄 文件: debounce.js
  • 📝 描述: 防抖函数,用于减少函数触发频率
  • 📌 参数:
    • func: 需要防抖的函数
    • wait: 等待时间(毫秒)

deepClone(obj)

  • 📄 文件: deepClone.js
  • 📝 描述: 深拷贝对象或数组,递归复制所有嵌套内容

firstDay()

  • 📄 文件: firstDay.js
  • 📝 描述: 获取当前月的第一天,格式为 YYYY-MM-DD

formatBytes(bytes)

  • 📄 文件: formatBytes.js
  • 📝 描述: 将字节数格式化为带单位的字符串(如 KB、MB、GB)
  • 📌 参数:
    • bytes: 字节数(string 或 number)
  • 📌 示例: formatBytes(123456) 返回 "123.45 KB"

formatNum(num)

  • 📄 文件: formatNum.js
  • 📝 描述: 格式化数字为简写单位(如 k、w、亿)
  • 📌 示例:
    • formatNum(1200) 返回 "1.2k"
    • formatNum(10000) 返回 "1w"
    • formatNum(123456789) 返回 "1.23亿"

formatSmartTime(input, format)

  • 📄 文件: formatSmartTime.js
  • 📝 描述: 将时间格式化为“智能”时间文本,根据时间间隔自动显示:
    • 当天内:HH:mm
    • 昨天:昨天 HH:mm
    • 前天:前天 HH:mm
    • 本周:星期x HH:mm
    • 本年:MM月DD日 HH:mm
    • 跨年:YYYY年MM月DD日 HH:mm
  • 📌 参数: 支持 Date、字符串、时间戳(毫秒或秒)传入format可自定义日期分隔符

getBeforeDate(n)

  • 📄 文件: getBeforeDate.js
  • 📝 描述: 获取 n 天前的日期,格式为 YYYY-MM-DD
  • 📌 示例: getBeforeDate(3) → 三天前的日期字符串

parseTime(time, cFormat = '{y}-{m}-{d} {h}:{i}:{s}')

  • 📄 文件: parseTime.js
  • 📝 描述: 将时间格式化为指定格式字符串
  • 📌 示例:
    • parseTime(Date.now())2025-05-17 12:34:56
    • parseTime(1715962340000, '{y}/{m}/{d}')2025/05/17

randomColor()

  • 📄 文件: randomColor.js
  • 📝 描述: 随机返回一个预设的颜色字符串
  • 📌 示例: #ffb6c1#0dd2e4