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

sanitize

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sanitize

Input sanitizing library for node.js

  • 0.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.8K
increased by3.92%
Maintainers
1
Weekly downloads
 
Created
Source

node-sanitize

Input sanitizing library for node.js

Summary

This library is for the purpose of sanitizing user input. The examples below show some of the built in sanitizers. You can create your own custom sanitizers and aliases. Please refer to the tests for more examples of how to use this library.

USAGE

var sanitizer = require('sanitize')();
... 
app.get('/', function(req, res) {
    // default supported types
    var myInteger = sanitizer.value(req.header['x-custom-header'], 'int');
    var myBool = sanitizer.value(req.header['x-custom-header'], 'bool');
    var myFloat = sanitizer.value(req.header['x-custom-header'], 'float');
    var myString = sanitizer.value(req.header['x-custom-header'], 'string');
    var myMatchingString = sanitizer.value(req.header['x-custom-header'], /abc123/);
    var myPhoneNumber = sanitizer.value(req.header['x-custom-header'], 'phone');
    var myEmail = sanitizer.value(req.header['x-custom-header'], 'email');
    var myUrl = sanitizer.value(req.header['x-custom-header'], 'url');
});
...

Keywords

FAQs

Package last updated on 02 Feb 2015

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