<commit_before>// framework/specialTags/init.js
// ----------------

function makeDescriptorTags(descriptor) {
  var tags = {};
  if( isString(descriptor.methodName) ) {
    extend(tags, {
      referenceNamespace: '__' + descriptor.methodName + 'Reference',
      isModelCtorDuckTag: '__isModelCtor',
      isModelDuckTag: '__isModel',
      isModelCtor: isModelCtor,
      isModel: isModel
    });
  }
  return tags;
}

specialTagDescriptors = map(specialTagDescriptors, function prepareDescriptor(descriptor) {
  return extend({
      resourceLocations: {},
      registered: {},
      fileExtensions: fw.observable('.js')
    },
    makeDescriptorTags(descriptor),
    descriptor);
});

extend(specialTagDescriptors, {
  tagNameIsPresent: function isSpecialTagDescriptorPresent(tagName) {
    return filter(specialTagDescriptors, function matchingTagNames(descriptor) {
      return descriptor.tagName === tagName;
    }).length > 0;
  },
  resourceFor: function getResourceForSpecialTag(tagName) {
    return reduce(specialTagDescriptors, function(resource, descriptor) {
      if(descriptor.tagName === tagName) {
        resource = descriptor.resource;
      }
      return resource;
    }, null);
  },
  getDescriptor: function(methodName) {
    var descriptors = filter(specialTagDescriptors, function matchingTagNames(descriptor) {
      return descriptor.methodName === methodName;
    });
    return descriptors.length ? descriptors[0] : null;
  }
});<commit_msg>cleanup<commit_after>// framework/specialTags/init.js
// ----------------

function makeBooleanChecks(descriptor) {
  var booleanFunctions = {};

  booleanFunctions.isModelCtor = function(thing) {
    return isFunction(thing) && !!thing[ descriptor.isModelCtorDuckTag ];
  };

  booleanFunctions.isModel = function(thing) {
    return isFunction(thing) && !!thing[ descriptor.isModelDuckTag ];
  };

  return booleanFunctions;
}

specialTagDescriptors = map(specialTagDescriptors, function prepareDescriptor(descriptor) {
  descriptor = extend({
    resourceLocations: {},
    registered: {},
    fileExtensions: fw.observable('.js'),
    isModelCtorDuckTag: '__isModelCtor',
    isModelDuckTag: '__isModel',
    referenceNamespace: (isString(descriptor.methodName) ? ('__' + descriptor.methodName + 'Reference') : undefined)
  }, descriptor);

  return extend(descriptor, makeBooleanChecks(descriptor));
});

extend(specialTagDescriptors, {
  tagNameIsPresent: function isSpecialTagDescriptorPresent(tagName) {
    return filter(this, function matchingTagNames(descriptor) {
      return descriptor.tagName === tagName;
    }).length > 0;
  },
  resourceFor: function getResourceForSpecialTag(tagName) {
    return reduce(this, function(resource, descriptor) {
      if(descriptor.tagName === tagName) {
        resource = descriptor.resource;
      }
      return resource;
    }, null);
  },
  getDescriptor: function(methodName) {
    return reduce(this, function findDescriptor(foundDescriptor, descriptor) {
      return descriptor.methodName === methodName ? descriptor : foundDescriptor;
    }, null);
  }
});
{'fraction_non_alphanumeric': 0.1261319534282018, 'fraction_numerical': 0.0009702457956015524, 'mean_word_length': 4.078817733990148, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1541712', 'n_tokens_mistral': 855, 'n_tokens_neox': 854, 'n_words': 158}