-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Labels
Description
If an input from a React component is returned to Winterfell with an undefined value. A deprecation warning is thrown.
validator deprecated you tried to validate an undefined but this library (validator.js) validates strings only. Please update your code as this will be an error soon. node_modules/winterfell/dist/lib/validation.js:70:27
The simplest fix would be to coerce the value to an empty string in /src/lib/validation.js. So that lines 36 and 37 change from this:
var validateAnswer = (value, validationItem, questionAnswers) => {
var validationMethod = typeof extraValidators[validationItem.type] !== 'undefined'
? extraValidators[validationItem.type]
: Validator.hasOwnProperty(validationItem.type)
&& typeof Validator[validationItem.type] === 'function'
? Validator[validationItem.type]
: undefined;To this:
var validateAnswer = (value, validationItem, questionAnswers) => {
value = (value === undefined) ? '' : value;
var validationMethod = typeof extraValidators[validationItem.type] !== 'undefined'
? extraValidators[validationItem.type]
: Validator.hasOwnProperty(validationItem.type)
&& typeof Validator[validationItem.type] === 'function'
? Validator[validationItem.type]
: undefined;