Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 850bfb2
Showing
7 changed files
with
240 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"plugins": ["react"], | ||
"ecmaFeatures": { | ||
"jsx": true, | ||
"objectLiteralShorthandMethods": true | ||
}, | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true | ||
}, | ||
"rules": { | ||
"quotes": [0], | ||
"new-parens": [1], | ||
"no-alert": [1], | ||
"handle-callback-err": [1], | ||
"strict": [1], | ||
"no-script-url": [0], | ||
"space-unary-ops": [0], | ||
"consistent-return": [0], | ||
"comma-dangle": 1, | ||
"no-mixed-requires": [1], | ||
"no-underscore-dangle": [0], | ||
"no-multi-spaces": [1], | ||
"no-unused-vars": [1], | ||
"key-spacing": [0], | ||
"no-empty": [1], | ||
"no-shadow": [0], | ||
"no-use-before-define": [0], | ||
"no-unused-expressions": [1], | ||
"no-new-func": [0], | ||
"new-cap": [0], | ||
"eqeqeq": [0], | ||
"curly": [0], | ||
"strict": [0], | ||
"no-new": [1], | ||
"eol-last": [1], | ||
"space-infix-ops": [1], | ||
"no-return-assign": [1], | ||
"comma-spacing": [1], | ||
"no-extra-boolean-cast": [1], | ||
"no-constant-condition": [1], | ||
|
||
"react/display-name": 0, | ||
"react/jsx-boolean-value": 1, | ||
"react/jsx-no-duplicate-props": 1, | ||
"react/jsx-no-undef": 1, | ||
"react/jsx-quotes": 1, | ||
"react/jsx-sort-prop-types": 0, | ||
"react/jsx-sort-props": 0, | ||
"react/jsx-uses-react": 1, | ||
"react/jsx-uses-vars": 1, | ||
"react/no-danger": 1, | ||
"react/no-did-mount-set-state": 0, | ||
"react/no-did-update-set-state": 1, | ||
"react/no-multi-comp": 1, | ||
"react/no-unknown-property": 1, | ||
"react/prop-types": 0, | ||
"react/react-in-jsx-scope": 0, | ||
"react/require-extension": 1, | ||
"react/self-closing-comp": 1, | ||
"react/sort-comp": 1, | ||
"react/wrap-multilines": 1 | ||
}, | ||
"globals": { | ||
"describe": false, | ||
"chai": false, | ||
"beforeEach": false, | ||
"afterEach": false, | ||
"it": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
test/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Sen Yang | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
exports["redux-sequence-action"] = | ||
/******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
|
||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
|
||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
|
||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ }; | ||
|
||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
|
||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
|
||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
|
||
|
||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
|
||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
|
||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
|
||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ function(module, exports) { | ||
|
||
'use strict'; | ||
|
||
exports.__esModule = true; | ||
|
||
exports['default'] = function (_ref) { | ||
var dispatch = _ref.dispatch; | ||
var getState = _ref.getState; | ||
return function (next) { | ||
return function (action) { | ||
var steps = action.steps; | ||
|
||
if (!steps || !Array.isArray(steps) || steps.any(function (s) { | ||
return typeof s !== 'function'; | ||
})) { | ||
return next(action); | ||
} | ||
|
||
steps.reduce(function (result, currStep) { | ||
return result.then(function () { | ||
return Promise.resolve(currStep(dispatch, getState)); | ||
}); | ||
}, Promise.resolve()); | ||
}; | ||
}; | ||
}; | ||
|
||
module.exports = exports['default']; | ||
|
||
/***/ } | ||
/******/ ]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "redux-sequence-action", | ||
"version": "0.0.1", | ||
"description": "redux sequnence action middleware", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "npm run test", | ||
"watch": "./node_modules/.bin/webpack --config webpack.conf.js", | ||
"build": "NODE_ENV=production ./node_modules/.bin/webpack --config webpack.conf.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:jasonslyvia/redux-sequence-action.git" | ||
}, | ||
"keywords": [ | ||
"redux", | ||
"redux-middleware", | ||
"middleware", | ||
"flux" | ||
], | ||
"author": "jasonslyvia <jasonslyvia@gmail.com> (http://undefinedblog.com/)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/jasonslyvia/redux-sequence-action/issues" | ||
}, | ||
"homepage": "https://github.com/jasonslyvia/redux-sequence-action", | ||
"devDependencies": { | ||
"babel-core": "~5.8.25", | ||
"babel-loader": "~5.3.2", | ||
"react": "~0.14.0", | ||
"react-redux": "~4.0.0", | ||
"redux": "~3.0.2", | ||
"webpack": "~1.12.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default ({dispatch, getState}) => next => action => { | ||
const {steps} = action; | ||
|
||
if(!steps || !Array.isArray(steps) || steps.any(s => typeof s !== 'function')) { | ||
return next(action); | ||
} | ||
|
||
steps.reduce((result, currStep) => { | ||
return result.then(() => Promise.resolve(currStep(dispatch, getState))); | ||
}, Promise.resolve()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var isDebug = process.env.NODE_ENV !== 'production'; | ||
|
||
module.exports = { | ||
entry: './src/index.js', | ||
output: { | ||
path: __dirname + '/lib', | ||
filename: 'index.js', | ||
library: 'redux-sequence-action', | ||
libraryTarget: 'commonjs' | ||
}, | ||
module: { | ||
loaders: [{ | ||
test: /\.js$/, | ||
include: /src/, | ||
loader: 'babel?stage=0&loose=all' | ||
}] | ||
}, | ||
debug: isDebug, | ||
devtool: isDebug ? 'inline-source-map' : false, | ||
watch: isDebug | ||
}; |