Be careful what and how you “optimize”

Sometimes we tend to over-engineer our code. Just because we think it will look smarter, or run faster, or be more canon-compliant. Let’s take, for example, this function that gets a value from the server and translates it into a class name to apply to an element. angular.module('widgetTransactionsFilters', []) .filter('transactionType', function() { return function(input) { […]