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

s-zlib

v1.0.2

Published

a small library

Downloads

3

Readme

zlib

a small library help our project

npm install s-zlib

接口

1.clone

clone(date: any),浅拷贝数据

2.deepClone

deepClone(date: any),深拷贝数据

3.缓存相关
3.1 ls

ls(key, value), 保存到localStorage,会对value做base64加密。

3.2 lg

lg(key),获取ls保存的值

3.3 clearL

clearL(key),清除某个缓存

3.4 clearLAll

清除所有的本地(local)缓存

3.5 sls
3.6 slg
3.7 clearS
3.8 clearAll

用法同上,这里针对session缓存

4. isInt

isInt(number)判断是否是整数

5. queryUrl

解析当前url的参数,并返回参数对象

6.toThousands

toThousands(number)转化数字为千分位

7.calcAdd/calcReduce/calcMul

参数均为两个,精确计算两个数字加减乘。

8.formatKeyDown

formatKeyDown(inputValue),保证输入的内容为数字,包括小数

9. resizePage

resizePage(fn1, fn2),监听移动端键盘弹起和释放,fn1为弹起回调事件,fn2位键盘落下回调事件。

10. listToTree

listToTree(list: array),用于将分类列表转换成嵌套可用的树状结构

11. jsonp

jsonp(url, cbKey, cbName, options),简单实现jsonp,url是请求的url,cbKey、cbName表示"https://xxx.xx.xx?cbKey=cbName",就是回调函数的key和函数名。option表示其他url参数,一个对象集合

12. dateFormat

dateFormat(date),日期格式化,传入日期对象,可调用方法:

let date = dateFormat(new Date())
console.log(date.formatAll()) //默认分隔符为‘-’,2018-04-02 15-34-13
console.log(date.formatDate('/'))//2018/04/02
console.log(date.formatTime(':'))//15:34:05

以上三个的参数都是分隔符,默认为‘-’

console.log(date.format('MM-DD'))//04-02,可以自由组合,标准为‘YYYY-MM-DD hh:mm:ss’

这个方法可以任意组合年月日时分秒,注意必须要使用(YYYY-MM-DD hh:mm:ss)这些标识符,至于中间的分隔符或者顺序或者是否显示某个都由你自己决定。

13.compareData

compareData(dataA, dataB),比较连个数据是否相等,可以是任意嵌套复杂型,Symbol和function转化为字符串如果一致则视为相同。