<commit_before>/*
 * grunt-minispade
 * https://github.com/stevekane/grunt-minispade
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {
  //used to parse filepaths for filenaming options
  var path = require('path');
    
  var formatMinispade = function(srcFile, options) {
    var ext = path.extname(srcFile);
    var fileName = path; 
    var contents;

    //OPTIONS HANDLING

    //remove unwanted prefix from minispade registers
    if (options.prefixToRemove !== "") {
      fileName = fileName.split(options.prefixToRemove)[1];
    }
    
    //only .js files may be minispadificated
    if (ext !== '.js') {
      grunt.log.error('minispade may only be run on .js files');
    } else {
      contents = grunt.file.read(srcFile);
      //minispade actually uses the syntax "minispade.require", renames if needed
      if (options.renameRequire === true) {
        contents = contents.replace(/\s*require\s*\(\s*/g, "minispade.require(");
        contents = contents.replace(/\s*requireAll\s*\(\s*/g, "minispade.requireAll("); 
      } 
      //insert 'use strict' inside the minispade register if needed<commit_msg>corrected use of path module in split<commit_after>/*
 * grunt-minispade
 * https://github.com/stevekane/grunt-minispade
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {
  //used to parse filepaths for filenaming options
  var path = require('path');
    
  var formatMinispade = function(srcFile, options) {
    var ext = path.extname(srcFile);
    var fileName = srcFile; 
    var contents;

    //OPTIONS HANDLING

    //remove unwanted prefix from minispade registers
    if (options.prefixToRemove !== "") {
      fileName = fileName.split(options.prefixToRemove)[1];
    }
    
    //only .js files may be minispadificated
    if (ext !== '.js') {
      grunt.log.error('minispade may only be run on .js files');
    } else {
      contents = grunt.file.read(srcFile);
      //minispade actually uses the syntax "minispade.require", renames if needed
      if (options.renameRequire === true) {
        contents = contents.replace(/\s*require\s*\(\s*/g, "minispade.require(");
        contents = contents.replace(/\s*requireAll\s*\(\s*/g, "minispade.requireAll("); 
      } 
      //insert 'use strict' inside the minispade register if needed
{'fraction_non_alphanumeric': 0.1341614906832298, 'fraction_numerical': 0.004140786749482402, 'mean_word_length': 2.9412724306688416, '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': '2440691', 'n_tokens_mistral': 766, 'n_tokens_neox': 749, 'n_words': 199}