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

jutils-src

v1.0.0-beta2

Published

JavaScript常用函数库

Readme

jutils

npm LICENSE MIT

JavaScript常用函数库

在日常工作生活中,会经常用到一些日期格式化url相关操作浏览器类型判断常用验证格式等等函数,虽然大部分只需谷歌/百度一下就能找到,但是大多数都存在着一些问题,于是整理了网上和自己平常用到的工具类,方便大家以后的使用,提升开发效率。

安装

直接用 引入

直接下载并用 <script> 标签引入,jutils 会被注册为一个全局变量。

<script src="jutils.min.js"></script>
<script>
  var browser = jutils.getBrowserInfo()
</script>

CDN

你也可以这样使用最新版本:

<script src="https://cdn.jsdelivr.net/npm/jutils-src"></script>

NPM

NPM 能很好地和 webpack 模块打包器配合使用。

# 最新稳定版
$ npm install jutils-src

API 目录

浏览器

日期

API 说明

getBrowserInfo

获取浏览器信息

jutils.getBrowserInfo();
//{name: "Chrome", version: "76.0.3809.100"}

isCss3Support

判断是否支持css3

jutils.isCss3Support() ? true : false

formatDate

时间戳的转换(自定义格式)

年、月、日、时、分、秒

var date = jutils.formatDate(new Date(1533686888*1000),"YYYY-MM-DD HH:ii:ss");
console.log(date);
// 2019-07-09 19:44:01

getTimeInterval

获取两个时间的间隔,返回间隔的天、小时、分钟和秒。 注意:结束时间要大于开始时间否则返回空

jutils.getTimeInterval("开始时间", "结束时间");
//例:
jutils.getTimeInterval(1567562605000, 1567649014000)
//1天0小时0分钟9秒