18F/e-QIP-prototype

View on GitHub
src/schema/section/legal-technology-unlawful.js

Summary

Maintainability
A
0 mins
Test Coverage
import * as form from '../form'

export const legalTechnologyUnlawful = (data = {}) => {
  const items = ((data.List || {}).items || []).map(x => {
    const xitem = x.Item || {}
    return {
      Item: {
        Date: form.datecontrol(xitem.Date),
        Incident: form.textarea(xitem.Incident),
        Location: form.location(xitem.Location),
        Action: form.textarea(xitem.Action)
      }
    }
  })
  return {
    HasUnlawful: form.branch(data.HasUnlawful),
    List: form.collection(items, (data.List || {}).branch)
  }
}