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 🙏

© 2025 – Pkg Stats / Ryan Hefner

chaos-fe-utils

v1.0.8

Published

前端工具库(个人用)

Readme

chaos-fe-utils

前端工具库(个人用)

主要是因为很多第三方库有很多代码用不上,为了尽量减少包大小,以及复用平时coding过程中的一些技巧函数。

CDate

日期扩展类

为了兼容safari等浏览器不兼容的时间格式YYYY-MM-DD HH:mm:ss

YYYY-MM-DD HH:mm:ss格式会被替换为YYYY/MM/DD HH:mm:ss这种格式。

YYYY-MM-DD HH:mm:ss.S或者YYYY-MM-DD HH:mm:ss.SZ这两种格式的,会舍弃后面的毫秒数。

schedule

前端延时执行队列,利用观察者模式实现前端常见问题

  • Observer
type Observer = {
  fn: Function,
  caller?: object,
  args?: any[]
}

Ready

处理需要等待达到某种条件时再执行某些操作,类似于window.onload这类的方法。比如说有些请求必须要再获取到token之后才能执行

  • beReady(): void

    ready状态为true,并执行阻塞的操作

  • onReady(observer: Observer): void

    需要等待ready状态为true才能执行的操作,如果readytrue,则立即执行。


SyncQueue

处理前端异步操作的顺序,主要是对于那些一开始不确定有多少个异步的情况。比如说翻页,第二页必须要再第三页之后等。详细的可以看博客(活用队列,解决前端异步顺序执行的问题

  • push(task: Observer): void

    添加操作,异步操作会按照push的顺序来执行

  • quit(): void

    清空执行队列,未完成的操作将不会执行


EventListener

事件监听,一般用于事件总线,全局同步状态和广播消息是时候用。

  • on(event: string, observer: Observer): void

    监听事件

  • emit(event: string): void

    触发事件