Skip to content

Commit

Permalink
Initial implementation extracted from Redux
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Jul 13, 2015
0 parents commit f8d41b0
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
@@ -0,0 +1,4 @@
{
"stage": 0,
"loose": "all"
}
15 changes: 15 additions & 0 deletions .eslintrc
@@ -0,0 +1,15 @@
{
"extends": "eslint-config-airbnb",
"env": {
"mocha": true,
"node": true
},
"globals": {
"expect": true
},
"rules": {
"padded-blocks": 0,
"no-use-before-define": [2, "nofunc"],
"no-unused-expressions": 0
}
}
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
node_modules
coverage
*.log
lib
1 change: 1 addition & 0 deletions .npmignore
@@ -0,0 +1 @@
src
3 changes: 3 additions & 0 deletions .travis.yml
@@ -0,0 +1,3 @@
language: node_js
node_js:
- "iojs"
16 changes: 16 additions & 0 deletions README.md
@@ -0,0 +1,16 @@
redux-thunk
=============

Thunk [middleware](https://github.com/gaearon/redux/blob/master/docs/middleware.md) for Redux.

```js
npm install --save redux-thunk
```

## Usage

TODO

## License

MIT
30 changes: 30 additions & 0 deletions package.json
@@ -0,0 +1,30 @@
{
"name": "redux-thunk",
"version": "0.1.0",
"description": "Thunk middleware for Redux.",
"main": "lib/index.js",
"scripts": {
"prepublish": "rm -rf lib && babel src --out-dir lib"
},
"repository": {
"type": "git",
"url": "https://github.com/gaearon/redux-thunk.git"
},
"homepage": "https://github.com/gaearon/redux-thunk",
"keywords": [
"redux",
"thunk",
"middleware",
"redux-middleware",
"flux"
],
"author": "Dan Abramov <dan.abramov@me.com>",
"license": "MIT",
"devDependencies": {
"babel": "^5.6.14",
"babel-core": "^5.6.15",
"babel-eslint": "^3.1.20",
"eslint": "^0.24.0",
"eslint-config-airbnb": "0.0.6"
}
}
6 changes: 6 additions & 0 deletions src/index.js
@@ -0,0 +1,6 @@
export default function thunkMiddleware({ dispatch, getState }) {
return next => action =>
typeof action === 'function' ?
action(dispatch, getState) :
next(action);
}

0 comments on commit f8d41b0

Please sign in to comment.