<commit_before>/**
 * plasma <https://github.com/jonschlinkert/plasma>
 *
 * Copyright (c) 2014 <NAME>, contributors.
 * Licensed under the MIT license.
 */

const file = require('fs-utils');
const expander = require('expander');
const log = require('verbalize');
const _ = require('lodash');

const plasma = module.exports = {};


function type(val) {
  return Object.prototype.toString.call(val).toLowerCase().replace(/\[object ([\S]+)\]/, '$1');
}

var detectPattern = function(str) {
  var re = /:([\S]+)/;
  if (re.test(str)) {
    return str.match(re)[1];
  }
};

var namespaceFiles = function(arr, obj) {
  var files = [];

  _.forEach(arr, function(filepath) {
    var pattern = file[detectPattern(obj.name)](filepath);
    files = files.concat({name: pattern, src: filepath});
  });

  return files;
};


/**
 * Convert a string to an object with `expand` and `src` properties
 *
 * @param   {String}  str  The string to convert
 * @return  {Object}
 *
 * @api public
 */
<commit_msg>toString var<commit_after>/**
 * plasma <https://github.com/jonschlinkert/plasma>
 *
 * Copyright (c) 2014 <NAME>, contributors.
 * Licensed under the MIT license.
 */

const file = require('fs-utils');
const expander = require('expander');
const log = require('verbalize');
const _ = require('lodash');

const plasma = module.exports = {};


var toString = Object.prototype.toString;

function type(val) {
  return toString.call(val).toLowerCase().replace(/\[object ([\S]+)\]/, '$1');
}

var detectPattern = function(str) {
  var re = /:([\S]+)/;
  if (re.test(str)) {
    return str.match(re)[1];
  }
};

var namespaceFiles = function(arr, obj) {
  var files = [];

  _.forEach(arr, function(filepath) {
    var pattern = file[detectPattern(obj.name)](filepath);
    files = files.concat({name: pattern, src: filepath});
  });

  return files;
};


/**
 * Convert a string to an object with `expand` and `src` properties
 *
 * @param   {String}  str  The string to convert
 * @return  {Object}
 *
 * @api public
 */

{'fraction_non_alphanumeric': 0.18199900546991546, 'fraction_numerical': 0.005967180507210343, 'mean_word_length': 3.7790973871733966, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2024835', 'n_tokens_mistral': 677, 'n_tokens_neox': 658, 'n_words': 170}