<commit_before>var rewritePattern = require("regexpu/rewrite-pattern");
var b              = require("acorn-ast-types").builders;
var _              = require("lodash");

exports.Literal = function (node) {
  var regex = node.regex;
  if (!regex) return;

  var flags = regex.flags.split("");
  if (!_.contains(regex.flags, "u")) return;
  _.pull(flags, "u");

  var pattern = rewritePattern(regex.pattern, regex.flags);
  return b.literal(new RegExp(pattern, flags.join("")));
};<commit_msg>modify regex object instead of creating a new literal<commit_after>var rewritePattern = require("regexpu/rewrite-pattern");
var b              = require("acorn-ast-types").builders;
var _              = require("lodash");

exports.Literal = function (node) {
  var regex = node.regex;
  if (!regex) return;

  var flags = regex.flags.split("");
  if (!_.contains(regex.flags, "u")) return;
  _.pull(flags, "u");

  regex.pattern = rewritePattern(regex.pattern, regex.flags);
};
{'fraction_non_alphanumeric': 0.16408668730650156, 'fraction_numerical': 0.0, 'mean_word_length': 3.731707317073171, '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': '2477589', 'n_tokens_mistral': 303, 'n_tokens_neox': 295, 'n_words': 71}