Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convertType didn't work with array #80

Open
fisherwei opened this issue Apr 27, 2020 · 1 comment
Open

convertType didn't work with array #80

fisherwei opened this issue Apr 27, 2020 · 1 comment

Comments

@fisherwei
Copy link

rule:
{ category: { type: 'array', itemType: 'int', required: false, } }

data:
{ category: [ '403', '407', '303', '307' ] }

@ckvv
Copy link

ckvv commented Aug 14, 2020

目前不支持array convert

if (typeof value === 'object') return;

只能修改代码解决

  // convertType support array
  if(Array.isArray(value)){
    switch (convertType) {
      case 'int':
      case 'number':
        obj[key] = value.map((val) => Number(val));
      default:
    }
    return
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants