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

@muyi086/validator

v1.0.9

Published

do some useful validate

Downloads

12

Readme

validator

中文

npm npm bundle size npm GitHub

Install

npm install @muyi086/validator
# common JS
const validator = require('@muyi086/validator')
# es6
import validator from '@muyi086/validator'

Use

// phone
const phone = '15507810249'
const value = validator.verify(phone, 'phone')

// telPhone
const telPhone = '0571-4340259'
const value = validator.verify(telPhone, 'telPhone')

// email
const email = '[email protected]'
const value = validator.verify(email, 'email')

// password
const password = 'helloWorld888'
const value = validator.verify(password, 'password')

// dateTime
const dateTime = '2020-11-03'
const value = validator.verify(dateTime, 'dateTime')

// identityCard
const identityCard = '43062319181212003X'
const value = validator.verify(identityCard, 'identityCard')

// website
const url = 'www.baidu.com'
const value = validator.verify(url, 'website')

// taxnum
const taxnum = '259595959529592'
const value = validator.verify(taxnum, 'taxnum')

// isNum
const temp = '259595'
const value = validator.verify(temp, 'isNum')

// isImg
const temp = 'jpg'
const value = validator.verify(temp, 'isImg')

// isVideo
const temp = 'mp4'
const value = validator.verify(temp, 'isVideo')

// isAudio
const temp = 'mp3'
const value = validator.verify(temp, 'isAudio')

// isLetter
const temp = 'mp3'
const value = validator.verify(temp, 'isLetter')

// isNumLetter
const temp = 'mp3'
const value = validator.verify(temp, 'isNumLetter')

// isHanzi
const temp = '张三'
const value = validator.verify(temp, 'isHanzi')

// verify length
const password = 'helloWorld888'
const limitLength = 10
const value = validator.verify(password, 'password', limitLength)

// verify general fields
// input label name,example: verify (value, '地区')
const address = '杭州市'
const value = @validator.verify(address, '地区')

Attr explain

  1. typeArr : verify attr array
  2. typeKeyValue : verify attr key and value

Function

function|parameter|default|required|description| --|--|--|--|--| verify|value|string|required|a string value needs to verify| verify|key|string|optional|key attr| verify|limitLength|number|optional|a number limit value's length|