getResult = (m1, m2, location, address, products, parent) -> opts = [ "Name of Facility" "Address" "Type of products or services" "Approximate number of workers at each site" "Name of Parent Company (for each facility if applicable)" ] if ["Yes", "Partial"].includes m1 then m1 else if [m2].flat().filter((v) -> opts.includes v).length == 5 then "Yes" else if [m2].flat().some((v) -> opts.includes v) then "Partial" else if [location, address, products, parent].filter((v) -> v == "Yes").length == 4 then "Yes" else if [location, address, products, parent].some((v) -> v == "Yes") then "Partial" else "No" getResult(m1, m2, location, address, products, parent)