Socket
Socket
Sign inDemoInstall

@types/validator

Package Overview
Dependencies
0
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/validator

TypeScript definitions for validator.js


Version published
Weekly downloads
4.8M
decreased by-3.68%
Maintainers
1
Install size
29.6 kB
Created
Weekly downloads
 

Package description

What is @types/validator?

The @types/validator package provides TypeScript type definitions for the validator.js library, which is a tool for string validation and sanitization. This package does not contain functionality by itself but offers type support for TypeScript users of validator.js, enabling them to utilize the library in a type-safe manner.

What are @types/validator's main functionalities?

Email Validation

This feature allows you to validate whether a string is a valid email address.

import validator from 'validator';

const email = 'test@example.com';
const isValidEmail = validator.isEmail(email);
console.log(isValidEmail); // true or false

URL Validation

This feature enables you to check if a string is a valid URL.

import validator from 'validator';

const url = 'https://www.example.com';
const isValidUrl = validator.isURL(url);
console.log(isValidUrl); // true or false

Sanitize Data

This feature allows you to sanitize input to prevent XSS attacks by escaping HTML characters.

import validator from 'validator';

const dirtyString = '<script>Alert('XSS')</script>'; 
const cleanString = validator.escape(dirtyString);
console.log(cleanString); // '&lt;script&gt;Alert(&#x27;XSS&#x27;)&lt;/script&gt;'

Other packages similar to @types/validator

Readme

Source

Installation

npm install --save @types/validator

Summary

This package contains type definitions for validator.js ( https://github.com/chriso/validator.js ).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/validator

Additional Details

  • Last updated: Fri, 29 Mar 2019 18:34:38 GMT
  • Dependencies: none
  • Global values: validator

Credits

These definitions were written by tgfjt https://github.com/tgfjt, Ilya Mochalov https://github.com/chrootsu, Ayman Nedjmeddine https://github.com/IOAyman, Louy Alakkad https://github.com/louy, Kacper Polak https://github.com/kacepe, Bonggyun Lee https://github.com/deptno, Naoto Yokoyama https://github.com/builtinnya, Philipp Katz https://github.com/qqilihq, Jace Warren https://github.com/keatz55.

FAQs

Last updated on 29 Mar 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc