(style): autoreformat field-directive.js

there was 1 unnecessary tab
refactored switch case in field-directive

replace switch case with a for in loop