create-fsa

1.0.3 • Public • Published

create-fsa

NPM version build status Test coverage Downloads js-standard-style

Create a flux-standard-action from a value.

Installation

$ npm install create-fsa

Usage

const createFsa = require('create-fsa')
 
const square('square', {
  payload: val => val * val,
  meta: val => { original: val },
  error: val => val >= 0
})
 
square(3)
// => {
// =>   type: 'square',
// =>   payload: 9,
// =>   meta: { original: 3 },
// =>   error: false
// => }

API

creator = createFsa(type, fns)

Create an action creator with a type. Takes an optional object of functions to create FSA properties (payload, meta, error). If no payload function is passed, the payload defaults to the passed in value.

fsa = creator(value)

Create a flux-standard-action from a value.

See Also

License

MIT

Package Sidebar

Install

npm i create-fsa

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • yoshuawuyts