danieldkim/validations-js — pull request #1 by fosco-maestro (2014-07-30 13:56:37+00:00)
Title: added validation of exisiting of nodes in recursive call

Hi Daniel,

Thanks for your library!

Unfortunately during work with it I figure out that when you have recursive validation, program is not checking nodes in sequence and if some of nodes are missing, you will get JS error:

```
/Users/pavlo/Projects/server-monitor/node_modules/validations/validations.js:175
var value = obj[prop_name];
^
TypeError: Cannot read property 'host' of undefined
at /Users/pavlo/Projects/server-monitor/node_modules/validations/validations.js:175:20
at Function._.each._.forEach (/Users/pavlo/Projects/server-monitor/node_modules/underscore/underscore.js:87:22)
at validate (/Users/pavlo/Projects/server-monitor/node_modules/validations/validations.js:174:5)
at /Users/pavlo/Projects/server-monitor/node_modules/validations/validations.js:179:29
at Function._.each._.forEach (/Users/pavlo/Projects/server-monitor/node_modules/underscore/underscore.js:87:22)
at Object.validate (/Users/pavlo/Projects/server-monitor/node_modules/validations/validations.js:174:5)
at Object. (/Users/pavlo/Projects/server-monitor/app.js:124:23)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

```

So I added check on existing of nodes in sequence.

So in total during work on your lib I did:
- updated recursive method, not it check before recursion if node is exist;
- updated test files, make them use new require syntax;
- removed unused variables, added missing semicolons;
- added possibility to run test in [Travis](https://travis-ci.org);
- updated README;
- added to package.json missed libraries, also information how to run tests and my name to list of contributions. Changed version to `0.1.3` so please update NPM.

During testing, also found one bug: when you have error in recursion validation, error message instead of required field name contain root field name. I guess it is because of error handling in recursive mode, so one more tweak needed to fix error messages.

I hope my contribution will help to the project.

best regards,
Pavlo Voznenko