1.0.6 • Published 7 years ago
match-action v1.0.6
Match Action 
A switch case for actions.
Usage
Exposes a single match() function that —
- Accepts two arguments —
defaultandspec. defaultis a function that accepts theaction.valueand can return anything.specis an object where key isaction.typeand 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