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.
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.