# redux-reducer-generator

> [![Build Status](https://travis-ci.org/0xc14m1z/redux-reducer-generator.svg?branch=master)](https://travis-ci.org/0xc14m1z/redux-reducer-generator) [![Coverage Status](https://coveralls.io/repos/github/0xc14m1z/redux-reducer-generator/badge.svg?branch=mas

Latest version **1.0.1** (published 2018-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-reducer-generator
pnpm add redux-reducer-generator
yarn add redux-reducer-generator
bun add redux-reducer-generator
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-03-28 |
| First published | 2018-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 0xc14m1z |
| Maintainers | 0xc14m1z |

## Links

- npm: https://www.npmjs.com/package/redux-reducer-generator
- Repository: https://github.com/0xc14m1z/redux-reducer-generator
- Homepage: https://github.com/0xc14m1z/redux-reducer-generator#readme
- Issues: https://github.com/0xc14m1z/redux-reducer-generator/issues
- npm.io page: https://npm.io/package/redux-reducer-generator

## Recent versions

- 1.0.1 (latest) — 2018-03-28
- 1.0.0 — 2018-03-28
- 0.0.3 — 2018-02-28
- 0.0.2 — 2018-02-28
- 0.0.1 — 2018-02-27

## README

# redux-reducer-generator

[![Build Status](https://travis-ci.org/0xc14m1z/redux-reducer-generator.svg?branch=master)](https://travis-ci.org/0xc14m1z/redux-reducer-generator) [![Coverage Status](https://coveralls.io/repos/github/0xc14m1z/redux-reducer-generator/badge.svg?branch=master)](https://coveralls.io/github/0xc14m1z/redux-reducer-generator?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/71529a56fad691ed2c10/maintainability)](https://codeclimate.com/github/0xc14m1z/redux-reducer-generator/maintainability)

## how to install

```
$ npm install --save redux-reducer-generator
```

## how to use it

The goal of this package is to shorten and lean the switch statement for
redux reducers, replacing it with a map between action types and methods that
handles those actions.

```js

import reducer from "redux-reducer-generator"
// or var reducer = require("redux-reducer-generator")

const initialState = {
  loading: false,
  errors: false
}

const SHOW_LOADER = "SHOW_LOADER"
const HIDE_LOADER = "HIDE_LOADER"

const showLoader = (state, action) =>
  ({ ...state, loading: true })

const hideLoader = (state, action) =>
  ({ ...state, loading: false })

const map = {
  [SHOW_LOADER]: showLoader,
  [HIDE_LOADER]: hideLoader
}

const loadingReducer = reducer(initialState, map)

```

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