https://github.com/bufferapp/buffer-js-keywrapper
🎁 Wrap your Redux Actions in a nice namespace bow
https://github.com/bufferapp/buffer-js-keywrapper
javascript redux
Last synced: 3 months ago
JSON representation
🎁 Wrap your Redux Actions in a nice namespace bow
- Host: GitHub
- URL: https://github.com/bufferapp/buffer-js-keywrapper
- Owner: bufferapp
- Created: 2017-11-22T00:19:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-22T17:46:48.000Z (over 8 years ago)
- Last Synced: 2024-04-14T06:08:51.918Z (over 2 years ago)
- Topics: javascript, redux
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@bufferapp/keywrapper
- Size: 2.93 KB
- Stars: 0
- Watchers: 27
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @bufferapp/keywrapper
[](https://badge.fury.io/js/%40bufferapp%2Fkeywrapper) [](https://travis-ci.org/bufferapp/buffer-js-keywrapper)
A quick way to wrap your Redux actions in a namespace.
When dealing with larger Redux applications, this can help avoid generic
action names from causing side effects. This will return an object with
namespaced string constants given a string namespace and an Object or Array.
See usage examples below for more info.
## Install
```
npm install @bufferapp/keywrapper
```
## Usage
```js
import keyWrapper from '@bufferapp/keywrapper'
// Use an Object...
const actions = keyWrapper('QUEUE', {
POST_DELETE: 0,
POST_SHARE_NOW: 0
})
// ...or an Array
const otherActions = keyWrapper('QUEUE', [
'POST_DELETE',
'POST_SHARE_NOW'
])
console.log(actions)
/*
{
POST_DELETE: 'QUEUE__POST_DELETE',
POST_SHARE_NOW: 'QUEUE__POST_SHARE_NOW',
}
*/
```
## License
MIT