<commit_before>Reducers frequently reason about the action.type, very often using a
switch statement to drive conditional logic:

```JavaScript
  export default function widget(widget=null, action) {

    switch (action.type) {

      case 'widget.edit':
        return action.widget;

      case 'widget.edit.close':
        return null;

      default:
        return widget;
    }
  }
```

The {@link reducerHash} function *(the most common composition
reducer)* provides a more elegant solution, eliminating the switch
statement altogether.  It creates a higher-order reducer, by combining
a set of sub-reducer functions that are indexed by the standard
action.type.

*The following snippet, is equivalent to the one above:*
```
  import { reducerHash } from 'astx-redux-util';

  const reduceWidget = reducerHash({
    "widget.edit":       (widget, action) => action.widget,
    "widget.edit.close": (widget, action) => null,
  });

  export default function widget(widget=null, action) {
    return reduceWidget(widget, action);
  }
```

Not only is the conditional logic better encapsulated, but the default
pass-through logic is automatically applied (using the [identity
function](https://lodash.com/docs#identity)), passing through the
original state when no action.type is acted on.


**Please Note** that because {@link reducerHash} is a higher-order
creator function, it is invoked outside the scope of the widget()
reducer.  This is an optimization, so as to not incur the creation
overhead on each reducer invocation.

**Also Note** that because {@link reducerHash} is so central to the
rudimentary aspects of reduction, it is common to provide a
value-added {@tutorial logExt}.
<commit_msg>minor indentation correction to examples<commit_after>Reducers frequently reason about the action.type, very often using a
switch statement to drive conditional logic:

```JavaScript
export default function widget(widget=null, action) {

  switch (action.type) {

    case 'widget.edit':
      return action.widget;

    case 'widget.edit.close':
      return null;

    default:
      return widget;
  }
}
```

The {@link reducerHash} function *(the most common composition
reducer)* provides a more elegant solution, eliminating the switch
statement altogether.  It creates a higher-order reducer, by combining
a set of sub-reducer functions that are indexed by the standard
action.type.

*The following snippet, is equivalent to the one above:*
```
import { reducerHash } from 'astx-redux-util';

const reduceWidget = reducerHash({
  "widget.edit":       (widget, action) => action.widget,
  "widget.edit.close": (widget, action) => null,
});

export default function widget(widget=null, action) {
  return reduceWidget(widget, action);
}
```

Not only is the conditional logic better encapsulated, but the default
pass-through logic is automatically applied (using the [identity
function](https://lodash.com/docs#identity)), passing through the
original state when no action.type is acted on.


**Please Note** that because {@link reducerHash} is a higher-order
creator function, it is invoked outside the scope of the widget()
reducer.  This is an optimization, so as to not incur the creation
overhead on each reducer invocation.

**Also Note** that because {@link reducerHash} is so central to the
rudimentary aspects of reduction, it is common to provide a
value-added {@tutorial logExt}.

{'fraction_non_alphanumeric': 0.08815750808110491, 'fraction_numerical': 0.0, 'mean_word_length': 4.2775193798449616, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 7, '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': '2336497', 'n_tokens_mistral': 928, 'n_tokens_neox': 880, 'n_words': 398}