<commit_before>angular.module('bp').directive('bpSref', function($state, $parse, BpTap) {
  return function(scope, element, attrs) {
    new BpTap(scope, element, attrs)
    element.bind('tap', function() {
      $state.transitionTo(attrs.bpSref)
      return false
    })
    scope.$on('$destroy', function() {
      element.unbind('tap')
    })
  }
})<commit_msg>feat(sref): allow ui-router style param definition<commit_after>angular.module('bp').directive('bpSref', function($state, $parse, BpTap) {
  return {
    controller: function($scope) {
      // https://github.com/angular-ui/ui-router/blob/master/src/stateDirectives.js#L1-L5
      this.parseStateRef = function(ref) {
        var parsed = ref.replace(/\n/g, ' ').match(/^([^(]+?)\s*(\((.*)\))?$/)
        return {
          state: parsed[1],
          params: parsed[3] ? $parse(parsed[3])($scope) : null
        }
      }
    },
    link: function(scope, element, attrs, ctrl) {
      var ref = ctrl.parseStateRef(attrs.bpSref)
      new BpTap(scope, element, attrs)
      element.bind('tap', function() {
        $state.go(ref.state,ref.params)
        return false
      })
      scope.$on('$destroy', function() {
        element.unbind('tap')
      })
    }
  }
})
{'fraction_non_alphanumeric': 0.18638573743922204, 'fraction_numerical': 0.004051863857374392, 'mean_word_length': 2.8, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7130573', 'n_tokens_mistral': 421, 'n_tokens_neox': 419, 'n_words': 66}