<commit_before>"use strict";

var gUtil = require('gulp-util')
  , PluginError = gUtil.PluginError
  , File = gUtil.File
  , through = require('through')
  , _ = require('lodash')
  , printf = require('util').format


function pluginError (message) {
  return new PluginError('gulp-jst-concat', message)
}

function compile (file, options) {
  var name = file.path.replace(new RegExp(options.renameKeys[0]), options.renameKeys[1])
    , contents = String(file.contents)

  return {
    name: name,
    fnSource: _.template(contents, null, options.templateSettings || null).source
  }
}

function buildJSTString(files, options) {
  function compileAndRender (file) {
    var template = compile(file, options)
    return printf('"%s": %s', template.name, template.fnSource)
  }

  return printf('this.JST = {%s};', files.map(compileAndRender).join(',\n'))
}

module.exports = function jstConcat(fileName, _opts) {
  if (!fileName) throw pluginError('Missing fileName')

  var defaults = { renameKeys: ['.*', '$&'] }
    , opts = _.extend({}, defaults, _opts)
    , files = []

  function write (file) {
    /* jshint validthis: true */
    if (file.isNull()) return
    if (file.isStream()) return this.emit('error', pluginError('Streaming not supported'))

    files.push(file)
  }
<commit_msg>resolved merge by adding namespace to the options object passed into build jst string<commit_after>"use strict";

var gUtil = require('gulp-util')
  , PluginError = gUtil.PluginError
  , File = gUtil.File
  , through = require('through')
  , _ = require('lodash')
  , printf = require('util').format


function pluginError (message) {
  return new PluginError('gulp-jst-concat', message)
}

function compile (file, options) {
  var name = file.path.replace(new RegExp(options.renameKeys[0]), options.renameKeys[1])
    , contents = String(file.contents)

  return {
    name: name,
    fnSource: _.template(contents, null, options.templateSettings || null).source
  }
}

function buildJSTString(files, options) {
  function compileAndRender (file) {
    var template = compile(file, options)
    return printf('"%s": %s', template.name, template.fnSource)
  }

  return printf('this.%s = {%s};', options.namespace, files.map(compileAndRender).join(',\n'))
}

module.exports = function jstConcat(fileName, _opts) {
  if (!fileName) throw pluginError('Missing fileName')

  var defaults = { renameKeys: ['.*', '$&'], namespace: 'JST' }
    , opts = _.extend({}, defaults, _opts)
    , files = []

  function write (file) {
    /* jshint validthis: true */
    if (file.isNull()) return
    if (file.isStream()) return this.emit('error', pluginError('Streaming not supported'))

    files.push(file)
  }

{'fraction_non_alphanumeric': 0.15553080920564216, 'fraction_numerical': 0.0014847809948032665, 'mean_word_length': 4.143129770992366, 'pattern_counts': {'":': 2, '<': 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': '3041386', 'n_tokens_mistral': 857, 'n_tokens_neox': 845, 'n_words': 202}