<commit_before>/**
 * gulp-es6-template-strings <https://github.com/tunnckoCore/gulp-es6-template-strings>
 *
 * Copyright (c) 2014-2015 <NAME>, contributors.
 * Released under the MIT license.
 */

'use strict';

var through = require('through2');
var es6templateString = require('es6-template-strings');
var PluginError = require('gulp-util').PluginError;
var label = 'gulp-es6-template-strings';

module.exports = function gulpEs6TemplateStrings(context) {
  return through.obj(function (file, enc, cb) {
    if (file.isNull()) {
      cb(null, file);
      return;
    }

    if (file.isStream()) {
      cb(new PluginError(label, 'Streaming not supported'));
      return;
    }

    var contents = file.contents.toString();

    try {
      file.contents = new Buffer(es6templateString(contents, context));
      this.push(file);
    } catch (err) {
      this.emit('error', new PluginError(label, err, {fileName: file.path}));
    }

    cb();
  });
};<commit_msg>istanbul ignore<commit_after>/**
 * gulp-es6-template-strings <https://github.com/tunnckoCore/gulp-es6-template-strings>
 *
 * Copyright (c) 2014-2015 <NAME>, contributors.
 * Released under the MIT license.
 */

'use strict';

var through = require('through2');
var es6templateString = require('es6-template-strings');
var PluginError = require('gulp-util').PluginError;
var label = 'gulp-es6-template-strings';

module.exports = function gulpEs6TemplateStrings(context) {
  return through.obj(function(file, enc, cb) {
    /* istanbul ignore if */
    if (file.isNull()) {
      cb(null, file);
      return;
    }

    /* istanbul ignore if */
    if (file.isStream()) {
      cb(new PluginError(label, 'Streaming not supported'));
      return;
    }

    var contents = file.contents.toString();

    try {
      file.contents = new Buffer(es6templateString(contents, context));
      this.push(file);
    } catch (err) {
      /* istanbul ignore next */
      this.emit('error', new PluginError(label, err, {fileName: file.path}));
    }

    cb();
  });
};
{'fraction_non_alphanumeric': 0.15634218289085547, 'fraction_numerical': 0.015732546705998034, 'mean_word_length': 3.3482905982905984, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '269462', 'n_tokens_mistral': 674, 'n_tokens_neox': 645, 'n_words': 141}