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

'use strict';

/**
 * Module dependencies
 */

var fs = require('fs');
var path = require('path');
var glob = require('globby');
var async = require('async');
var extend = require('extend-shallow');


/**
 * Return the content from a glob of files
 * using glob patterns.
 *
 * ```handlebars
 * {{glob 'files/*.md'}}
 * ```
 * @param {String} `patterns`
 * @param {Options} `opts`
 * @return {Object}
 */

module.exports = function(patterns, opts, cb) {
  if (typeof opts === 'function') {
    cb = opts;
    opts = {};
  }

  opts = extend({}, {mode: 'object'}, opts);

  glob(patterns, opts, function(err, files) {
    if (err) return cb(err);
    cb(null, files);
  });
};


/**
 * Return the content from a glob of files
 * using glob patterns.
 *
 * ```handlebars
 * {{glob 'files/*.md'}}
 * ```
 * @param {String} `patterns`
 * @param {Options} `opts`
 * @return {String}
 */

module.exports.sync = function(patterns, opts) {
  return glob.sync(patterns, opts);
};<commit_msg>adds async and sync helpers<commit_after>/*!
 * helper-glob <https://github.com/jonschlinkert/helper-glob>
 *
 * Copyright (c) 2014 <NAME>, contributors.
 * Licensed under the MIT license.
 */

'use strict';

/**
 * Module dependencies
 */

var path = require('path');
var globby = require('globby');
var extend = require('extend-shallow');


/**
 * Expose `glob` helpers
 */

module.exports = glob;

/**
 * Return the content from a glob of files
 * using glob patterns.
 *
 * @param {String} `patterns`
 * @param {Options} `opts`
 * @return {Object}
 * @api public
 */

function glob(patterns, opts, cb) {
  if (typeof opts === 'function') {
    cb = opts; opts = {};
  }
  opts = extend({}, typeof patterns === 'object' ? patterns : {}, opts);
  if (this && this.app) {
    opts = extend({}, this.context, this.app.options, opts);
  }
  if (opts && opts.hash) {
    extend(opts, opts.hash);
  }
  globby(patterns, opts, function(err, files) {
    if (err) return cb(err);
    cb(null, files.map(cwd(opts)));
  });
}

/**
 * Return the content from a glob of files
 * using glob patterns.
 *
 * @param {String} `patterns`
 * @param {Options} `opts`
 * @return {String}
 */

glob.sync = function(patterns, opts) {
  opts = extend({}, typeof patterns === 'object' ? patterns : {}, opts);
  if (this && this.app) {
    opts = extend({}, this.context, this.app.options, opts);
  }
  if (opts && opts.hash) {
    extend(opts, opts.hash);
  }
  return globby.sync(patterns, opts).map(cwd(opts));
};

/**
 * Make file paths relative to process.cwd()
 */

function cwd(opts) {
  return function (fp) {
    if (!opts.cwd) return fp;
    return path.join(opts.cwd, fp)
      .replace(/\\/g, '/');
  };
}
{'fraction_non_alphanumeric': 0.19121265377855887, 'fraction_numerical': 0.00281195079086116, 'mean_word_length': 3.3384146341463414, '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': '269489', 'n_tokens_mistral': 978, 'n_tokens_neox': 968, 'n_words': 269}