<commit_before>'use strict';
var Promise = require('bluebird'),
  toArray = function (array) {
    var index = -1,
      length = array ? array.length : 0,
      result = Array(length);
    while (++index < length) {
      result[index] = array[index];
    }
    return result;
  },
  /**
   * Creates a client to talk to a server
   * @param target  the url where the server is
   * @param targetWindow  the window where the server is. if null, an iframe will be created
   * @returns {promise|*|Q.promise} a promise that will be resolved with the send(method, params) function
   * when the client has connected to the server
   */
    client = function (target, targetWindow) {
    var getTargetWindow,
      targetOrigin = target.match(/(.+\/\/[^\/]+)\/?/)[1],
      iframe,
      promises = [],
      count = 0,
      send = function (method) {
        var id = count++;
        return new Promise(function (resolve, reject) {
          promises[id] = {
            resolve: resolve,
            reject: reject
          };
          getTargetWindow().postMessage(JSON.stringify({id: id, postmessageClientServerMethod: method, args: toArray(arguments).slice(1)}),
            targetOrigin);<commit_msg>converted chrome build to webpack<commit_after>'use strict';
var Promise = require('bluebird'),
  toArray = function (array) {
    var index = -1,
      length = array ? array.length : 0,
      result = Array(length);
    while (++index < length) {
      result[index] = array[index];
    }
    return result;
  },
  /**
   * Creates a client to talk to a server
   * @param target  the url where the server is
   * @param targetWindow  the window where the server is. if null, an iframe will be created
   * @returns {promise|*|Q.promise} a promise that will be resolved with the send(method, params) function
   * when the client has connected to the server
   */
    client = function (target, targetWindow) {
    var getTargetWindow,
      targetOrigin = target.match(/(.+\/\/[^\/]+)\/?/)[1],
      iframe,
      promises = [],
      count = 0,
      send = function (method) {
        var id = count++,
          args = toArray(arguments).slice(1);
        return new Promise(function (resolve, reject) {
          promises[id] = {
            resolve: resolve,
            reject: reject
          };
          getTargetWindow().postMessage(JSON.stringify({id: id, postmessageClientServerMethod: method, args: args}),
            targetOrigin);
{'fraction_non_alphanumeric': 0.12372812372812372, 'fraction_numerical': 0.00407000407000407, 'mean_word_length': 2.481586402266289, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4058011', 'n_tokens_mistral': 700, 'n_tokens_neox': 687, 'n_words': 227}