1.0.0 • Published 4 years ago

bind-action-creators v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

bind-action-creators

GitHub Actions codecov Commitizen friendly XO code style code style: prettier types: TypeScript

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

npm install bind-action-creators

Usage

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 are made available to you in the project root. You can run each of them with npm run <script-name>.

build

Runs the TypeScript compiler.

test

Runs AVA in watch mode, which attempts to run only on changed files.

cover

Runs AVA with coverage, dumping coverage results in ./coverage and showing a text summary in the console output.

commit

Runs Commitizen commit wizard, ensuring that your commit messages conform to Conventional Commits.

Tips

Use the git commit command directly with the -n, --no-verify option to bypasses the pre-commit and commit-msg hooks.