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

rh-regexp

v1.0.0

Published

```shell npm install rh-regexp ```

Downloads

4

Readme

rh-regexp

使用

npm install rh-regexp
import { RegExps } from  'rh-regexp'

export type RegExpRaw = {
 required?: boolean
 reg?: RegExp
 regs?: RegExp[]
 type?: string
 min?: number
 max?: number
}

// 使用
RegExps(
 // ...RegExpRaw[]
)(
 // 待校验的字符串
)

RegExps(args)(str)

  • 测试字串是否符合规则
  • args RegExpUnit[] | RegExpUnit 为校验规则数组
  • str string 待校验字符串
  • result: boolean
export type RegExpRaw = {
 required?: boolean
 reg?: RegExp
 regs?: RegExp[]
 type?: string
 min?: number
 max?: number
}

export type RegExpUnit = ReagExpRaw | string

RegExpCount(args)(str[, flag])

  • 检测字串符合的指定规则
  • args RegExpUnit[] | RegExpUnit 为校验规则数组
  • flag boolean = false => false: 返回不符合规则 true: 返回符合规则
  • str string 待校验字符串
  • result: RegExpUnit[]

说明

  • 默认字符: 0-9a-zA-Z_
  • 符合规则并符合长度, 才不会放回false
  • 规则可通过传入 自定义ReagExpRaw 来覆盖
  • 特别说明:
    • 大部分写好的规则, 只可以重写minmax
    • typeCount: 重写规则需要覆盖regs, 其他均是 reg

| key | 长度 | 规则 | | :------------------- | :------- | :------------------------------------------- | | required | | 非空 | | length | [0,4) | 长度 | | letter | [0,4) | 字母连续 | | letterBegin | | 字母开头 | | letterEnd | | 字母结束 | | lowLetter | | 小写字母 | | uppLetter | | 大写字母 | | seLetter | [0,4) | 字母有序连续 | | seLetterAsc | [0,4) | 字母连续(升序) | | seLetterDesc | [0,4) | 字母连续(降序) | | seLetterIgCase | [0,4) | 字母连续(忽略大小写, 有序) | | seLetterIgCaseAsc | [0,4) | 字母连续(忽略大小写,升序) | | seLetterIgCaseDesc | [0,4) | 字母连续(忽略大小写,降序) | | phone | | 电话号码码 | | typeCount | [3,15) | 字符种类(数字, 大写字母,小写字母, 字符[_]) | | charCount | [4,15) | 字符数量 | | seKeyboard | [0,4) | 键盘连续 | | number | [1,16) | 数字 | | seNumber | [0,4) | 连续数字 | | seOrderNumber | [0,4) | 连续有序数字 | | numbersAsc | [0,4) | 连续升序数字 | | numbersDesc | [0,4) | 连续降序数字 |

更新日志

  • 1.0.0 正式版 RegExps拓展RegExp的用法, 并添加测试用例测试