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

x-use-utils

v1.0.0

Published

日常使用工具集

Downloads

4

Readme

colorUtils

  • hexToRgb(str) hex颜色转rgb颜色
  • rgbToHex(r, g, b) rgb颜色转Hex颜色
  • getLightColor(color, level) 变浅颜色值
  • getDarkColor(color, level) 变深颜色值
  • randomRgbColor rgb颜色
  • randomRgbaColor(opacity) rgba颜色

dateUtils

  • convertTimeToHumanReadable 相对时间(n小时以前)

echartsUtils 默认已安装echarts

  • showLoading(myChart,text,args)
  • hideLoading(myChart)
  • initMyChart(domId)
  • setChartOptions(domId, options = {}, notMerge = false)

formUtils

  • getFormByTableColumn(column=[{label:'', value: ''}], isFilter = false) 根据表头生成要提交的表单

g6Utils 默认已安装 element-plus antv-g6

  • graphResize(graph, domId)
  • initGraphRenderLoading(target,text,args) 加载中遮罩层
  • bindGraphEvent(graph,callback) 基本事件 若使用initGraphRenderLoading会在afterrender后取消
  • treeDataToNormalData 树状图数据转为扁平化数据

strUtils

  • titleCase(str) 首字母大写
  • lineToHump(str) 下划转驼峰
  • humpToLine(str) 驼峰转下划线
  • parseStrEmpty(str) 转换字符串,undefined,null等转化为""

validUtils

  • isHttp(url) 判断url是否是http或https
  • isExternal(path) 判断path是否为外链
  • isURL(url) 是否为URL
  • isLowerCase(str) 是否小写字母组成
  • isUpperCase(str) 是否大写字母组成
  • isAlphabets(str) 是否字母组成
  • isEmail(email) 邮箱验证
  • isString(str) 字符串
  • isNumberStr(str) 纯数字字符串
  • isArray(arg) 是否数组
  • isIp(ip) 校验IP
  • isBlob(data) 验证是否为blob格式
  • isMultiIp(ips, type = 1) 1 校验IP 多个段以;分隔,例:192.168.1.1-192.168.1.8;192.168.1.1/24 ; 2 校验多IP段 以;分隔,例:192.168.1.0/24 或多个:192.168.1.0/24;192.168.2.0/24