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

hncy_public_methods

v1.1.1

Published

hncy-public-methods

Downloads

37

Readme

公共方法描述

初始化文档默认fontsize值,适用于rem单位(px / 100)。

designWidth:设计稿尺寸 (type:number)

maxWidth:最大兼容尺寸 (type:number)

initFont(designWidth, maxWidth)

防抖函数

fn: 执行函数 (type:function)

duration: 持续时间 (type:number)

debounce(fn, duration)

获取Url添加参数,适用于组装get类型接口传递参数

url:api接口地址 (type:string)

params:传参数据 (type:Object)

getUrlAddParams(url, params)

根据传入的key判断是否存在于url地址中

url:需要查询key (type:string)

value:给查询key的新赋值 (type:any) 非必传

getUrlHasKey (key, value)

改变路由中某个参数的值

url:url地址 (type:string)

arg:需要修改的目标key (type:string)

arg_val:修改值 (type:any)

changeURLArg (url, arg, arg_val)

设置cookie值

c_name:存储变量名 (type:string)

value:赋值 (type:any)

expiremMinutes:持续时间 (type:sting) 非必传

setCookie(c_name, value, expiremMinutes)

获取cookie值

c_name:存储变量名 (type:string)

getCookie(c_name)

删除cookie值

c_name:存储变量名 (type:string)

delCookie(c_name)

密码明文加密函数,需要跟后台协商使用

password:当前输入密码 (type:string)

CryptoJS:依赖于crypto-js

crypto-js安装方法

npm i crypto-js

time:当前时间

time = parseInt(new Date().getTime() / 1000).toString()

num:密码最长位数

key:和后端约定写法,根据约定情况进行改变

方法使用

noncTimestamp({password, CryptoJS, time, num, key = '0123456789ABCDEF' })

空值文本处理

key:当前需要传入处理的值

textTrim(key)

电子邮件验证

value:当前需要传入处理的值

callback: 回调函数

checkEmail (value, callback)