8.0.0 • Published 5 years ago

@action-land/match v8.0.0

Weekly downloads
245
License
ISC
Repository
-
Last release
5 years ago

@action-land/match

A switch case for actions.

Installation

npm i @action-land/match

Usage

Exposes a single match() function that —

  1. Accepts two arguments — default and spec.
  2. default is a function that accepts the action and can return anything.
  3. spec is an object where key is action.type and value is a function.
  4. On a successful match of action.type the corresponding function is called with the action.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 11
8.0.0

5 years ago

7.0.1

5 years ago

7.0.0

5 years ago

6.0.0

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.4.1

5 years ago

4.3.0

5 years ago

4.1.0

5 years ago

4.0.1

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.7

6 years ago

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.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1-6

6 years ago

0.0.1-5

6 years ago