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

balala-utils

v0.1.0

Published

一款轻量化的工具集,包含axios请求、浏览器storage存储等

Readme

balala-utils 使用简介

这是一款我个人使用的包含了简单的http请求以及简单的浏览器storage存储的小插件

github地址: balala-utils

http

在你使用过程中引用的是http类,即class http,在使用时你需要使用javascript的**new**方法以此来获取http所提供的getpost方法

简单api介绍:

  • http

    @param {object} options - 请求基本配置baseUrl,header,commonParams,timeout,urlCheck,token
    @param {function} callback - 在请求得到响应后执行的回调函数
      
    new http(options,callback)

    创建axios实例,初始化连接并且创建拦截器,这里可以传入token,将会存为localStorage并且时间为6天整

  • get | post

    /**
         *
         * @param {string} urlLink - 拼接的url地址
         * @param {object} param - 参数对象
         * @param {object} headers - 请求头,如在创建class时传入token,此时header中含有token
    */
      
    get|post(urlLink, param, headers)

    getpost方法进行信息传输,返回内容为Promise,需要通过.then()来进行数据的处理,这里加入了从存储中获取token的方法:

    if (token === null && token.name !== '') {
                headers[`${token.name}`] = storages.get(token)
            }
    if (token.value !== null && token.name !== '') {
           		headers[`${token.name}`] = token
          	}

storages

这是通过封装实现的对sessionStoragelocalStorage存储

简单api介绍:(flag是区别session还是local

  • set

     /**
         * set 方法,设置
         * @param key String 键
         * @param value 值
         * @param expired writeTime 写入时间,单位:ms
         * @param flag 是否永久存储
      */
     set(key, value, expired, flag = true)

    存入数据

  • get

    /**
         * get 方法,获取
         * @param key 键
         * @param flag 是否永久存储
      */
     get(key, flag = true) 

    取出数据

  • del

    /**
         * del 方法,删除
         * @param key 键
         * @param flag 是否永久存储
         */
    del(key, flag = true)

    删除数据

  • isOutPeriod

     /**
         * isOutPeriod 方法,判断 value 值是否过期
         * @param name 值
         */
    isOutPeriod(name)

    判断是否过期


这个项目目前刚刚开始,写的也不是很好,但是还是可以用于基础的开发的,希望大家多多提供宝贵的意见!

github地址: balala-utils