busypeoples / spected

Validation library
MIT License
703 stars 32 forks source link

Enable to define a function for error message. #1

Closed busypeoples closed 7 years ago

busypeoples commented 7 years ago

Based on this PR by @apalm in Revalidation. It makes a lot of sense to enable to pass in a function instead of a string, in case the input value is needed to display a useful error message.

The specific change would require to check if errorMsg is a function and if so apply the function with the value.

https://github.com/25th-floor/spected/blob/master/src/index.js#L36

busypeoples commented 7 years ago

This is solved now via #2