<commit_before>var Handlebars = require('handlebars');

function Exbars(options) {
  this.defaultLayout = options.defaultLayout ? options.defaultLayout : null;
  this.handlebars = Handlebars;
  this.compilerOptions = options.compilerOptions ? options.compilerOptions : {};
  this.compiledTemplates = {};

  this.registerHelper = function(name, helper) {
    return this.handlebars.registerHelper(name, helper);
  };

  this.registerPartial = function(name, content) {
    return this.handlebars.registerPartial(name, content);
  };

  this.compile = function(template, content) {
    this.compiledTemplates[template] = this.handlebars.compile(content, this.compilerOptions);
  };

  this.render = function(filePath, options, callback) {
    var template = this.compiledTemplates[filePath];
    var layout = options.layout === null ? null : options.layout || this.defaultLayout;
    if(layout) {
      var layoutTemplate = this.compiledTemplates[process.cwd() + '/views/layouts/' + layout + '.hbs'];
      options.body = template(options);
      return callback(null, layoutTemplate(options));
    } 
    return callback(null, template(options));
  };

  this.engine = function() {
    return this.render.bind(this);
  };
}

module.exports = Exbars;
<commit_msg>Use false instead of null to avoid using a layout<commit_after>var Handlebars = require('handlebars');

function Exbars(options) {
  this.defaultLayout = options.defaultLayout ? options.defaultLayout : null;
  this.compilerOptions = options.compilerOptions ? options.compilerOptions : {};
  this.handlebars = Handlebars;
  this.compiledTemplates = {};

  this.registerHelper = function(name, helper) {
    return this.handlebars.registerHelper(name, helper);
  };

  this.registerPartial = function(name, content) {
    return this.handlebars.registerPartial(name, content);
  };

  this.compile = function(template, content) {
    this.compiledTemplates[template] = this.handlebars.compile(content, this.compilerOptions);
  };

  this.render = function(filePath, options, callback) {
    var template = this.compiledTemplates[filePath];
    var layout = options.layout === false ? null : options.layout || this.defaultLayout;
    if(layout) {
      var layoutTemplate = this.compiledTemplates[process.cwd() + '/views/layouts/' + layout + '.hbs'];
      options.body = template(options);
      return callback(null, layoutTemplate(options));
    }
    return callback(null, template(options));
  };

  this.engine = function() {
    return this.render.bind(this);
  };
}

module.exports = Exbars;

{'fraction_non_alphanumeric': 0.12900703674745895, 'fraction_numerical': 0.0, 'mean_word_length': 4.3201663201663205, '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': '5471294', 'n_tokens_mistral': 731, 'n_tokens_neox': 711, 'n_words': 145}