added support for async/custom validations #411

added callback parameter to `lib.validation.validate()` returning errors
as array in callback, empty array if no errors (since there was a test
for that). updated tests.

added `extra_validations` object to allow for custom validation function
in `lib/validation.js`.

Modified registrations transition to support async/custom validations in
addition to the synchronous Pupil validations.

Validation settings may consist of Pupil.js rules and custom rules.
These cannot be combined as part of the same rule.

Not OK:
  rule: "regex(\d{5}) && unique('patient_id')"

OK:
  rule: "regex(\d{5}) && max(11111)"

If for example you want to validate that patient_id is 5 numbers and it
is unique (or some other custom validation) you need to define two
validation configs/separate rules in your settings. Example validation
settings:

[
  {
    property: "patient_id",
    rule: "regex(\d{5})",
    message: "Patient ID must be 5 numbers."
  },
  {
    property: "patient_id",
    rule: "unique('patient_id')",
    message: "Patient ID must be unique."
  }
]

Opened issue on Pupil repo for future reference:
https://github.com/Dragory/Pupil.js/issues/5

Modified `pupil.validator` to ignore when a validation function does not exist in
its library.

Exported lexer and parser modules from Pupil to allow for parsing rules
for custom/async validations.

TODO finish custom `unique` validation function and add some tests
around it.
removed `lib.validations.tokenVals`, cruft.
minor function description fix.
minor, removed unnecessary noop in test.
added `unique` valdiation that takes patient_id parameter. #411

Supports unique('patient_id') rule on a validation in settings, added
two tests.

Fixed potential bug where db was undefined in
transitions.registration.setId().
use TEST_ENV=1 in travis config.
Merge pull request #50 from medic/async-validations

added support for async/custom validations