src/models/sections/packageComments.js

Summary

Maintainability
A
0 mins
Test Coverage
import { hasYesOrNo } from 'models/validate'

const packageComments = {
  HasComments: { presence: true, hasValue: { validator: hasYesOrNo } },
  Comments: (value, attributes) => {
    if (attributes.HasComments && attributes.HasComments.value === 'Yes') {
      return { presence: true, hasValue: true }
    }
    return {}
  },
}

export default packageComments