Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including fsa-meta-extender with all npm packages installed. Try it out:

var fsaMetaExtender = require("fsa-meta-extender")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

fsa-meta-extender v0.0.3

fsa-meta-extender

Flux standard action meta extender.

NPM

Getting Started

Installation

$ npm install --save fsa-meta-extender

or

$ yarn add fsa-meta-extender

Usage

// meta/index.js

import metaExtenderCreator from 'fsa-meta-extender'

const extraMeta = {
  FOO: 'foo'
}

// second argument is meta property name.
export default metaExtenderCreator(extraMeta, 'extraMeta')
// actions/index.js

import mapExtraMeta from './meta'

const FOO = 'FOO'
const fooAction = arg => { type: FOO, payload: arg }
export default mapExtraMeta({ fooAction })

/*
actions.fooAction
=> FOO
actions.fooAction('hello')
=>
{
  type: FOO,
  payload: 'hello',
  meta: {
    extraMeta: 'foo'
  }
}
*/

or if you use redux-actions

import {createActions} from 'redux-actions'
import mapExtraMeta from './meta'

export default mapExtraMeta(createActions('FOO'))
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free