westmoreland-validation

0.2.1 • Public • Published

westmoreland-validation

a validation module for both server-side and client-side Westmoreland applications.

Install

npm install --save westmoreland-validation

Purpose

Abstracts all validation logic from app-specific code, allowing for the reuse of validation logic across domains

API

General Usage

var ValidationService = require('westmoreland-validation');

var samplePassword = 'password'
var result = ValidationService.password.validate(samplePassword);

console.log(result.valid) // false
console.log(result.error) // The password failed the following required tests: The password must be at least 10 characters long. Additionally, The password must meet at least 2 of the following tests: The password must contain at least one uppercase letter. The password must contain at least one number. The password must contain at least one special character.

Testing

npm test

Todo

  • [x] fix issue with Mexico numbers occasionally passing validation

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Copyright (c) 2015 Westmoreland Coal Company. Licensed under the MIT license.

Package Sidebar

Install

npm i westmoreland-validation

Weekly Downloads

0

Version

0.2.1

License

MIT

Last publish

Collaborators

  • wccdevteam