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

purify

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

purify

Validator functions for many types of input, intended for use with express

  • 3.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
increased by34.78%
Maintainers
2
Weekly downloads
 
Created
Source

purify

NPM version Build Status Coverage Status Dependency Status

var app = express(),
    purify = require('purify');

app.get('/:userId', function (req, res, next) {
    var userId = purify.positiveInteger(req.param('userId')),
        force = purify.boolean(req.param('force'), true);

    if (userId) {
        // ...
    } else {
        res.send(400);
    }
});

API

  • .email(rawValue, defaultValue)

  • .emailIdn(rawValue, defaultValue) - Returns e-mail with non-punycoded form regardless of input.

  • .domainName(rawValue, defaultValue)

  • .domainNameIdn(rawValue, defaultValue) - Returns domain in non-punycoded form regardless of input.

  • .url(rawValue, defaultValue)

  • .urlWithLocalhost(rawValue, defaultValue)

  • .integer(rawValue, defaultValue)

  • .integerInRange(rawValue, lower, upper, defaultValue)

  • .positiveInteger(rawValue, defaultValue)

  • .positiveIntegerOrZero(rawValue, defaultValue)

  • .float(rawValue, defaultValue)

  • .positiveFloat(rawValue, defaultValue)

  • .positiveFloatOrZero(rawValue, defaultValue)

  • .nonEmptyVisibleUnicode(rawValue, defaultValue)

  • .visibleUnicode(rawValue, defaultValue)

  • .nonEmptyPrintableUnicode(rawValue, defaultValue)

  • .printableUnicode(rawValue, defaultValue)

  • .nonEmptyVisibleAscii(rawValue, defaultValue)

  • .visivleAscii(rawValue, defaultValue)

  • .nonEmptyPrintableAscii(rawValue, defaultValue)

  • .printableAscii(rawValue, defaultValue)

  • .alphaNumeric(rawValue, defaultValue)

  • .nonEmptyAlphaNumeric(rawValue, defaultValue)

  • .alphaNumericWithDot(rawValue, defaultValue)

  • .uuid(rawValue, defaultValue)

  • .upperCaseUuid(rawValue, defaultValue)

  • .lowerCaseUuid(rawValue, defaultValue)

  • .json(rawValue, defaultValue)

Mostly, you can leave defaultValue empty, which will cause purify to return undefined in case the value doesn't pass validation.

Keywords

FAQs

Package last updated on 29 Jan 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