<commit_before>module.exports = (function() {
  "use strict";

  var fs = require('fs');
  var markdownCreator = require('./markdownCreator').MarkdownCreator;


  /*
   * The name Markdown maker, as the name suggests, produces a file containing Markdown documentation for each
   * APIFunction, synonym and APIObject found, ordered by name. The client should supply the collated functions
   * and objects, and the name of the file to output. Optionally, an options object can be supplied, with the 'pre'
   * and 'post' properties containing Markdown to be added before and after the output. (Line endings will be added
   * to the lines if required).
   *
   * Any errors thrown by Node's file-writing routines will bubble up.
   *
   */

  var categoryMarkdownMaker = function(collator, filename, options) {
    options = options || {};

    var categories = collator.getCategories();
    var fileContents = [];

    categories.forEach(function(cat) {
      var fns = collator.byName();

      fns.forEach(function(fn) {
        fileContents = fileContents.concat(markdownCreator(fn, {includeCategory: true}).split('\n'));
      });
    });

    var toWrite = (options.pre ? options.pre : []).concat(fileContents).concat(options.post ? options.post : []);
    toWrite = toWrite.map(function(s) { return /\n$/.test(s) ? s : s + '\n'; }).join('');
    fs.writeFileSync(filename, toWrite, {encoding: 'utf-8'});
    return fileContents;
  };


  return categoryMarkdownMaker;
})();
<commit_msg>Naming error<commit_after>module.exports = (function() {
  "use strict";

  var fs = require('fs');
  var markdownCreator = require('./markdownCreator').MarkdownCreator;


  /*
   * The name Markdown maker, as the name suggests, produces a file containing Markdown documentation for each
   * APIFunction, synonym and APIObject found, ordered by name. The client should supply the collated functions
   * and objects, and the name of the file to output. Optionally, an options object can be supplied, with the 'pre'
   * and 'post' properties containing Markdown to be added before and after the output. (Line endings will be added
   * to the lines if required).
   *
   * Any errors thrown by Node's file-writing routines will bubble up.
   *
   */

  var nameMarkdownMaker = function(collator, filename, options) {
    options = options || {};

    var categories = collator.getCategories();
    var fileContents = [];

    categories.forEach(function(cat) {
      var fns = collator.byName();

      fns.forEach(function(fn) {
        fileContents = fileContents.concat(markdownCreator(fn, {includeCategory: true}).split('\n'));
      });
    });

    var toWrite = (options.pre ? options.pre : []).concat(fileContents).concat(options.post ? options.post : []);
    toWrite = toWrite.map(function(s) { return /\n$/.test(s) ? s : s + '\n'; }).join('');
    fs.writeFileSync(filename, toWrite, {encoding: 'utf-8'});
    return fileContents;
  };


  return nameMarkdownMaker;
})();

{'fraction_non_alphanumeric': 0.1269734632180047, 'fraction_numerical': 0.0006718172657037286, 'mean_word_length': 3.567484662576687, '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': '745214', 'n_tokens_mistral': 869, 'n_tokens_neox': 840, 'n_words': 275}