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

mm-method

v3.0.1

Published

> Common Libraries Of MaoMao

Readme

mm-method

Common Libraries Of MaoMao

Method

3.0.1

# 根据数据返回相应的类型
returnType (data, upper)
*  @param {*} data — 需要判断的数据
*  @param {boolean?} upper — 是否大写
*  @returns {string}

# 判断数据类型是否正确
judgeType (data, type)
*  @param {*} data — 需要判断的数据
*  @param {string} type — 预判的数据类型

# 设置 SessionStorage
setSession (name, val)
*  @param {object|array|string} name —— 设置的参数名|参数
*  @param {number|string} val —— 设置的参数值

# 获取 SessionStorage
getSession (name)
*  @param {string} name —— 获取的参数名

# 移除 SessionStorage
removeSession (name)
*  @param {string|string[]} name <all> —— 移除的参数名

# 防抖函数
debounce (fn, delay, immediate)
*  @param {callback} fn — 需要防抖的函数
*  @param {number} delay=40 — 防抖延迟时间
*  @param {boolean?} immediate=false — 是否立即执行
*  @return {function}

# 节流函数
throttled (fn, delay, immediate)
*  @param {callback} fn —— 需要节流的函数
*  @param {number} wait=40 —— 节流等待时间
*  @param {boolean?} immediate=false — 是否立即执行
*  @return {function}

# 根据当前分辨率计算大小
remToPx (size, base)
*  @param {number} size —— 想要计算的大小
*  @param {number?} base=1920 —— 计算的基础数值
*  @return {number}

# 下划线转驼峰
lineToHump (str)
*  @param {string} str —— 目标字符串
*  @return {string}

# 驼峰转下划线
humpToLine (str)
*  @param {string} str —— 目标字符串
*  @return {string}

# 点转驼峰
pointToHump (str)
*  @param {string} str —— 目标字符串
*  @return {string}

# 驼峰转点
humpToPoint (str)
*  @param {string} str —— 目标字符串
*  @return {string}

# 深拷贝
deepClone (target)
*  @param {object|array} target —— 目标对象
*  @return {object|array}

# 深替换
deepReplace (target, replace)
*  @param {object|array} target —— 目标对象
*  @param {object|array} replace —— 替换对象
*  @return {object|array}

# 将时间戳或者中国标准时间格式化
timestampFormat (timestamp, format)
*  @param {number} timestamp —— 时间戳或者中国标准时间
*  @param {string?} format='YYYY-MM-DD' —— 输出格式 (YYYY-MM-DD hh:mm:ss)
*  @return {string|number}

# 随机生成整数
randomNumber (min, max, num)
*  @param {number} min —— 最小值
*  @param {number} max —— 最大值
*  @param {number?} num= —— 需要产生的个数
*  @return {number|array}

# 字符串切割
stringSplit (str, mark)
*  @param {string} str —— 字符串
*  @param {string?} mark —— 切割符号
*  @return {string}