<commit_before># GeneralStore (for Flux)

It's descriptive *and* punny!

![general-store](https://git.hubteam.com/github-enterprise-assets/0000/0376/0000/7618/b4cf46ea-a7cb-11e4-86f3-fe5c5c53d10e.jpg)

### TODOs

- [x] make `StoreListenerMixin` simpler (e.g. lets not have `getStoreState` and the `stores` array)
- [ ] clean up the runtime type checks (easier to read + maintain the same execution flow in the minified build)
- [ ] readme and/or other docs

# Create a store

GeneralStore uses functions to encapsulate private data.

```javascript
function defineUserStore() {
  // data is stored privately inside the store module's closure
  var users = {<commit_msg>intro blurb<commit_after># GeneralStore (for Flux)

It's descriptive *and* punny!

![general-store](https://git.hubteam.com/github-enterprise-assets/0000/0376/0000/7618/b4cf46ea-a7cb-11e4-86f3-fe5c5c53d10e.jpg)

### TODOs

- [x] make `StoreListenerMixin` simpler (e.g. lets not have `getStoreState` and the `stores` array)
- [ ] clean up the runtime type checks (easier to read + maintain the same execution flow in the minified build)
- [ ] readme and/or other docs

GeneralStore aims to get at the essence of a Flux store without falling into an overly prescriptive data model. A store is a observable reference to a value, with an explicit set of mutations that are triggered by messages from an event emitter.

In other words a store:

* encapsulates an arbitrary value
* exposes that value to subscribers via a get method
* changes that value in response to certain events from the Dispatcher
* notifies subscribers when that value changes

Other features, like Immutability, data fetching, undo, etc., should be implementation details of their individual stores. We also didn’t want to write switch statements anymore… JavaScript switch statements are terrifying.

# Create a store

GeneralStore uses functions to encapsulate private data.

```javascript
function defineUserStore() {
  // data is stored privately inside the store module's closure
  var users = {
{'fraction_non_alphanumeric': 0.08051055473735887, 'fraction_numerical': 0.031418753068237604, 'mean_word_length': 4.6143250688705235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7497385', 'n_tokens_mistral': 644, 'n_tokens_neox': 580, 'n_words': 247}