<commit_before>var fs    = require('fs');
var path  = require('path');
var cjson = require('cjson');
var _     = require('lodash');

var data = null;

var OPTS_FILE = 'supersamples.opts';

var DEFAULTS = {
  output: './tmp',
  renderer: {
    name: 'html',
    options: {
      title: 'API Documentation',
      baseUrl: 'http://localhost',
      intro:  null,
      styles: []
    }
  }
};

exports.read = function() {
  if (fs.existsSync(OPTS_FILE) === false) {
    return DEFAULTS;
  }
  try {
    var opts = cjson.load(OPTS_FILE);
    return _.defaults(opts, DEFAULTS);
  } catch (ex) {
    console.error('Invalid config file: ' + path.resolve('supersamples.opts'));
    console.error(ex);
    process.exit(1);
  }
};

exports.get = function() {
  if (!data) data = exports.read();
  return data;
};
<commit_msg>bug fix in invalid default options<commit_after>var fs    = require('fs');
var path  = require('path');
var cjson = require('cjson');
var _     = require('lodash');

var data = null;

var OPTS_FILE = 'supersamples.opts';

var DEFAULTS = {
  baseUrl: 'http://localhost',
  renderers: {
    html: {
      outputFolder: './tmp',
      title: 'API Documentation',
      intro: null,
      files: {
        "example/docs/files/**": "."
      },
      styles: [
        'custom.css'
      ]
    }
  }
};

exports.read = function() {
  if (fs.existsSync(OPTS_FILE) === false) {
    return DEFAULTS;
  }
  try {
    var opts = cjson.load(OPTS_FILE);
    return _.defaults(opts, DEFAULTS);
  } catch (ex) {
    console.error('Invalid config file: ' + path.resolve('supersamples.opts'));
    console.error(ex);
    process.exit(1);
  }
};

exports.get = function() {
  if (!data) data = exports.read();
  return data;
};

{'fraction_non_alphanumeric': 0.17255356108859293, 'fraction_numerical': 0.0011580775911986102, 'mean_word_length': 2.7978021978021976, 'pattern_counts': {'":': 1, '<': 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': '5124540', 'n_tokens_mistral': 599, 'n_tokens_neox': 601, 'n_words': 132}