1.0.2 • Published 9 years ago

mc.validators v1.0.2

Weekly downloads
4
License
GPL
Repository
-
Last release
9 years ago

mc.validators


mc.validators is a package which contains helper methods for checking types of parameters in Node.js applications

Methods

  • ThrowsWhenNotNumber(value, paramName)
  • ThrowsWhenNotText(value, paramName)
  • ThrowsWhenNotBoolean(value, paramName)
  • ThrowsWhenNotFunction(value, paramName)
  • ThrowsWhenNotCustomObject(value, paramName, customType)

Examples

Use of validators

var validator = require('validators');

function CalcFryingPanDiscount(price, percent) {
	validator.ThrowsWhenNotNumber(price, 'price');
	validator.ThrowsWhenNotNumber(percent, 'percent');
	
	return price * (1 - percent);
}

Release notes

  • README.md changes
  • version fixes (to match with the NPM standard)

Contact

For more information please visit: https://bitbucket.org/Sylvin_Stallone/mc.validators