# action-processor

> Apply an ordered list of actions serially to an initial state and return the final state

Latest version **0.0.2** (published 2018-07-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install action-processor
pnpm add action-processor
yarn add action-processor
bun add action-processor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-07-21 |
| First published | 2018-07-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.7.0 |
| Dependencies | 1 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | luke.purton@gmail.com |
| Maintainers | lukepur |

## Links

- npm: https://www.npmjs.com/package/action-processor
- npm.io page: https://npm.io/package/action-processor

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.10

## Recent versions

- 0.0.2 (latest) — 2018-07-21
- 0.0.1 — 2018-07-21

## README

# action-processor
Simple utility to run a series of functions over an initial state and return the end state.

Supports async functions which will be waited upon before the next action, to ensure actions are completed sequentially.

Supports ignoring failed actions .

## Installation
```
npm i -S action-processor
```

## Usage
`action-processor` exposes a simple API:
```
const {run} = require('action-processor');

const result = run(initialState, actions, opts);
```
Where:
- `initialState` is any value. It will be passed as the only argument to the first item in `actions`.
- `actions` is an array of functions or async functions (or a mixture). Each function should take one argument: `previousState` and return the next state to pass to the next action function (or be returned in the case of the last action).
- `opts` is an object with the following settings:
  - `continueOnFailure` (default: `false`): If set to true, any action invocation which throws an error will be skipped, and the chain will continue as if that action were not included.

---
_Source: https://npm.io/package/action-processor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
