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

weltown22-validate

v1.0.2

Published

```javascript export const EMAIL_REG = /^[a-zA0-9_.-]+@[a-z0-9-]+(\.[a-z]+)*\.[a-z]+$/i export const PHONE_REG = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/ // 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可 export const PASSWORD_REG = /^(?![0-9]+$)(?![a-z]+$

Downloads

3

Readme

export const EMAIL_REG = /^[a-zA0-9_.-]+@[a-z0-9-]+(\.[a-z]+)*\.[a-z]+$/i
export const PHONE_REG = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/ // 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可
export const PASSWORD_REG = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$)^.{8,16}$/
// 1.长度为8-16个字符
// 2.包含字母(大小写均可)和数字
// 3.不允许有空格和中文
export const ROOT_NAME_REG = /^[a-zA-Z][0-9a-zA-Z]{7,15}$/
// 位置编号正则
export const PLACE_REG = /^[0-9a-zA-Z-_]{1,16}$/
export const _IDRe18 = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
export const _IDre15 = /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/
export const PASS_PORT_REG = /^((1[45]\d{7})|(G\d{8})|(P\d{7})|(S\d{7,8}))?$/
// 只能输入中文
export const _ZH_REG = /^[\u4e00-\u9fa5]+$/
export function valid_ZH_REG(value) {
  return {
    msg: '只能输入中文',
    isPass: _ZH_REG.test(value)
  }
}
// 只能输入数字
export const _NUM_REG = /^[0-9]+$/
export function valid_NUM_REG(value) {
  return {
    msg: '只能输入数字',
    isPass: _NUM_REG.test(value)
  }
}
// 只能输入数字、英文
export const _NUM_EN_REG = /^[0-9a-zA-Z]+$/
export function valid_NUM_EN_REG(value) {
  return {
    msg: '只能输入数字、英文',
    isPass: _NUM_EN_REG.test(value)
  }
}
// 只能输入英文字母、中文、符号()、 空格
export const _COMPANY_REG = /^[\u4e00-\u9fa5()()a-zA-Z\s]+$/
export function validCompany(value) {
  return {
    msg: '只能输入英文字母、中文、符号()',
    isPass: _COMPANY_REG.test(value)
  }
}
// 只能输入英文字母、中文、符号() 没有空格
export const _EN_ZH_NOS_REG = /^[\u4e00-\u9fa5()()a-zA-Z]+$/
export function valid_EN_ZH_NOS_REG(value) {
  return {
    msg: '只能输入英文字母、中文、符号()',
    isPass: _EN_ZH_NOS_REG.test(value)
  }
}
// 只能输入中文、英文
export const _ZH_EN_REG = /^[\u4e00-\u9fa5a-zA-Z]+$/
export function valid_ZH_EN_REG(value) {
  return {
    msg: '只能输入中文、英文',
    isPass: _ZH_EN_REG.test(value)
  }
}

// 只能输入中文、英文、数字
export const _THREE_REG = /^[\u4e00-\u9fa50-9a-zA-Z]+$/
export function validThree_REG(value) {
  return {
    msg: '只能输入中文、英文、数字',
    isPass: _THREE_REG.test(value)
  }
}
// 只能输入英文、数字、空格
export const _EN_NUM_REG = /^[0-9a-zA-Z\s]+$/

// 只能输入中文、英文、数字、中横线、下划线
export const _FIVE_REG = /^[\u4e00-\u9fa50-9a-zA-Z-_]+$/
export function validFive_REG(value) {
  return {
    msg: '只能输入中文、英文、数字、中横线、下划线',
    isPass: _FIVE_REG.test(value)
  }
}
// 只能输入中文、英文、空格
export const _ZH_EN_S_REG = /^[\u4e00-\u9fa5a-zA-Z\s]+$/
export function valid_ZH_EN_S_REG(value) {
  return {
    msg: '只能输入中文、英文、空格',
    isPass: _ZH_EN_S_REG.test(value)
  }
}
// 只能输入中文、英文、中横线、下划线、数字、空格
export const _SIX_REG = /^[\u4e00-\u9fa50-9a-zA-Z-_\s]+$/
export function valid_SIX_REG(value) {
  return {
    msg: '只能输入中文、英文、中横线、下划线、数字、空格',
    isPass: _SIX_REG.test(value)
  }
}
// 只能输入数字、中横线、加号、小括号
export const _NUM_PHONE_REG = /^[0-9-+()()]+$/
export function valid_NUM_PHONE_REG(value) {
  return {
    msg: '只能输入数字、中横线、加号、小括号',
    isPass: _NUM_PHONE_REG.test(value)
  }
}
// 只能输入数字、中横线
export const _NUM_LINE_REG = /^[0-9-]+$/
export function valid_NUM_LINE_REG(value) {
  return {
    msg: '只能输入数字、中横线',
    isPass: _NUM_LINE_REG.test(value)
  }
}
// 邮箱校验
export function validEmail(email) {
  return EMAIL_REG.test(email)
}
export function validPassWord(word) {
  return PASSWORD_REG.test(word)
}
// 验证根用户
export function validRootName(account) {
  return ROOT_NAME_REG.test(account)
}
// 验证工号
export function validWorkNum(account) {
  return /^[0-9a-zA-Z-_]{1,32}$/.test(account)
}
// 验证位置编号
export function validPlaceNum(account) {
  return PLACE_REG.test(account)
}
// 校验手机号
export function validPhone(word) {
  return PHONE_REG.test(word)
}
// 访问密码
export function visitPassWord(word) {
  return /^[0-9a-zA-Z]{6,16}$/.test(word)
}
// 身份证号
export function validIDcard(idVal) {
  if (_IDRe18.test(idVal) || _IDre15.test(idVal)) {
    return true
  } else {
    return false
  }
}
// 英文() 替换成中文 ()
export function enTwozhBrack(text) {
  if (text) return text.replace(/[(]/g, '(').replace(/[)]/g, ')')
}
// 校验护照号
export function validPassPort(word) {
  return PASS_PORT_REG.test(word)
}