<commit_before>/**
 * Module dependencies
 */

var pkg = require('../package');

/**
 * hyperInput
 */

pkg.directive('hyperInputOptions', [
  'hyper',
  function(hyper) {
    return {
      link: function ($scope, el, attrs) {
        hyper.get(attrs.hyperInputOptions, $scope, function(options) {
          $scope.options = options = options || [];
          angular.forEach(options, function(opt) {
            if (!opt) return;

            function set(key) {
              hyper.get(key, opt, function(val) {
                opt[key] = val;
                try {
                  $scope.$digest();
                } catch (e) {}
              });
            }

            set('text');
            set('value');
          });
        });
      }
    };
  }
]);<commit_msg>continuously watch fetched options<commit_after>/**
 * Module dependencies
 */

var pkg = require('../package');

/**
 * hyperInput
 */

pkg.directive('hyperInputOptions', [
  'hyper',
  function(hyper) {
    return {
      link: function ($scope, el, attrs) {
        hyper.get(attrs.hyperInputOptions, $scope, function(options) {
          $scope.options = options || [];
          fetch();
        });

        $scope.$watch('options[0].text', function(val) {
          if (typeof val === 'object' && val.href) fetch();
        });

        function fetch() {
          angular.forEach($scope.options || [], function(opt) {
            if (!opt) return;

            function set(key) {
              hyper.get(key, opt, function(val) {
                opt[key] = val;
                try {
                  $scope.$digest();
                } catch (e) {}
              });
            }

            set('text');
          });
        }
      }
    };
  }
]);
{'fraction_non_alphanumeric': 0.16389684813753583, 'fraction_numerical': 0.0005730659025787965, 'mean_word_length': 1.4871794871794872, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6592144', 'n_tokens_mistral': 499, 'n_tokens_neox': 481, 'n_words': 92}