对所有表单字段实施字段规范化

Implement field normalization for all form fields

你好,我想像这里一样实现大写形式规范化 Normalizing Form Data

const reducer = combineReducers({
  // other reducers
  form: form.normalize({
    normalizing: {                                    // <--- name of the form
      upper: value => value && value.toUpperCase(),   // normalizer for 'upper' field
      phone: normalizePhone,                          // normalizer for 'phone' field
      min: normalizeMin,                              // normalizer for 'min' field
      max: normalizeMax                               // normalizer for 'max' field
    }
  })
});

我有 100 个字段,我不想写每个字段,而是传递某种数组,类似的东西。

const reducer = combineReducers({
  // other reducers
  form: form.normalize({
    normalizing: {                                    // <--- name of the form
      fieldsArray: value => value && value.toUpperCase(),   // normalizer for 'upper' field
    }
  })
});

如何实现?

Erik R 在他的项目中发布答案
https://github.com/erikras/redux-form/issues/685