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

zzb-utils

v1.0.18

Published

zzb utils basic packages

Downloads

6

Readme

zzb-utils

  dist                        - 外部引用资源包
  docs                        - 更新日志
  src                         - 资源文件
  ├── filter                  - 过滤器
  │   ├── formatTime          - 判断是否为空
  │   └── isNullOrEmpty       - 判断字符是否为空
  ├── utils                   - 工具类
  │   ├── base                - 基础方法
  │   │   └── getTypeOf       - 原型链判断数据类型
  │   ├── math                - math计算方法
  │   │   ├── add             - 加法
  │   │   ├── sub             - 减法
  │   │   ├── mul             - 乘法
  │   │   └── div             - 除法
  │   ├── str                 - 字符串常用方法
  │   │   ├── isNullOrEmpty   - 判断字符是否为空
  │   │   ├── trimAll         - 去除所有空格
  │   │   ├── replaceAll      - 替换所有匹配的字符内容
  │   │   ├── replaceBetween  - 替换两边匹配的字符内容
  │   │   ├── replaceLeft     - 替换左边匹配的第一个字符内容
  │   │   └── replaceRight    - 替换右边匹配的第一个字符内容
  │   └── time                - 时间相关操作
  │       └── formatTime      - 时间格式化
  └── validate
      ├── minLength           - 字符串长度不小于length
      ├── maxLength           - 字符串商都不大于length
      ├── phone               - 手机号校验
      ├── tel                 - 固话校验
      ├── email               - 邮箱校验
      ├── idCard              - 身份证校验
      ├── url                 - url校验
      ├── isNumAndLetter      - 判断是否为字母及数字组合
      ├── isNumber            - 判断是否为纯数字
      ├── isLetter            - 判断是否为字母
      ├── isLowerCase         - 判断是否为纯小写字母
      └── isUpperCase         - 判断是否为纯大写字母
//注册filter方法
Object.keys(Utils.filter).map(key => {
  Vue.filter(key, Utils.filter[key])
})

//filter调用(Vue)
{{new Date() | formatTime("YYYY-MM-DD hh:mm:ss")}}

//注册validate方法
Object.keys(Utils.validate).map(key => {
  if (!Vue.prototype.$validate) {
    Vue.prototype.$validate = {}
  }
  Vue.prototype.$validate[key] = Utils.validate[key]
})

//注册utils方法
Object.keys(Utils.utils).map(key => {
  Vue.prototype['$' + key] = Utils.utils[key]
})

//validate及utils调用
console.log(this.$validate.phone("12345678910"))                      //true
console.log(this.$base.getTypeOf("qwe"))                              //string
console.log(this.$str.isNullOrEmpty("qwe"))                           //false
console.log(this.$math.add(1, 2))                                     //3
console.log(this.$time.formatTime(new Date(), "YYYY-MM-DD hh:mm:ss")) //2020-05-19 10:47:22