add an option object to a value array or call a fuction based on the object's properties