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

@ajkachnic/validata

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ajkachnic/validata

A flexible input validator

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

validata

A flexible input validator written in typescript

Installation

npm install --save @ajkachnic/validata

Usage

You can use validata in a few different ways

// With ES6 Modules
import { isEmail } from 'validata';

console.log(isEmail('name@website.com'));
// With ES6 Modules with a config
import validate from 'validata';

let result = validate('name@website.com', {
  isEmail: true
});

console.log(result);
// With Require Modules
var validata = require('validata');

console.log(validate.isEmail('name@website.com'));
// With Require Modules with a config
var validata = require('validata').default;

var result = validate('name@website.com', {
  isEmail: true
});

console.log(result);

API

The following functions are exported from validata

isEmail(value) - Returns if an email is valid
isUrl(value) - Returns if a URL is valid
isHex(value) - Returns if a hex code is valid
isIp(value) - Returns if an IP Address (V4) is valid
isEmpty(value) - Returns if a string is empty

fitsMax(value, max) - Returns if a strings length is less than or equal to the max parameter
fitsMin(value, min) - Returns if a strings length is greater than or equal to the min parameter

The config object has these options. You can pass multiple parameters

Note: The function returns false once one of the options is false

isEmail
isUrl
isHex
isIp
isEmpty
max
min

Keywords

FAQs

Package last updated on 30 Apr 2020

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