Socket
Socket
Sign inDemoInstall

@types/validator

Package Overview
Dependencies
0
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/validator

TypeScript definitions for validator


Version published
Maintainers
1
Weekly downloads
4,894,472
decreased by-0.59%
Install size
70.1 kB

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 (https://github.com/validatorjs/validator.js).

Details

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

Additional Details

  • Last updated: Mon, 05 Feb 2024 22:35:26 GMT
  • Dependencies: none

Credits

These definitions were written by tgfjt, Ilya Mochalov, Ayman Nedjmeddine, Louay Alakkad, Bonggyun Lee, Naoto Yokoyama, Philipp Katz, Jace Warren, Munif Tanjim, Vlad Poluch, Piotr Błażejewicz, Matteo Nista, Roman Babiak, and Daniel Freire.

FAQs

Last updated on 05 Feb 2024

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