code: function(str) {
        var SNAKE_CASE_REGEXP = /[A-Z]/g;
        return str.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
          return (pos ? '-' : '') + letter.toLowerCase();
        });
      }
docs: copy from https://github.com/angular/angular.js/blob/master/src/Angular.js