To avoid duplication you could just write return { header: function() {...}, ...}. Also helper function could be put in the bottom, since we use a top-down order.