Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jednano/bind-action-creators
Turns an object whose values are action creators, into an object with the same keys, but with every action creator wrapped into a dispatch call so they may be invoked directly.
https://github.com/jednano/bind-action-creators
actions dispatch react redux typescript
Last synced: about 1 month ago
JSON representation
Turns an object whose values are action creators, into an object with the same keys, but with every action creator wrapped into a dispatch call so they may be invoked directly.
- Host: GitHub
- URL: https://github.com/jednano/bind-action-creators
- Owner: jednano
- License: mit
- Created: 2019-12-10T17:07:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T13:34:52.000Z (about 2 years ago)
- Last Synced: 2024-12-14T19:20:38.486Z (about 1 month ago)
- Topics: actions, dispatch, react, redux, typescript
- Language: TypeScript
- Size: 1.95 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
- Contributing: contributing.md
- License: license
Awesome Lists containing this project
README
# bind-action-creators
[![GitHub Actions](https://github.com/jedmao/bind-action-creators/workflows/Node%20CI/badge.svg?event=push)](https://github.com/jedmao/bind-action-creators/actions)
[![codecov](https://img.shields.io/codecov/c/gh/jedmao/bind-action-creators?style=flat-square)](https://codecov.io/gh/jedmao/bind-action-creators)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/xojs/xo)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![types: TypeScript](https://img.shields.io/npm/types/typescript?style=flat-square)](https://typescriptlang.org)Turns an object whose values are action creators, into an object with the same
keys, but with every action creator wrapped into a dispatch call so they may be
invoked directly.## Installation
```bash
npm install bind-action-creators
```## Usage
```ts
import bindActionCreators = require('bind-action-creators')const actionCreators = {
fetchFoo: dispatch => Promise.resolve([]),
fetchBar: dispatch => Promise.resolve([]),
}const bound = bindActionCreators(actionCreators /*, dispatch */)
```## Scripts
The following [npm scripts](https://docs.npmjs.com/misc/scripts) are made
available to you in the project root. You can run each of them with
`npm run `.### build
Runs the [TypeScript][] compiler.
### test
Runs [AVA][] in
[watch mode](https://github.com/avajs/ava/blob/master/docs/recipes/watch-mode.md),
which attempts to run only on changed files.### cover
Runs [AVA][] with
[coverage](https://github.com/avajs/ava/blob/master/docs/recipes/code-coverage.md),
dumping coverage results in `./coverage` and showing a text summary in the
console output.### commit
Runs [Commitizen](http://commitizen.github.io/cz-cli/) commit wizard, ensuring
that your commit messages conform to
[Conventional Commits](https://www.conventionalcommits.org/).### Tips
Use the [`git commit`](https://git-scm.com/docs/git-commit) command directly
with the
[`-n`, `--no-verify` option](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--n)
to bypasses the pre-commit and commit-msg hooks.[ava]: https://github.com/avajs/ava
[typescript]: http://www.typescriptlang.org/