<commit_before>function _isObject(obj) {
  return obj === Object(obj);
}

function makeConsistent(obj, types) {
  if (_isObject(obj)) {
    if (obj.type) {
      if (Array.isArray(obj.type)) {
        obj.type = obj.type[0];
      }

      if (types && types[obj.type]) {
        const mergedObj = Object.assign({}, obj, types[obj.type]);

        // Every exception of inheritance should be deleted from mergedObj
        if (obj.description && types[obj.type].description) {
          delete mergedObj.description;
        }

        Object.assign(obj, mergedObj);
      }
    }

    if (obj.items && types && types[obj.items]) {
      obj.items = types[obj.items];
    }

    if (obj.structuredExample) {
      if (typeof obj.examples === 'undefined') {
        obj.examples = [];
      }

      obj.examples.push(obj.structuredExample);
      delete obj.example;
      delete obj.structuredExample;
    }

    if (obj.examples && obj.examples.length) {
      obj.examples = obj.examples.map(example => (example.value ? example : { value: example }));
    }

    // The RAML 1.0 spec allows that:
    //  "A securedBy node containing null as the array component indicates
    //   the method can be called without applying any security scheme."
    if (Array.isArray(obj.securedBy) && obj.securedBy.length === 1 && obj.securedBy[0] === null) {
      delete obj.securedBy;
    }

    // Fix inconsistency between request headers and response headers from raml-1-parser.
    // https://github.com/raml-org/raml-js-parser-2/issues/582
    if (Array.isArray(obj.headers)) {
      obj.headers.forEach((hdr) => {
        if (typeof hdr.key === 'undefined' && hdr.name) {
          hdr.key = hdr.name;<commit_msg>Use the example's name as displayName when displayName is absent.<commit_after>function _isObject(obj) {
  return obj === Object(obj);
}

function makeConsistent(obj, types) {
  if (_isObject(obj)) {
    if (obj.type) {
      if (Array.isArray(obj.type)) {
        obj.type = obj.type[0];
      }

      if (types && types[obj.type]) {
        const mergedObj = Object.assign({}, obj, types[obj.type]);

        // Every exception of inheritance should be deleted from mergedObj
        if (obj.description && types[obj.type].description) {
          delete mergedObj.description;
        }

        Object.assign(obj, mergedObj);
      }
    }

    if (obj.items && types && types[obj.items]) {
      obj.items = types[obj.items];
    }

    if (obj.structuredExample) {
      if (typeof obj.examples === 'undefined') {
        obj.examples = [];
      }

      obj.examples.push(obj.structuredExample);
      delete obj.example;
      delete obj.structuredExample;
    }

    if (obj.examples && obj.examples.length) {
      obj.examples = obj.examples.map((example) => {
        if (!example.value) {
          return { value: example };
        }
        if (!example.displayName && example.name) {
          example.displayName = example.name;
        }
        return example;
      });
    }

    // The RAML 1.0 spec allows that:
    //  "A securedBy node containing null as the array component indicates
    //   the method can be called without applying any security scheme."
    if (Array.isArray(obj.securedBy) && obj.securedBy.length === 1 && obj.securedBy[0] === null) {
      delete obj.securedBy;
    }

    // Fix inconsistency between request headers and response headers from raml-1-parser.
    // https://github.com/raml-org/raml-js-parser-2/issues/582
    if (Array.isArray(obj.headers)) {
      obj.headers.forEach((hdr) => {
        if (typeof hdr.key === 'undefined' && hdr.name) {
          hdr.key = hdr.name;
{'fraction_non_alphanumeric': 0.13885839736553238, 'fraction_numerical': 0.005488474204171241, 'mean_word_length': 2.359447004608295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2604888', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1078, 'n_words': 260}