(value, helpers, wordCount)
| 6 | * @returns {*} The validated value if the word count is met, otherwise an error. |
| 7 | */ |
| 8 | const customWordCountValidator = (value, helpers, wordCount) => { |
| 9 | const words = value.split(/\s+/); |
| 10 | |
| 11 | if (words.length < wordCount) { |
| 12 | return helpers.error("any.invalid"); |
| 13 | } |
| 14 | |
| 15 | return value; |
| 16 | }; |
| 17 | |
| 18 | module.exports = { |
| 19 | customWordCountValidator, |
no outgoing calls
no test coverage detected