Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@avivharuzi/validate

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avivharuzi/validate

a lightweight validation library

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Validate

Build Status npm

a lightweight validation library

Installation

npm install @avivharuzi/validate

Usage

const Validate = require('@avivharuzi/validate');

const user = {
    email: 'john@gmail.com',
    password: '123456'
};

const validateUser = new Validae({
    email: Validate.control(user.email, [
        Validate.validators.required(),
        Validate.validators.email()
    ]),
    password: Validate.control(user.password, [
        Validate.validators.required(),
        Validate.validators.minAndMaxLength(3, 12)
    ])
});

if (validateUser.valid) {
    user = validateUser.values;
} else {
    console.log(validateUser.errors);
}

Api

new Validate()

valid

invalid

errors

values

validators

control([validators])

NameArgs
required
regexregex, message
minLengthlen
maxLengthlen
minAndMaxLengthmin, max
minNumbermin
maxNumbermax
minAndMaxNumbermin, max
alpha
alphaDash
alphaSpaces
alphaNumeric
alphaNumericDash
alphaNumericSpaces
numeric
numericFloat
numericDigits
withoutNumbers
username
password
email
url
ip
slug
time
date
phoneIsrael
xss

Options (Object)

new Validate(obj, options)

OptionDefault
errorsWithKeytrue
multiErrorsfalse

License

MIT

Keywords

FAQs

Package last updated on 20 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc