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

@chengla_web/cl_newutil

v0.0.66

Published

橙啦工具函数库

Downloads

238

Readme

utils 常规函数集合

config 配置文件,域名、代理~

  • getCookie

    • 作用:
      • 获取cookie
    • 入参:
      • name(string) 想要获取的cookie名
    • 出参:不传name则返回所有cookie的对象
  • setCookie

    • 作用:
      • 存储cookie
    • 入参:
      • name(string) 需要存储的key
      • value(string) 值
      • expires(number,默认7) 存储时长,单位天
      • path(string,默认:/) 域名
  • removeCookie

    • 作用:
      • 删除cookie
    • 入参:
      • name(string) 需要删除的key
      • path(string,默认:/)

判断环境

  • isClApp

    • 作用:
      • 判断是否是橙啦app
    • 入参:
      • ua(string|null) 服务端调用需传入
  • isWeiXin

    • 作用:
      • 判断是否是微信环境
    • 入参:
      • ua(string|null) 服务端调用需传入
    • 出参:
      • true / false
  • isMobileDevice

    • 作用:
      • 判断是移动端还是PC端
    • 出参:
      • true(移动端) / false(PC端)

其他

  • setCookieForWxapp

    • 作用:
      • 微信小程序内置用户信息,通过链接注入H5 webview
    • 入参:
      • cookies(string)
  • goLogin

    • 作用:
      • 跳转登录--非微信环境
    • 入参:
      • callPage(string) 登录跳转地址
  • random_string

    • 作用:
      • 生成随机串
    • 入参:
      • len(number,默认32) 要生成随机数的长度
  • goToTop

    • 作用:
      • 返回顶部
  • isPhoneNum

    • 作用:
      • 判断是否是国内手机号
    • 入参:
      • mobile(string) 手机号
    • 出参:
      • true / false
  • isEmail

    • 作用:
      • 判断邮箱是否正确
    • 入参:
      • email(string) 邮箱号
    • 出参:
      • true / false
  • getUrlParamItem

    • 作用:
      • 获取url固定参数
    • 入参:
      • name(string) 要获取的参数
      • url(默认为当前页面url) url链接
    • 出参:
      • string || null
  • replaceEmo

    • 作用:
      • 禁止表情输入
    • 入参:
      • e(string) 需要过滤的字符串
    • 出参:
      • 匹配过滤后的字符串
  • addZero

    • 作用:
      • 给小于10的数字前做加0处理
    • 入参:
      • num(number) 需要处理的数字
    • 出参:
      • 字符串
  • dateFormat

    • 作用:
      • 时间戳转换日期
    • 入参:
      • time(any) 时间戳
      • format(string) 要转换成的日期格式,默认为yyyy-mm-dd h:m:s
    • 出参:
      • 字符串
  • debounce

    • 作用:
      • 防抖函数
    • 入参:
      • func(void) 回调函数
      • wait(number) 时间,单位:毫秒
      • immediate(boolean) 是否执行过标识

  • setConfig

    • 作用: C端专用 统一处理request中的域名
    • 入参:
      • config request config
      • production(string) 打包环境
    • 出参:
      • config
  • setAdminConfig

    • 作用: C端专用 统一处理request中的域名
    • 入参:
      • config request config
      • production(string) 打包环境
    • 出参:
      • config