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

lmtire

v1.0.2

Published

日常造轮子

Downloads

2

Readme

#使用说明

##反序列化 querystring

参数 {String} name 要查找的键

参数 {String} url 反序列化的字符串

返回 {undefined|String} 查找到的数值

query(name, url)

##序列化为查询字符串

参数 {Object} data 要序列化的对象

返回 {String} 序列化的查询字符串

serialize(data)

##根据选择器查找 Node

就是模拟 $() ,当然,这里返回元素的 Node 对象即可

参数 {String} selector

返回 {Node|Null}

$(selector)

##删除节点

参数 {Node} node 要删除的节点

返回 {Node} 删除后的节点

removeNode(node)

##在 target 节点之后插入 node 节点

类似 $().insertAfter()

参数 {Node} node 要插入的节点

参数 {Node} target 参照节点

insertAfter(node, target)

##添加类名

参数 {HTMLElement} element 添加类名的元素

参数 {String|Array} className 要添加的类名

addClass(element, className)

##移除类名

参数 {HTMLElement} element 移除类名的元素

参数 {String|Array} className 要移除的类名

removeClass(element, className)

##获取绝对路径

参数 {String} url 要获取绝对路径的路径

返回 {String} url 的绝对路径

获取 url 的绝对路径

getAbsoluteUrl(url)

##防抖动

参数 {Function} callback 超时后执行的回调函数

参数 {Number} time 超时时间(毫秒)

debounce(callback, time = 300)

##根据索引移出数组的某一项

参数 {Number} index 要移除值的索引

参数 {Array} arr 进行移除的数组

返回 {Array} 移除元素后的数组

removeItemByIndex(1, [1,2,3]) => [1, 3]

removeItemByIndex(index, arr)

##根据值移出数组的某一项

参数 {object} value 要移除的值

参数 {Array} arr 进行移除的数组

返回 {Array} 移除元素后的数组

removeItemByValue(1, [1,2,3]) => [2, 3]

removeItemByValue(value, arr)

打造自己的库

造轮子一直都是前端开发中绕不过去的槛,作为初学者倒是不用想太多,自己私底下一定要造,你造轮子写的每一行代码都会化成你的底蕴。

值得模仿的库很多,经典的比如 jQuery、 Lodash ,大型一点比如 vuejs 、react ,我们可以在模仿这些库中学到很多代码技巧,但是更重要的是摸清这些库的设计思想。始终要提现自己的是,语言和代码只是工具,体系和思想才是灵魂,什么时候你使用语言就像拿起锤子钉钉子一样自然,什么时候你就能造出自己的摩天大厦。

好吧,万丈高楼平地起,我们先从简单的开始,给我们的项目取名 adam ,你们的项目名你们自己决定。

这里是基础代码,里面有十个函数了,完善这十个函数,重点是,要有测试用例

这个项目完全自由,目录结构自己决定,甚至测试框架都可以自己定。

给了十个函数,但不限定十个,你们自己使用频率非常高的函数可以加进来。

注意

  • npm run test 可以跑测试
  • code coverage 90% 以上
  • npm run coverage 跑测试并告知 coverage 的结果

加分项

  1. 使用 ES6 ,并且编译出一份 ES5 的文件
  2. 遵从 ESLint 或者 standardjs 等代码规范
  3. 函数多多益善
  4. 发布到 npm ,发布后把链接贴到你的总结里
  5. 测试文件统一归到 test 目录下
  6. code coverage 不小于 95%
  7. 使用 git hook 来自动跑用例和代码覆盖率