8.0.0 • Published 6 years ago
@action-land/match v8.0.0
@action-land/match
A switch case for actions.
Installation
npm i @action-land/matchUsage
Exposes a single match() function that —
- Accepts two arguments —
defaultandspec. defaultis a function that accepts theactionand can return anything.specis an object where key isaction.typeand value is a function.- On a successful match of
action.typethe corresponding function is called with theaction.value.
import {action} from '@action-land/core'
import {match} from '@action-land/match'
const fn = match(i => i, {
inc: i => i + 1,
dec: i => i - 1
})
fn(action('inc', 10)) // returns 118.0.0
6 years ago
7.0.1
6 years ago
7.0.0
6 years ago
6.0.0
6 years ago
5.1.0
6 years ago
5.0.0
6 years ago
4.4.1
6 years ago
4.3.0
6 years ago
4.1.0
6 years ago
4.0.1
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago
0.0.1-6
7 years ago
0.0.1-5
7 years ago