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 🙏

© 2024 – Pkg Stats / Ryan Hefner

zimo_util

v1.1.0

Published

``` 格式化日期 需要什么格式传入什么格式 yy-MM-dd hh:mm:ss

Downloads

24

Readme

dateFormat

格式化日期
需要什么格式传入什么格式
yy-MM-dd hh:mm:ss

getParams

获取url参数
传入全部网址
getParams(url)

dayFormat

获取星期几
传入时间戳
dayFormat(date)

getDateDiff(startTime, endTime)

获取两个时间差
startTime 开始时间(xxxx-xx-xx)
endTime   结束时间(xxxx-xx-xx)

dayDiff(sDate1, sDate2)

获取两个日期相差天数
传入xxxx-xx-xx

setCookie(name, value)

设置cookie
传入键值对

getCookie(name)

获取cookie
传入键名

delCookie(name)

删除某个cookie
传入键名

setStorageItem(itemName,value)

设置缓存
传入键,值

getStorageItem(itemName)

获取缓存
传入键名

clearStorage()

删除缓存,直接调用,无需传参

filterParams(obj)

清除对象中值为空的属性
当值等于0,null,undefined的时候,就会被过滤

render函数

var render = function(tpl,data){
    return tpl.replace(/\{\{(.+?)\}\}/g,function(m,m1){
        return data[m1]
    })
}

render('我是{{name}},年龄{{age}},性别{{sex}}',{
    name:'姓名',
    age:18,sex:'女',
})
// "我是姓名,年龄18,性别女"

debounce(fn,time)节流防抖函数

传入一个匿名函数()=>{函数体内书写执行事件}
time可不传,默认间隔为1000毫秒