<commit_before>var Immutable = require('immutable')
var logging = require('./logging')
var ChangeObserver = require('./change-observer')
var Getter = require('./getter')
var KeyPath = require('./key-path')
var Evaluator = require('./evaluator')
var createReactMixin = require('./create-react-mixin')

// helper fns
var toJS = require('./immutable-helpers').toJS
var isImmutableValue = require('./immutable-helpers').isImmutableValue
var each = require('./utils').each


/**
 * In Nuclear Reactors are where state is stored.  Reactors
 * contain a 'state' object which is an Immutable.Map
 *
 * The only way Reactors can change state is by reacting to
 * messages.  To update staet, Reactor's dispatch messages to
 * all registered cores, and the core returns it's new
 * state based on the message
 */
class Reactor {
  constructor(config) {
    if (!(this instanceof Reactor)) {
      return new Reactor(config)
    }
    config = config || {}

    this.debug = !!config.debug

    this.ReactMixin = createReactMixin(this)
    /**
     * The state for the whole cluster
     */
    this.__state = Immutable.Map({})
    /**
     * Holds a map of id => reactor instance
     */
    this.__stores = Immutable.Map({})

    this.__evaluator = new Evaluator()
    /**
     * Change observer interface to observe certain keypaths
     * Created after __initialize so it starts with initialState
     */
    this.__changeObserver = new ChangeObserver(this.__state, this.__evaluator)
  }<commit_msg>Fix typo in reactor class comment<commit_after>var Immutable = require('immutable')
var logging = require('./logging')
var ChangeObserver = require('./change-observer')
var Getter = require('./getter')
var KeyPath = require('./key-path')
var Evaluator = require('./evaluator')
var createReactMixin = require('./create-react-mixin')

// helper fns
var toJS = require('./immutable-helpers').toJS
var isImmutableValue = require('./immutable-helpers').isImmutableValue
var each = require('./utils').each


/**
 * In Nuclear Reactors are where state is stored.  Reactors
 * contain a 'state' object which is an Immutable.Map
 *
 * The only way Reactors can change state is by reacting to
 * messages.  To update state, Reactor's dispatch messages to
 * all registered cores, and the core returns it's new
 * state based on the message
 */
class Reactor {
  constructor(config) {
    if (!(this instanceof Reactor)) {
      return new Reactor(config)
    }
    config = config || {}

    this.debug = !!config.debug

    this.ReactMixin = createReactMixin(this)
    /**
     * The state for the whole cluster
     */
    this.__state = Immutable.Map({})
    /**
     * Holds a map of id => reactor instance
     */
    this.__stores = Immutable.Map({})

    this.__evaluator = new Evaluator()
    /**
     * Change observer interface to observe certain keypaths
     * Created after __initialize so it starts with initialState
     */
    this.__changeObserver = new ChangeObserver(this.__state, this.__evaluator)
  }
{'fraction_non_alphanumeric': 0.11792138574283811, 'fraction_numerical': 0.0, 'mean_word_length': 3.364825581395349, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1723408', 'n_tokens_mistral': 849, 'n_tokens_neox': 840, 'n_words': 279}