Open jeff0905 opened 5 years ago
type: ['string', 'object'],
test: function(cb) {
const thisField = this.value;
// check....
cb();
}
type.js:90 Uncaught TypeError: list.map is not a function at Fn.types [as test] (type.js:90) at schema.js:331 at run (iterator.js:5) at mapSeries (iterator.js:18) at Schema.validate (schema.js:197) at iterator (schema.js:314) at run (iterator.js:5) at mapSeries (iterator.js:18) at onValidate (schema.js:251) at Fn.test (event.js:53) at schema.js:331 at run (iterator.js:5) at mapSeries (iterator.js:18) at Schema.validate (schema.js:197)
if i should code like this email: [ {type: "string", required: true}, function(cb) { // test if email address (this.value) already exists // in a database and call this.raise() if it does cb(); } ] because this code before: type: ['string', 'object'], test: function(cb) { const thisField = this.value; // check.... cb(); }
after check my code, i found that if we invoke some times , the type: ['string', Number] throw errors,
but, type: ['string', 'number] can't throw error after invoking some times.
Thanks for the bug report @jeff0905, can you provide a copy and paste example that reproduces the issue please. If I can reproduce it, I should be able to fix it quickly. Thanks.
after invoke some times. the
type: ['string', 'object']
--> `type: ['string'].