<commit_before>![Microcososm](http://f.cl.ly/items/36051G3A2M443z3v3U3b/microcososm.svg)
---

A variant of [Flux](https://facebook.github.io/flux/) with
central, isolated state.

[![Circle CI](https://circleci.com/gh/vigetlabs/microcosm.svg?style=svg)](https://circleci.com/gh/vigetlabs/microcosm)

---

## Table of Contents

1. [Documentation](docs)
2. [Overview](#overview)
3. [Opinions](#opinions)
4. [What is it trying to solve?](#what-is-it-trying-to-solve)

## Overview

Microcosm is a variant of [Flux](https://facebook.github.io/flux/)
that makes it easier to control and modify state in a pure,
centralized way. It thinks of stores and actions as stateless,
collections of pure functions, keeping all data encapsulated in one
place.

This design seeks to achieve a reasonable trade off between the
simplicity of singletons and the privacy of class instances.

### Actions

Actions are simple functions. They are called within the context of
Microcosm, taking the value they return and using it as the parameters
for processing within Stores.

```javascript
let addPlanet = function (params) {
  return params<commit_msg>Rewrite intro<commit_after>![Microcososm](http://f.cl.ly/items/36051G3A2M443z3v3U3b/microcososm.svg)
---

A variant of [Flux](https://facebook.github.io/flux/) with
central, isolated state.

[![Circle CI](https://circleci.com/gh/vigetlabs/microcosm.svg?style=svg)](https://circleci.com/gh/vigetlabs/microcosm)

---

## Table of Contents

1. [Documentation](docs)
2. [Overview](#overview)
3. [Opinions](#opinions)
4. [What is it trying to solve?](#what-is-it-trying-to-solve)

## Overview

Microcosm is a variant of [Flux](https://facebook.github.io/flux/)
that makes it easier to control and modify state in a pure,
centralized way. It thinks of stores and actions as stateless
collections of pure functions, keeping all data encapsulated in a
specific instance of Microcosm.

This design seeks to achieve a reasonable trade off between the
simplicity of singletons and the privacy of class instances.

### Actions

Actions are simple functions. They are called within the context of
Microcosm, taking the value they return and using it as the parameters
for processing within Stores.

```javascript
let addPlanet = function (params) {
  return params
{'fraction_non_alphanumeric': 0.10921052631578948, 'fraction_numerical': 0.014912280701754385, 'mean_word_length': 4.774683544303797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '1577142', 'n_tokens_mistral': 766, 'n_tokens_neox': 701, 'n_words': 247}