<commit_before>/**
 * @flow
 */

var StoreFacade = require('./StoreFacade.js');

var invariant = require('../invariant.js');

var HINT_LINK =
  'Learn more about defining fields with the StoreDependencyMixin:' +
  ' https://github.com/HubSpot/general-store#react';

type derefingFunction = (
  props: Object,
  state: Object,
  stores: Array<StoreFacade>
) => any;

type CompoundStoreDependency = {
  stores: Array<StoreFacade>;
  deref: derefingFunction;
};

type StoreDependencies = {
  [key:string]: StoreFacade | CompoundStoreDependency;
};

function defaultDeref(
  _,
  _,
  stores: Array<StoreFacade>
): any {
  return stores[0].get();
}

function extractDeref(
  dependencies: StoreDependencies,
  field: string
): derefingFunction {
  var dependency = dependencies[field];
  if (dependency instanceof StoreFacade) {
    return defaultDeref;
  }
  invariant(
    typeof dependency.deref === 'function',
    'StoreDependencyDefinition: the compound field "%s" does not have' +
    ' a `deref` function. Provide one, or make it a simple field instead. %s',
    field,
    HINT_LINK
  );
  return dependency.deref;
}

function extractStores(
  dependencies: StoreDependencies,
  field: string
): Array<StoreFacade> {
  var dependency = dependencies[field];
  if (dependency instanceof StoreFacade) {
    return [dependency];
  }
  invariant(
    Array.isArray(dependency.stores) && dependency.stores.length,
    'StoreDependencyDefinition: the `stores` property on the compound field' +
    ' "%s" must be an array of Stores with at least one Store. %s',
    HINT_LINK
  );
  return dependency.stores;
}

class StoreDependencyDefinition {
<commit_msg>missing arg in an invariant<commit_after>/**
 * @flow
 */

var StoreFacade = require('./StoreFacade.js');

var invariant = require('../invariant.js');

var HINT_LINK =
  'Learn more about defining fields with the StoreDependencyMixin:' +
  ' https://github.com/HubSpot/general-store#react';

type derefingFunction = (
  props: Object,
  state: Object,
  stores: Array<StoreFacade>
) => any;

type CompoundStoreDependency = {
  stores: Array<StoreFacade>;
  deref: derefingFunction;
};

type StoreDependencies = {
  [key:string]: StoreFacade | CompoundStoreDependency;
};

function defaultDeref(
  _,
  _,
  stores: Array<StoreFacade>
): any {
  return stores[0].get();
}

function extractDeref(
  dependencies: StoreDependencies,
  field: string
): derefingFunction {
  var dependency = dependencies[field];
  if (dependency instanceof StoreFacade) {
    return defaultDeref;
  }
  invariant(
    typeof dependency.deref === 'function',
    'StoreDependencyDefinition: the compound field "%s" does not have' +
    ' a `deref` function. Provide one, or make it a simple field instead. %s',
    field,
    HINT_LINK
  );
  return dependency.deref;
}

function extractStores(
  dependencies: StoreDependencies,
  field: string
): Array<StoreFacade> {
  var dependency = dependencies[field];
  if (dependency instanceof StoreFacade) {
    return [dependency];
  }
  invariant(
    Array.isArray(dependency.stores) && dependency.stores.length,
    'StoreDependencyDefinition: the `stores` property on the compound field' +
    ' "%s" must be an array of Stores with at least one Store. %s',
    field,
    HINT_LINK
  );
  return dependency.stores;
}

class StoreDependencyDefinition {

{'fraction_non_alphanumeric': 0.11417440815103386, 'fraction_numerical': 0.0005993407252022775, 'mean_word_length': 4.1671826625387, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2750587', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1008, 'n_words': 277}