<commit_before>/*
 * grunt-es6-module-wrap-default
 * https://github.com/stevoland/grunt-es6-module-wrap-default
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

var path = require('path');

module.exports = function (grunt) {

  grunt.registerMultiTask('es6_module_wrap_default', 'Wrap CommonJS and AMD modules created with es6-module-transpiler so that they can be required as as (\'name\') and not (\'name\').default', function() {
    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
      type: 'cjs'
    });

    if (options.type !== 'cjs' && options.type !== 'amd') {
      throw new Error('options.type must be cjs or amd');
    }

    // Iterate over all specified file groups.
    this.files.forEach(function (f) {
      // Concat specified files.
      f.src.forEach(function (filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      });


      var srcBaseName = path.basename(f.src[0], '.js');
      var srcDirname = path.dirname(f.src[0]);
      var destDirname = path.dirname(f.dest);

      var importPath = path.join(path.relative(destDirname, srcDirname), srcBaseName);

      // Path will use forward slash as delimiter on both Windows and Unix based systems.
      importPath = path.normalize(importPath).replace(/\\/g, '/');

      var src;

      switch (options.type) {
        case 'cjs':
          src = "var " + srcBaseName + " = require('./" + importPath + "').default;\n" +
            "module.exports = " + srcBaseName;
          break;

        case 'amd':
          src = "define(['./" + importPath + "'], function (" + srcBaseName + ") {\n" +
            "  return " + srcBaseName + ".default;\n" +
            "})";
          break;
      }

      // Write the destination file.
      grunt.file.write(f.dest, src);

      // Print a success message.
      grunt.log.writeln('File "' + f.dest + '" created.');
    });
  });

};
<commit_msg>Fix MSIE8 compatbility problem due to 'default' being a reserved word.<commit_after>/*
 * grunt-es6-module-wrap-default
 * https://github.com/stevoland/grunt-es6-module-wrap-default
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

var path = require('path');

module.exports = function (grunt) {

  grunt.registerMultiTask('es6_module_wrap_default', 'Wrap CommonJS and AMD modules created with es6-module-transpiler so that they can be required as as (\'name\') and not (\'name\').default', function() {
    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
      type: 'cjs'
    });

    if (options.type !== 'cjs' && options.type !== 'amd') {
      throw new Error('options.type must be cjs or amd');
    }

    // Iterate over all specified file groups.
    this.files.forEach(function (f) {
      // Concat specified files.
      f.src.forEach(function (filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      });


      var srcBaseName = path.basename(f.src[0], '.js');
      var srcDirname = path.dirname(f.src[0]);
      var destDirname = path.dirname(f.dest);

      var importPath = path.join(path.relative(destDirname, srcDirname), srcBaseName);

      // Path will use forward slash as delimiter on both Windows and Unix based systems.
      importPath = path.normalize(importPath).replace(/\\/g, '/');

      var src;

      switch (options.type) {
        case 'cjs':
          src = "var " + srcBaseName + " = require('./" + importPath + "')['default'];\n" +
            "module.exports = " + srcBaseName;
          break;

        case 'amd':
          src = "define(['./" + importPath + "'], function (" + srcBaseName + ") {\n" +
            "  return " + srcBaseName + "['default'];\n" +
            "})";
          break;
      }

      // Write the destination file.
      grunt.file.write(f.dest, src);

      // Print a success message.
      grunt.log.writeln('File "' + f.dest + '" created.');
    });
  });

};

{'fraction_non_alphanumeric': 0.15313694625590285, 'fraction_numerical': 0.004722284686305375, 'mean_word_length': 2.2997032640949553, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2115105', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1347, 'n_words': 360}