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

weblibext

v2.0.0

Published

web code snippets

Downloads

5

Readme

web lib extension

WEB 常用代码片段

DOM

  • 设备类型获取
  • 注册事件
  • 移除事件
  • 仅触发一次的事件
  • 判断元素是否具有某个 class
  • 给元素添加多个 class
  • 移除多个 class
  • 获取元素的某个样式
  • 修改元素样式
  • 移除元素样式
  • 是否允许滚动
  • 获取元素的滚动盒子
  • 指定元素是否在另一元素包裹中
  • 元素距离文档顶部的位置
  • 两元素顶部位置差
  • 节点在浏览器窗口中的位置
  • 在执行元素上触发指定的事件,且可传递自定义事件
  • 查找指定具备 ClassName 的父节点
  • DOM 事件代理
  • 判断指定元素是否在可视窗口中
  • 是否滚动到底部
  • 获取浏览器窗口的大小
  • 相对于根节点的所有滚动总和

String

  • 生成随机字符串
  • 字符串转小驼峰
  • 字符串首字母大写
  • rgb 转 hex
  • hex 转 rgba
  • rgba 转 rgb
  • base64 编码,兼容中文
  • base64 解码,兼容中文
  • 序列化,支持 Map、Set、Function

Time

  • 解析时间
  • 将时间格式化

RegExp

  • IP 地址
  • 字符串

EventBus

vue3 的事件车,非 vue2

  • 获取事件车实例
  • 销毁所有的事件车

Lib

  • URL 参数解析
  • 获取数据类型
  • 深拷贝
  • 读 cookie
  • 函数节流,一个周期内仅执行一次
  • 函数防抖,连续触发 N 次,仅在最后一次执行
  • 获取数组、集合、Map 的最后一项
  • 顺序执行 Promise 队列
  • 轮询,直到返回为 true
  • 生成一颗树
  • 通过 URL 下载文件
  • 将 Blob 数据以文件格式下载
  • 将字符串拷贝到粘贴板