1.0.6 • Published 6 years ago

match-action v1.0.6

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

Match Action Build Status

A switch case for actions.

Usage

Exposes a single match() function that —

  1. Accepts two arguments — default and spec.
  2. default is a function that accepts the action.value and can return anything.
  3. spec is an object where key is action.type and value is a function.
import {action} from 'action-types'
import {match} from 'match-action'

const fn = match(i => i, {
  inc: i => i + 1,
  dec: i => i - 1
})

fn(action('inc', 10)) // returns 11
1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago