async-validate icon indicating copy to clipboard operation
async-validate copied to clipboard

after invoke some times, the `type: ['string', 'object']` --> `type: ['string'].

Open jeff0905 opened this issue 7 years ago • 5 comments

after invoke some times. the type: ['string', 'object'] --> `type: ['string'].

jeff0905 avatar Oct 06 '18 07:10 jeff0905

  type: ['string', 'object'],
  test: function(cb) {
    const thisField = this.value;
    // check....
    cb();
  }

jeff0905 avatar Oct 06 '18 07:10 jeff0905

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)

jeff0905 avatar Oct 06 '18 07:10 jeff0905

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(); }

jeff0905 avatar Oct 06 '18 07:10 jeff0905

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.

jeff0905 avatar Oct 07 '18 19:10 jeff0905

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.

tmpfs avatar Oct 07 '18 23:10 tmpfs