<commit_before># redux-logic API

Contents:

 - [Installation](#installation)
 - [Main usage](#main-usage)
    - [createLogic](#createlogic)
    - [configureLogic](#configurelogic)
    - [createLogicMiddleware](#createlogicmiddleware)
 - [Execution phase hooks](#execution-phase-hooks---validate-transform-process)
    - [validate](#validate-hook)
    - [transform](#transform-hook)
    - [process](#process-hook)
 - [Advanced usage](#advanced-usage)

## Installation

redux-logic uses rxjs@5 under the covers and to prevent multiple copies (of different versions) from being installed, it is recommended to install rxjs first before redux-logic. That way you can use the same copy of rxjs elsewhere.

If you are never using rxjs outside of redux-logic and don't plan to use Observables directly in your logic then you can skip the rxjs install and it will be installed as a redux-logic dependency. However if you think you might use Observables directly in the future (possibly creating Observables in your logic), it is still recommended to install rxjs separately first
just to help ensure that only one copy will be in the project.

The rxjs install below `npm install rxjs@^5` installs the lastest 5.x.x version of rxjs.

```bash
npm install rxjs@^5 --save  # optional see note above
npm install redux-logic --save
```

## Main usage
### createLogic
```js
import { createLogic } from 'redux-logic';

/* returns a logic object that resembles the same structure of the
   input except that some defaults are applied and values were
   validated. You can directly access your hook functions from the
   object to perform isolated testing. Use the validate, transform,
   and process properties of the returned logic object */
const fooLogic = createLogic({
  // optional name - used in monitor$ and error messages, the default name assigned is L(TYPE)-N where TYPE is the action type(s) and N is the index in the logic array

  // filtering/canceling
  type: T, // required string, regex, array of str/regex, use '*' for all
  cancelType: CT, // string, regex, array of strings or regexes
  // type and cancelType also support redux-actions fns for which
  //   the fn.toString() returns the associated action type

  // limiting - optionally define any of these
  debounce: 0, // debounce for N ms, default 0
  throttle: 0, // throttle for N ms, default 0
  latest: true, // only take latest, default false

  // In non-production mode only, write to console.error if logic does
  // not complete by this time in milliseconds.
  // Set to `0` for non-ending logic.
  warnTimeout: 60000, // default: 60000 (one minute)

  // Put your business logic into one or more of these
  // execution phase hooks: validate, transform, process
  //<commit_msg>update docs type and cancelType can also be a Symbol<commit_after># redux-logic API

Contents:

 - [Installation](#installation)
 - [Main usage](#main-usage)
    - [createLogic](#createlogic)
    - [configureLogic](#configurelogic)
    - [createLogicMiddleware](#createlogicmiddleware)
 - [Execution phase hooks](#execution-phase-hooks---validate-transform-process)
    - [validate](#validate-hook)
    - [transform](#transform-hook)
    - [process](#process-hook)
 - [Advanced usage](#advanced-usage)

## Installation

redux-logic uses rxjs@5 under the covers and to prevent multiple copies (of different versions) from being installed, it is recommended to install rxjs first before redux-logic. That way you can use the same copy of rxjs elsewhere.

If you are never using rxjs outside of redux-logic and don't plan to use Observables directly in your logic then you can skip the rxjs install and it will be installed as a redux-logic dependency. However if you think you might use Observables directly in the future (possibly creating Observables in your logic), it is still recommended to install rxjs separately first
just to help ensure that only one copy will be in the project.

The rxjs install below `npm install rxjs@^5` installs the lastest 5.x.x version of rxjs.

```bash
npm install rxjs@^5 --save  # optional see note above
npm install redux-logic --save
```

## Main usage
### createLogic
```js
import { createLogic } from 'redux-logic';

/* returns a logic object that resembles the same structure of the
   input except that some defaults are applied and values were
   validated. You can directly access your hook functions from the
   object to perform isolated testing. Use the validate, transform,
   and process properties of the returned logic object */
const fooLogic = createLogic({
  // optional name - used in monitor$ and error messages, the default name assigned is L(TYPE)-N where TYPE is the action type(s) and N is the index in the logic array

  // filtering/canceling
  type: T, // required string, regex, Symbol, array of str/regex/Symbol, use '*' for all
  cancelType: CT, // string, regex, Symbol, array of str/regex/Symbol
  // type and cancelType also support redux-actions fns for which
  //   the fn.toString() returns the associated action type

  // limiting - optionally define any of these
  debounce: 0, // debounce for N ms, default 0
  throttle: 0, // throttle for N ms, default 0
  latest: true, // only take latest, default false

  // In non-production mode only, write to console.error if logic does
  // not complete by this time in milliseconds.
  // Set to `0` for non-ending logic.
  warnTimeout: 60000, // default: 60000 (one minute)

  // Put your business logic into one or more of these
  // execution phase hooks: validate, transform, process
  //
{'fraction_non_alphanumeric': 0.0829136690647482, 'fraction_numerical': 0.006834532374100719, 'mean_word_length': 3.7733905579399143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1293431', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1461, 'n_words': 723}