<commit_before>var clone = require('clone');

module.exports = function (api) {
  var index = clone(api);
  delete index['x-bravado-sourceFile'];
  delete index['properties'];
  Object.keys(index.resources).forEach(function (r) {
    delete index.resources[r]['x-bravado-controller'];
    delete index.resources[r]['x-bravado-fullPath'];
    Object.keys(index.resources[r].actions).forEach(function (a) {
      delete index.resources[r].actions[a]['x-bravado-fullPath'];
    });
  });
  return function (req, res, next) {
    res.json(index);
    next();
  };
};
<commit_msg>does not advertise resources or actions marked as private<commit_after>var clone = require('clone');

module.exports = function (api) {
  var index = clone(api);
  delete index['x-bravado-sourceFile'];
  delete index['properties'];
  Object.keys(index.resources).forEach(function (r) {
    var resource = index.resources[r];
    if (resource.private) {
      delete index.resources[r];
    } else {
      delete resource['x-bravado-controller'];
      delete resource['x-bravado-fullPath'];
      Object.keys(resource.actions).forEach(function (a) {
        var action = resource.actions[a];
        if (action.private) {
          delete resource.actions[a];
        } else {
          delete action['x-bravado-fullPath'];
        }
      });
    }
  });
  return function (req, res, next) {
    res.json(index);
    next();
  };
};

{'fraction_non_alphanumeric': 0.16252661462029808, 'fraction_numerical': 0.0, 'mean_word_length': 3.3251533742331287, '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': '4288893', 'n_tokens_mistral': 438, 'n_tokens_neox': 436, 'n_words': 84}