Skip to content

Commit f8d41b0

Browse files
committed
Initial implementation extracted from Redux
0 parents  commit f8d41b0

File tree

8 files changed

+79
-0
lines changed

8 files changed

+79
-0
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"stage": 0,
3+
"loose": "all"
4+
}

.eslintrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "eslint-config-airbnb",
3+
"env": {
4+
"mocha": true,
5+
"node": true
6+
},
7+
"globals": {
8+
"expect": true
9+
},
10+
"rules": {
11+
"padded-blocks": 0,
12+
"no-use-before-define": [2, "nofunc"],
13+
"no-unused-expressions": 0
14+
}
15+
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
coverage
3+
*.log
4+
lib

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
language: node_js
2+
node_js:
3+
- "iojs"

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
redux-thunk
2+
=============
3+
4+
Thunk [middleware](https://github.com/gaearon/redux/blob/master/docs/middleware.md) for Redux.
5+
6+
```js
7+
npm install --save redux-thunk
8+
```
9+
10+
## Usage
11+
12+
TODO
13+
14+
## License
15+
16+
MIT

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "redux-thunk",
3+
"version": "0.1.0",
4+
"description": "Thunk middleware for Redux.",
5+
"main": "lib/index.js",
6+
"scripts": {
7+
"prepublish": "rm -rf lib && babel src --out-dir lib"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/gaearon/redux-thunk.git"
12+
},
13+
"homepage": "https://github.com/gaearon/redux-thunk",
14+
"keywords": [
15+
"redux",
16+
"thunk",
17+
"middleware",
18+
"redux-middleware",
19+
"flux"
20+
],
21+
"author": "Dan Abramov <dan.abramov@me.com>",
22+
"license": "MIT",
23+
"devDependencies": {
24+
"babel": "^5.6.14",
25+
"babel-core": "^5.6.15",
26+
"babel-eslint": "^3.1.20",
27+
"eslint": "^0.24.0",
28+
"eslint-config-airbnb": "0.0.6"
29+
}
30+
}

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default function thunkMiddleware({ dispatch, getState }) {
2+
return next => action =>
3+
typeof action === 'function' ?
4+
action(dispatch, getState) :
5+
next(action);
6+
}

0 commit comments

Comments
 (0)