hygiene
Hygiene.js - sanitize your input
Last updated 7 years ago by nnarhinen .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install hygiene 
SYNC missed versions from official npm registry.

Hygiene.js - sanitize your input

Asynchronous validator

Hygiene.js is written for NodeJS, so it's only natural for it to be asyncronous. The point of Hygiene.js validator is to validate user input objects. It's convenient when using web frameworks like express etc.

###Usage


var hygiene = require('hygiene');

var userValidator = hygiene.validator
	.withString('name')
	.withNumber('age');
	
userValidator.validate({name: 'John Doe', age: 'Not a number'}, function(err, result, resultDetails) {
	assert.equal(false, result);
	assert.equal("Property 'age' is of wrong type", resultDetails.age);
});

Asychronous Sanitizer

NodeJS makes it easy to use document databases that support storing JSON objects. However it doesn't remove the need to sanitize what goes to the database and in which format. Hygiene.js helps you with keeping your data - the most valuable part of your application - clean and easy to use.

###Usage


var hygiene = require('hygiene');

var userValidator = hygiene.validator
	.withString('name')
	.withNumber('age');
	
userValidator.validate({name: 'John Doe', age: '33'}, function(err, result, resultDetails, sanitizedObject) {
	assert.equal(true, result);
	assert.strictEqual(33, sanitizedObject.age);
});

Current Tags

  • 0.0.16                                ...           latest (7 years ago)

16 Versions

  • 0.0.16                                ...           7 years ago
  • 0.0.15                                ...           7 years ago
  • 0.0.14                                ...           7 years ago
  • 0.0.13                                ...           7 years ago
  • 0.0.12                                ...           7 years ago
  • 0.0.11                                ...           7 years ago
  • 0.0.10                                ...           7 years ago
  • 0.0.9                                ...           7 years ago
  • 0.0.8                                ...           8 years ago
  • 0.0.7                                ...           8 years ago
  • 0.0.6                                ...           8 years ago
  • 0.0.5                                ...           8 years ago
  • 0.0.4                                ...           8 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2016 © taobao.org |