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

@lylb/zo-util

v1.0.11

Published

工具方法库

Downloads

37

Readme

支持端

网页端 & 小程序端

安装

npm install @lylb/zo-util

引用

import * as zo from '@lylb/zo-util'

  • 支持按需引用

方法

  • 判断变量类型或者判断是否指定类型
  • 循环 Array 或者 Object,并根据 callback 返回 false 时中断循环
  • 去除指定字符串中的前后空格
  • 查找传递的 path 中 query 参数
  • 拷贝对象或数组
  • 多个数组合并成一个数组
  • 数组内容去重,支持多个数组合并后去重
  • 数组随机打乱
  • 字符串保密,替换其余字符串
  • 判断任何类型参数是否为空
  • 截取数值中小数位为指定位数
  • 精度处理,加减、乘积、两数相除
  • 删除字符串中的标签,一般用于富文本特殊处理
  • 数值加权、验证、加权加密、加权解密
  • 时间格式化日期、时间戳格式化日期、字符串格式化日期
  • 判断是否银行卡号,仅银行卡号规则验证,不进行银行校对
  • 获取字符串真实长度,返回字节长度
  • 自动生成不重复的 id 值,例如:AC97QA-NLOWEK-FFLTNH-ZOEQE7RA
  • 防抖(支持前防抖以及后防抖)
  • 伪协议字符串拆分
  • 格式化任何时间格式数据以及插件(比大小、时间段等)
  • 数组切割
  • 查询两数组中重复的值
  • 整数范围段
  • 是否数组
  • 是否对象
  • 是否布尔
  • 是否数字
  • 是否字符串
  • 是否正则
  • 是否 FormData
  • 是否 Function
  • 是否 Date
  • 是否 Error
  • 是否 Symbol
  • 是否 Promise
  • 是否 Null
  • 是否 Undefined
  • 判断数字或字符串是否为数字
  • 是否移动设备
  • 是否爬虫
  • 是否微信
  • 是否 QQ 浏览器
  • 是否手机号
  • 是否座机号码
  • 是否 http 地址
  • 是否邮箱地址
  • 判断是否对象或者数组
  • 是否银行卡(只校验卡号真伪,不校验是否真实存在)
  • 是否偶数(仅验证整数)
  • 解析时间格式转为 Date
  • 格式替换(时间)
  • 时间格式化(Date)
  • 身份证号码校验(只校验卡号真伪,不校验是否真实存在)
  • 获取多位数值中小数位长度
  • 去除数值中的小数点,用于处理乘法中的精度问题
  • 在对象中查找 key
  • 在对象中查找 value
  • 提取对象中指定 keys 的值
  • 查找数组或对象指定 path 的值
  • 字符串去空格[增加 type 参数,类型(1:前后空格,2:前空格,3:后空格,4:所有空格),默认: 1]
  • 参数内容字符串化
  • 替换字符串中匹配的内容
  • 把字符串转化为属性路径
  • 简易字符串模板