<commit_before>
const SVGO = require('svgo');

function optimizeSvg(svg, options = {}) {
  const plugins = [];
  if (options.noArcs) {
    plugins.push({
      convertPathData: {
        makeArcs: { threshold: 0, tolerance: 0 }
      }
    });
  }

  if(options.removeUnknowns) {
    plugins.push({removeUnknownsAndDefaults: false});
  }

  const svgo = new SVGO({plugins});

  return new Promise(function(resolve, reject) {
    try {
      svgo.optimize(svg, function(result) {
        if(result && result.data) resolve(result.data);
        else reject(new Error('svg optimizer failed'));
      });
    } catch(err) {
      reject(err);
    }
  });
}

module.exports = optimizeSvg;<commit_msg>added option to remove title in optimise svg<commit_after>
const SVGO = require('svgo');

function optimizeSvg(svg, options = {}) {
  const plugins = [];
  if (options.noArcs) {
    plugins.push({
      convertPathData: {
        makeArcs: { threshold: 0, tolerance: 0 }
      }
    });
  }

  if(options.removeUnknowns) {
    plugins.push({removeUnknownsAndDefaults: false});
  }

  if(options.removeTitle) {
    plugins.push({removeTitle: true});
  }

  const svgo = new SVGO({plugins});

  return new Promise(function(resolve, reject) {
    try {
      svgo.optimize(svg, function(result) {
        if(result && result.data) resolve(result.data);
        else reject(new Error('svg optimizer failed'));
      });
    } catch(err) {
      reject(err);
    }
  });
}

module.exports = optimizeSvg;
{'fraction_non_alphanumeric': 0.14735432016075017, 'fraction_numerical': 0.0026791694574681848, 'mean_word_length': 2.9523809523809526, 'pattern_counts': {'":': 0, '<': 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': '3594108', 'n_tokens_mistral': 493, 'n_tokens_neox': 476, 'n_words': 97}