<commit_before>'use strict';

import _ = require('lodash');

export function set<T>(object:T, f:(T) => void):T {
  var clone = _.clone(object);
  f(clone);
  return clone;
}

export function map<T>(array:T[], f:(T) => void):T[] {
  return array.map((v:T, i:number) => set(v, f));
}

export function applyDiff(text: string, diff: marcolix.SimpleDiff) {
  return text.slice(0, diff.deletionRange[0]) + diff.insertion + text.slice(diff.deletionRange[1]);
}<commit_msg>utils.set uses now Object.freeze(clone);<commit_after>'use strict';

import _ = require('lodash');

export function set<T>(object:T, f:(T) => void):T {
  var clone = _.clone(object);
  f(clone);
  Object.freeze(clone);
  return clone;
}

export function map<T>(array:T[], f:(T) => void):T[] {
  return array.map((v:T, i:number) => set(v, f));
}

export function applyDiff(text: string, diff: marcolix.SimpleDiff) {
  return text.slice(0, diff.deletionRange[0]) + diff.insertion + text.slice(diff.deletionRange[1]);
}
{'fraction_non_alphanumeric': 0.1967380224260958, 'fraction_numerical': 0.0061162079510703364, 'mean_word_length': 5.4605263157894735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '1626202', 'n_tokens_mistral': 369, 'n_tokens_neox': 359, 'n_words': 76}