leepowellcouk/mongoose-validator — pull request #13 by toddbluhm (2014-02-18 07:23:54+00:00)
Title: Added ability to keep orginal value type in custom validation methods

When trying to use a custom validation method on a non-string type,
validator would try to force the type to a string, which made
validation checking on non-string types very difficult. This PR adds
the ability to pass an option called: "keepOriginalValue: true" (just
like passIfEmpty) and this will not force "this.str" inside custom
validation functions to a string, but leave it untouched. Leaving it
untouched allows for custom type checking as well as still being able
to chain it with other mongoose-validators. Tests included and passing.