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

museutils

v1.0.1

Published

前端业务代码工具库

Downloads

8

Readme

muse-utils

前端业务代码工具库

目的:聚合常用的前端业务代码,提升日常开发效率

安装使用

  1. 直接下载min目录下的museutils.min.js使用,支持UMD通用模块规范
  2. 通过NPM安装MuseUtils

浏览器:

  <script src="museutils.min.js"></script>
  <script>
      var isAndroid = MuseUtils.isAndroid();
  </script>

NPM:

$ npm install museutils
// 完整引入(CommonJS方式)
const MuseUtils = require('MuseUtils');
const isAndroid = MuseUtils.isAndroid();

// 完整引入(ES6方式)
import MuseUtils form 'MuseUtils';
const isAndroid = MuseUtils.isAndroid();

import {isAndroid} form 'MuseUtils';
const isAndroid = isAndroid();

// 部分引入
const isAndroid = require('MuseUtils/lib/isAndroid');
const isAndroid = isAndroid();

API文档

时间相关

  [compareWithMoment]  比较两个时间点的早晚关系

  [countDown]  倒计时格式化(距某时刻的剩余时长)

  [formatTime]  格式化日期

  [getTodayZeroAM]  获取今天0点的时间戳

  [isTimeBetween]  判断是否处于两个时间点之间

数据处理相关

  [deepCopy]  对象深拷贝

  [mergeObject]  合并对象(同样属性会覆盖)

  [removeTheSame]  数组去重

数学相关

  [getRandomNum]  生成指定范围的随机数

  [padLeft]  小于10的数字左侧补零

数据类型相关

  [getType]  获取变量的类型

  [isString]  判断是否为String类型

  [isNumber]  判断是否为Number类型

  [isBoolean]  判断是否为Boolean类型

  [isArray]  判断是否为Array类型

  [isFunction]  判断是否为Function类型

  [isUndefined]  判断是否为Undefined类型

URL相关

  [getQueryString]  获取URL中的参数信息

设备相关

  [isAndroid]  判断是否为Android设备

  [isIOS]  判断是否为IOS设备

  [isMac]  判断是否为Mac设备

  [isWindows]  判断是否为Windows设备

  [isLinux]  判断是否为Linux设备

  [isMobileBrowser]  判断是否为移动浏览器

浏览器相关

  [getDeviceHeight]  获取设备高度

  [getScrollTop]  获取滚动条距顶部距离

正则校验相关

  [isMailAccount]  校验邮箱是否合法

  [isMobileNumber]  校验手机号码是否合法

  [isPhoneNumber]  校验电话号码是否合法

  [isOnlyNumberAndLetter]  校验是否纯数字和字母输入

  [isPostCode]  校验邮编是否合法

  [isPureChinese]  校验是否纯中文输入

  [isPureNumber]  校验是否纯数字输入

按键相关

  [getKeyCode]  获取键位名称