<commit_before>'use strict';

var BackTrace = require('backtrace')
  , Failure = require('./failure')
  , pathval = require('pathval');

var toString = Object.prototype.toString
  , hasOwn = Object.prototype.hasOwnProperty;

/**
 * Get class information for a given type.
 *
 * @param {Mixed} of Type to check.
 * @returns {String} The name of the type.
 * @api private
 */
function type(of) {
  return toString.call(of).slice(8, -1).toLowerCase();
}

/**
 * Determine the size of a collection.
 *
 * @param {Mixed} collection The object we want to know the size of.
 * @returns {Number} The size of the collection.
 * @api private
 */
function size(collection) {
  var x, i = 0;

  if ('object' === type(collection)) {
    for (x in collection) {
      if (hasOwn.call(collection, x)) i++;
    }

    return i;
  }

  return +collection.length || 0;
}

/**
 * Iterate over each item in an array.
 *
 * @param {Array} arr Array to iterate over.
 * @param {Function} fn Callback for each item.
 * @private
 */
function each(arr, fn) {
  for (var i = 0, length = arr.length; i < length; i++) {
    fn(arr[i], i, arr);
  }
}

/**
 * Assert values.
 *
 * Flags:
 *
 * - **falsely**: Assert for a false instead of true.
 * - **deeply**:  Ensure a deep match of the given object.
 *
 * @constructor
 * @param {Mixed} value Value we need to assert.
 * @param {Object} flags Assertion flags.
 * @api public
 */
function Assert(value, flags) {
  if (!(this instanceof Assert)) return new Assert(value, flags);
  flags = flags || {};

  this.stacktrace = 'stacktrace' in flags ? flags.stacktrace : true;
  this.falsely = 'falsely' in flags ? flags.falsely : false;
  this.deeply = 'deeply' in flags ? flags.deeply : false;
  this.diff = 'diff' in flags ? flags.diff : true;
  this.value = value;

  Assert.assign(this)('to, be, been, is, and, has, have, with, that, at, of, same, does');
  Assert.alias(value, this);
}

/**
 * Assign values to a given thing.
 *
 * @param {Mixed} where Where do the new properties need to be assigned on.
 * @returns {Function}
 * @api public
 */
Assert.assign = function assign(where) {
  return function assigns(aliases, value) {
    if ('string' === typeof aliases) {
      if (~aliases.indexOf(',')) aliases = aliases.split(/[\s|\,]+/);
      else aliases = [aliases];
    }

    for (var i = 0, length = aliases.length; i < length; i++) {
      where[aliases[i]] = value || where;
    }

    return where;
  };
};<commit_msg>[fix] Follow chai.js configuration API for defaults.<commit_after>'use strict';

var BackTrace = require('backtrace')
  , Failure = require('./failure')
  , pathval = require('pathval');

var toString = Object.prototype.toString
  , hasOwn = Object.prototype.hasOwnProperty;

/**
 * Get class information for a given type.
 *
 * @param {Mixed} of Type to check.
 * @returns {String} The name of the type.
 * @api private
 */
function type(of) {
  return toString.call(of).slice(8, -1).toLowerCase();
}

/**
 * Determine the size of a collection.
 *
 * @param {Mixed} collection The object we want to know the size of.
 * @returns {Number} The size of the collection.
 * @api private
 */
function size(collection) {
  var x, i = 0;

  if ('object' === type(collection)) {
    for (x in collection) {
      if (hasOwn.call(collection, x)) i++;
    }

    return i;
  }

  return +collection.length || 0;
}

/**
 * Iterate over each item in an array.
 *
 * @param {Array} arr Array to iterate over.
 * @param {Function} fn Callback for each item.
 * @private
 */
function each(arr, fn) {
  for (var i = 0, length = arr.length; i < length; i++) {
    fn(arr[i], i, arr);
  }
}

/**
 * Assert values.
 *
 * Flags:
 *
 * - **falsely**: Assert for a false instead of true.
 * - **deeply**:  Ensure a deep match of the given object.
 * - **stacktrace**: Include stacktrace in the assertion.
 * - **diff**: Attempt to show the difference in object/values so we know why
 *   the assertion failed.
 *
 * @constructor
 * @param {Mixed} value Value we need to assert.
 * @param {Object} flags Assertion flags.
 * @api public
 */
function Assert(value, flags) {
  if (!(this instanceof Assert)) return new Assert(value, flags);
  flags = flags || {};

  this.stacktrace = 'stacktrace' in flags ? flags.stacktrace : Assert.config.includeStack;
  this.diff = 'diff' in flags ? flags.diff : Assert.config.showDiff;

  //
  // These flags are by the alias function so we can generate .not and .deep
  // properties which are basically new Assert instances with these flags set.
  //
  this.falsely = 'falsely' in flags ? flags.falsely : false;
  this.deeply = 'deeply' in flags ? flags.deeply : false;
  this.value = value;

  Assert.assign(this)('to, be, been, is, and, has, have, with, that, at, of, same, does');
  Assert.alias(value, this);
}

/**
 * Attempt to mimic the configuration API of chai.js so it's dead simple to
 * migrate from chai.js to assume.
 *
 * @type {Object}
 * @public
 */
Assert.config = {
  includeStack: true,     // mapped to `stacktrace` as default value.
  showDiff: true          // mapped to `diff` as default value.
};

/**
 * Assign values to a given thing.
 *
 * @param {Mixed} where Where do the new properties need to be assigned on.
 * @returns {Function}
 * @api public
 */
Assert.assign = function assign(where) {
  return function assigns(aliases, value) {
    if ('string' === typeof aliases) {
      if (~aliases.indexOf(',')) aliases = aliases.split(/[\s|\,]+/);
      else aliases = [aliases];
    }

    for (var i = 0, length = aliases.length; i < length; i++) {
      where[aliases[i]] = value || where;
    }

    return where;
  };
};
{'fraction_non_alphanumeric': 0.1495908929206688, 'fraction_numerical': 0.0021344717182497333, 'mean_word_length': 3.134558823529412, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1228882', 'n_tokens_mistral': 1833, 'n_tokens_neox': 1806, 'n_words': 634}