<commit_before>/*
 * grunt-svg2string
 * https://github.com/mistakster/grunt-svg2string
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

function injectFilename(str, filename) {
  return str
    .replace('%s', filename)
    .replace('%S', filename.toLocaleUpperCase())
}

module.exports = function (grunt) {

  grunt.registerMultiTask('svg2string', 'Transform a SVG file to a JavaScript string', function () {
    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
      lineLength: 100,
      splitByLines: true,
      removeSpaces: true,
      prefix: 'var SVG_%S = ',
      postfix: ';'
    });

    // Iterate over all specified file groups.
    this.files.forEach(function (f) {

      var src = f.src
        .filter(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;
          }
        })
        .map(function (filepath) {
          var content, l, svg = [];
          // Read file source.
          content = grunt.file.read(filepath);
          content = content.replace(/'/g, "\\'");
          if (options.removeSpaces) {
            content = content.replace(/>\s+</g, "><").trim();
          }
          if (options.splitByLines) {
            l = Math.ceil(content.length / LINE_LENGTH);
            for (i = 0; i < l; i++) {
              svg.push("'" + content.substr(i * LINE_LENGTH, LINE_LENGTH) + "'");
            }
          } else {<commit_msg>fix jshint warnings and errors<commit_after>/*
 * grunt-svg2string
 * https://github.com/mistakster/grunt-svg2string
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

function injectFilename(str, filename) {
  return str
    .replace('%s', filename)
    .replace('%S', filename.toLocaleUpperCase());
}

module.exports = function (grunt) {

  grunt.registerMultiTask('svg2string', 'Transform a SVG file to a JavaScript string', function () {
    // Merge task-specific and/or target-specific options with these defaults.
    var options = this.options({
      lineLength: 100,
      splitByLines: true,
      removeSpaces: true,
      prefix: 'var SVG_%S = ',
      postfix: ';'
    });

    // Iterate over all specified file groups.
    this.files.forEach(function (f) {

      var src = f.src
        .filter(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;
          }
        })
        .map(function (filepath) {
          var content, i, l, svg = [];
          // Read file source.
          content = grunt.file.read(filepath);
          content = content.replace(/'/g, "\\'");
          if (options.removeSpaces) {
            content = content.replace(/>\s+</g, "><").trim();
          }
          if (options.splitByLines) {
            l = Math.ceil(content.length / options.lineLength);
            for (i = 0; i < l; i++) {
              svg.push("'" + content.substr(i * options.lineLength, options.lineLength) + "'");
            }
          } else {
{'fraction_non_alphanumeric': 0.14298194525334887, 'fraction_numerical': 0.0064065230052417, 'mean_word_length': 2.026431718061674, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '5131940', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1017, 'n_words': 259}