<commit_before>// Module dependencies
'use strict';
var debug = require('debug')('ruche');

/**
 * This function parse a `ruche.json`. Those files describes all the packages
 * available. By passing a `wanted` argument you choose the specifications of
 * the package you want.
 * @summary  Find the best package to install
 * @memberOf RucheUtil
 * @param    {object} wanted Package and spec you want. It's an object with
 *           at least one key `package`. Optionnals keys can be added:
 *           `version` and `platform`.
 * @param    {object} data The content of a `ruche.json` file.
 * @return   {object} Return the info of the best package.
 * @example
 * var rucheUtil = require('./lib/ruche/util');
 * var data = {}; // content of a ruche.json file
 * var match = rucheUtil.match({ package: 'curl' }, data);
 * @requires debug
 * @since    0.0.1
 * @license  [The MIT License (MIT)]{@link http://git.io/QMeU-w}
 */
var match = function match(wanted, data) {

  function calcVersion(item) {
    var calc = '';
    /*jshint unused:false */
    item.split('.').forEach(function (v, i, r) {
      var toFill = 5 - v.length;
      calc += new Array(toFill).join('0') + v;
    });
    return parseInt(calc);
  }

  var dataByVersion = data.sort(function (a, b) {
    return calcVersion(b.version) - calcVersion(a.version);
  });

  var platform;
  if (process.env.PROCESSOR_ARCHITECTURE === 'AMD64') {
    platform = 'win64';
  }
  platform = wanted.platform || platform || 'win32';

  var version = wanted.version || dataByVersion[0].version;
  console.log('search for v%s on %s', version, platform);

  var i;
  var c;
  var tmp = [];
  var len = dataByVersion.length;
  for (i = 0; i < len; i++) {
    c = dataByVersion[i];
    if (c.version === version && c.platform === platform) {
      tmp.push(c);
    }
  }
  if (tmp.length === 0) {
    tmp.push(dataByVersion[0]);
  }
  console.dir(tmp);
  debug('Match %s-%s-%s', c.package, c.version, c.platform);
  return tmp[0];
};<commit_msg>Noting to stdout in ruche<commit_after>// Module dependencies
'use strict';
var debug = require('debug')('ruche');

/**
 * This function parse a `ruche.json`. Those files describes all the packages
 * available. By passing a `wanted` argument you choose the specifications of
 * the package you want.
 * @summary  Find the best package to install
 * @memberOf RucheUtil
 * @param    {object} wanted Package and spec you want. It's an object with
 *           at least one key `package`. Optionnals keys can be added:
 *           `version` and `platform`.
 * @param    {object} data The content of a `ruche.json` file.
 * @return   {object} Return the info of the best package.
 * @example
 * var rucheUtil = require('./lib/ruche/util');
 * var data = {}; // content of a ruche.json file
 * var match = rucheUtil.match({ package: 'curl' }, data);
 * @requires debug
 * @since    0.0.1
 * @license  [The MIT License (MIT)]{@link http://git.io/QMeU-w}
 */
var match = function match(wanted, data) {

  function calcVersion(item) {
    var calc = '';
    /*jshint unused:false */
    item.split('.').forEach(function (v, i, r) {
      var toFill = 5 - v.length;
      calc += new Array(toFill).join('0') + v;
    });
    return parseInt(calc);
  }

  var dataByVersion = data.sort(function (a, b) {
    return calcVersion(b.version) - calcVersion(a.version);
  });

  var platform;
  if (process.env.PROCESSOR_ARCHITECTURE === 'AMD64') {
    platform = 'win64';
  }
  platform = wanted.platform || platform || 'win32';

  var version = wanted.version || dataByVersion[0].version;
  debug('search for v%s on %s', version, platform);

  var i;
  var c;
  var tmp = [];
  var len = dataByVersion.length;
  for (i = 0; i < len; i++) {
    c = dataByVersion[i];
    if (c.version === version && c.platform === platform) {
      tmp.push(c);
    }
  }
  if (tmp.length === 0) {
    tmp.push(dataByVersion[0]);
  }
  debug('Match %s-%s-%s', c.package, c.version, c.platform);
  return tmp[0];
};
{'fraction_non_alphanumeric': 0.15687751004016065, 'fraction_numerical': 0.008032128514056224, 'mean_word_length': 3.058044806517312, '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': '82063', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1304, 'n_words': 409}