<commit_before>'use strict';

angular.module('arethusa.morph').directive('morphFormCreate', [
  'morph',
  'state',
  'notifier',
  function(morph, state, notifier) {
    return {
      restrict: 'E',
      scope: {
        token: '=morphToken',
        id: '=morphId'
      },
      link: function (scope, element, attrs) {
        var inArray = arethusaUtil.isIncluded;

        scope.m = morph;
        scope.form = scope.token.customForm;
        scope.forms = scope.token.forms;

        function dependencyMet(dependencies) {
          if (!dependencies) {
            return true;
          }
          var ok = true;
          for (var k in dependencies) {
            var depArray = dependencies[k];
            if (!inArray(depArray, scope.form.attributes[k])) {
              ok = false;
              break;
            }
          }
          return ok;
        }

        function getVisibleAttributes() {
          return arethusaUtil.inject([], morph.postagSchema, function (memo, attr) {
            var ifDependencies = (morph.dependenciesOf(attr) || {}).if;
            if (dependencyMet(ifDependencies)) {
              memo.push(attr);
            }
          });
        }

        function setVisibleAttributes() {
          scope.visibleAttributes = getVisibleAttributes();<commit_msg>Add unless dependency handling in mFC<commit_after>'use strict';

angular.module('arethusa.morph').directive('morphFormCreate', [
  'morph',
  'state',
  'notifier',
  function(morph, state, notifier) {
    return {
      restrict: 'E',
      scope: {
        token: '=morphToken',
        id: '=morphId'
      },
      link: function (scope, element, attrs) {
        var inArray = arethusaUtil.isIncluded;

        scope.m = morph;
        scope.form = scope.token.customForm;
        scope.forms = scope.token.forms;

        function depdencencyMet(dependencies, type) {
          if (!dependencies) {
            return true;
          }
          var ok = true;
          for (var k in dependencies) {
            var condition;
            condition = checkAttribute(dependencies, k);
            condition = type ? condition : !condition;
            if (condition) {
              ok = false;
              break;
            }
          }
          return ok;
        }

        function checkAttribute(dependencies, attr) {
          var value = dependencies[attr];
          return inArray(value, scope.form.attributes[attr]);
        }

        function ifDependencyMet(dependencies) {
          return depdencencyMet(dependencies, false);
        }

        function unlessDependencyMet(dependencies) {
          return depdencencyMet(dependencies, true);
        }

        function getVisibleAttributes() {
          return arethusaUtil.inject([], morph.postagSchema, function (memo, attr) {
            var ifDependencies = (morph.dependenciesOf(attr) || {}).if;
            if (dependencyMet(ifDependencies)) {
              memo.push(attr);
            }
          });
        }

        function setVisibleAttributes() {
          scope.visibleAttributes = getVisibleAttributes();
{'fraction_non_alphanumeric': 0.1109681569636539, 'fraction_numerical': 0.0, 'mean_word_length': 1.8427787934186473, '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': '1081870', 'n_tokens_mistral': 851, 'n_tokens_neox': 825, 'n_words': 179}