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

front-end-common-regular

v1.0.4

Published

前端开发常用的正则表达式验证,其中包括,身份证号,手机号,邮箱,车牌号,URL,字符串包括中文,去除空格,用户名,密码,十六进制颜色,分位符

Downloads

11

Readme

front-end-common-regular

正则工具,常用验证,身份证号,手机号,邮箱,车牌号,URL,字符串包括中文,去除空格,用户名,密码,十六进制颜色,分位符

  1. 安装
npm i  front-end-common-regular -S
  1. 开始使用
const validate=require('front-end-common-regular')
//or
import validate from 'front-end-common-regular'
//import {validateFn} from 'front-end-common-regular'
//example
const a=validate.validateFn('车牌号','粤B39006')
//const a=validateFn('车牌号','粤B39006')
console.log(a)
//输出true
  • validateFn(type,value)

| type | value | 返回值| | :------| ------: | :------: | | 邮箱 | string | boolean | | 手机号 | number/string | boolean | | 十八位身份证号 | string | boolean | | 十五位身份证号 | string | boolean | | URL | string | boolean | | 包含中文 | string | boolean | | QQ号 | number/string | boolean | | 密码强度 | string | boolean | | 用户名规则 | string | boolean | | 十六进制颜色 | string | boolean | | 分位符 | object | string | | 去除所有空格 | string | string | | 去除首尾空格 | string | string |

只有validateFn(type,value)的传参type是分位符的时候,value是object且必须要包含两个键值

//example 分位符
let a=validate.validateFn('分位符',{value:10000,type:2})
console.log(a) //百分位1,00,00
a=validate.validateFn('分位符',{value:10000,type:3})
console.log(a) //千分位10,000
a=validate.validateFn('分位符',{value:10000,type:4})
console.log(a) //万分位 1,0000