Comparing version 1.0.1 to 2.0.0
@@ -6,2 +6,10 @@ # Change log | ||
## [2.0.0](https://github.com/rackt/redux/compare/v1.0.1...v2.0.0) - 2015/09/01 | ||
### Breaking Changes | ||
* Removes `getReducer()` from the Store public API ([#668](https://github.com/rackt/redux/issues/668)) | ||
* Fixes `compose()` to act like a normal `compose()` ([#669](https://github.com/rackt/redux/issues/669)) | ||
* Relies on `process.env.NODE_ENV` being polyfilled ([#671](https://github.com/rackt/redux/issues/671)) | ||
## [1.0.1](https://github.com/rackt/redux/compare/v1.0.0...v1.0.1) - 2015/08/15 | ||
@@ -8,0 +16,0 @@ |
@@ -5,3 +5,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
else if(typeof define === 'function' && define.amd) | ||
define(factory); | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
@@ -219,14 +219,2 @@ exports["Redux"] = factory(); | ||
/** | ||
* Returns the reducer currently used by the store to calculate the state. | ||
* | ||
* It is likely that you will only need this function if you implement a hot | ||
* reloading mechanism for Redux. | ||
* | ||
* @returns {Function} The reducer used by the current store. | ||
*/ | ||
function getReducer() { | ||
return currentReducer; | ||
} | ||
/** | ||
* Replaces the reducer currently used by the store to calculate the state. | ||
@@ -255,3 +243,2 @@ * | ||
getState: getState, | ||
getReducer: getReducer, | ||
replaceReducer: replaceReducer | ||
@@ -266,8 +253,7 @@ }; | ||
/** | ||
* Composes functions from left to right. | ||
* Composes single-argument functions from right to left. | ||
* | ||
* @param {...Function} funcs - The functions to compose. Each is expected to | ||
* accept a function as an argument and to return a function. | ||
* @returns {Function} A function obtained by composing functions from left to | ||
* right. | ||
* @param {...Function} funcs The functions to compose. | ||
* @returns {Function} A function obtained by composing functions from right to | ||
* left. For example, compose(f, g, h) is identical to x => h(g(f(x))). | ||
*/ | ||
@@ -284,5 +270,7 @@ "use strict"; | ||
return funcs.reduceRight(function (composed, f) { | ||
return f(composed); | ||
}); | ||
return function (arg) { | ||
return funcs.reduceRight(function (composed, f) { | ||
return f(composed); | ||
}, arg); | ||
}; | ||
} | ||
@@ -335,3 +323,3 @@ | ||
* @param {Object} obj The source object. | ||
* @param {Function} fn The mapper function taht receives the value and the key. | ||
* @param {Function} fn The mapper function that receives the value and the key. | ||
* @returns {Object} A new object that contains the mapped values for the keys. | ||
@@ -408,3 +396,3 @@ */ | ||
}); | ||
_dispatch = _compose2['default'].apply(undefined, chain.concat([store.dispatch])); | ||
_dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch); | ||
@@ -469,2 +457,3 @@ return _extends({}, store, { | ||
if (typeof actionCreators !== 'object' || actionCreators == null) { | ||
// eslint-disable-line no-eq-null | ||
throw new Error('bindActionCreators expected an object or a function, instead received ' + typeof actionCreators + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?'); | ||
@@ -484,3 +473,3 @@ } | ||
/* WEBPACK VAR INJECTION */(function(process) {'use strict'; | ||
'use strict'; | ||
@@ -506,2 +495,4 @@ exports.__esModule = true; | ||
/* eslint-disable no-console */ | ||
function getErrorMessage(key, action) { | ||
@@ -586,8 +577,3 @@ var actionType = action && action.type; | ||
if ( | ||
// Node-like CommonJS environments (Browserify, Webpack) | ||
typeof process !== 'undefined' && typeof process.env !== 'undefined' && ("development") !== 'production' || | ||
// React Native | ||
typeof __DEV__ !== 'undefined' && __DEV__ //eslint-disable-line no-undef | ||
) { | ||
if (true) { | ||
if (!stateShapeVerified) { | ||
@@ -604,3 +590,2 @@ verifyStateShape(state, finalState); | ||
module.exports = exports['default']; | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9))) | ||
@@ -634,98 +619,2 @@ /***/ }, | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports) { | ||
// shim for using process in browser | ||
var process = module.exports = {}; | ||
var queue = []; | ||
var draining = false; | ||
var currentQueue; | ||
var queueIndex = -1; | ||
function cleanUpNextTick() { | ||
draining = false; | ||
if (currentQueue.length) { | ||
queue = currentQueue.concat(queue); | ||
} else { | ||
queueIndex = -1; | ||
} | ||
if (queue.length) { | ||
drainQueue(); | ||
} | ||
} | ||
function drainQueue() { | ||
if (draining) { | ||
return; | ||
} | ||
var timeout = setTimeout(cleanUpNextTick); | ||
draining = true; | ||
var len = queue.length; | ||
while(len) { | ||
currentQueue = queue; | ||
queue = []; | ||
while (++queueIndex < len) { | ||
currentQueue[queueIndex].run(); | ||
} | ||
queueIndex = -1; | ||
len = queue.length; | ||
} | ||
currentQueue = null; | ||
draining = false; | ||
clearTimeout(timeout); | ||
} | ||
process.nextTick = function (fun) { | ||
var args = new Array(arguments.length - 1); | ||
if (arguments.length > 1) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
args[i - 1] = arguments[i]; | ||
} | ||
} | ||
queue.push(new Item(fun, args)); | ||
if (queue.length === 1 && !draining) { | ||
setTimeout(drainQueue, 0); | ||
} | ||
}; | ||
// v8 likes predictible objects | ||
function Item(fun, array) { | ||
this.fun = fun; | ||
this.array = array; | ||
} | ||
Item.prototype.run = function () { | ||
this.fun.apply(null, this.array); | ||
}; | ||
process.title = 'browser'; | ||
process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
process.version = ''; // empty string to avoid regexp issues | ||
process.versions = {}; | ||
function noop() {} | ||
process.on = noop; | ||
process.addListener = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.removeListener = noop; | ||
process.removeAllListeners = noop; | ||
process.emit = noop; | ||
process.binding = function (name) { | ||
throw new Error('process.binding is not supported'); | ||
}; | ||
// TODO(shtylman) | ||
process.cwd = function () { return '/' }; | ||
process.chdir = function (dir) { | ||
throw new Error('process.chdir is not supported'); | ||
}; | ||
process.umask = function() { return 0; }; | ||
/***/ } | ||
@@ -732,0 +621,0 @@ /******/ ]) |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):"object"==typeof exports?exports.Redux=t():e.Redux=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(1),u=r(o),i=n(7),a=r(i),c=n(6),f=r(c),s=n(5),d=r(s),l=n(2),p=r(l);t.createStore=u.default,t.combineReducers=a.default,t.bindActionCreators=f.default,t.applyMiddleware=d.default,t.compose=p.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){function n(){return s}function r(e){return d.push(e),function(){var t=d.indexOf(e);d.splice(t,1)}}function o(e){if(!i.default(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,s=f(s,e)}finally{l=!1}return d.slice().forEach(function(e){return e()}),e}function u(){return f}function c(e){f=e,o({type:a.INIT})}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var f=e,s=t,d=[],l=!1;return o({type:a.INIT}),{dispatch:o,subscribe:r,getState:n,getReducer:u,replaceReducer:c}}t.__esModule=!0,t.default=o;var u=n(3),i=r(u),a={INIT:"@@redux/INIT"};t.ActionTypes=a},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return t.reduceRight(function(e,t){return t(e)})}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t){"use strict";function n(e){if(!e||"object"!=typeof e)return!1;var t="function"==typeof e.constructor?Object.getPrototypeOf(e):Object.prototype;if(null===t)return!0;var n=t.constructor;return"function"==typeof n&&n instanceof n&&r(n)===r(Object)}t.__esModule=!0,t.default=n;var r=function(e){return Function.prototype.toString.call(e)};e.exports=t.default},function(e,t){"use strict";function n(e,t){return Object.keys(e).reduce(function(n,r){return n[r]=t(e[r],r),n},{})}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(e){return function(n,r){var o=e(n,r),i=o.dispatch,c=[],f={getState:o.getState,dispatch:function(e){return i(e)}};return c=t.map(function(e){return e(f)}),i=a.default.apply(void 0,c.concat([o.dispatch])),u({},o,{dispatch:i})}}}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=o;var i=n(2),a=r(i);e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return function(){return t(e.apply(void 0,arguments))}}function u(e,t){if("function"==typeof e)return o(e,t);if("object"!=typeof e||null==e)throw new Error("bindActionCreators expected an object or a function, instead received "+typeof e+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');return a.default(e,function(e){return o(e,t)})}t.__esModule=!0,t.default=u;var i=n(4),a=r(i);e.exports=t.default},function(e,t,n){(function(r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){var n=t&&t.type,r=n&&'"'+n.toString()+'"'||"an action";return'Reducer "'+e+'" returned undefined handling '+r+". To ignore an action, you must explicitly return the previous state."}function i(e,t){var n=Object.keys(t);if(0===n.length)return void console.error("Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.");if(!s.default(e))return void console.error('initialState has unexpected type of "'+{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1]+'". Expected initialState to be an object with the following '+('keys: "'+n.join('", "')+'"'));var r=Object.keys(e).filter(function(e){return n.indexOf(e)<0});r.length>0&&console.error("Unexpected "+(r.length>1?"keys":"key")+" "+('"'+r.join('", "')+'" in initialState will be ignored. ')+('Expected to find one of the known reducer keys instead: "'+n.join('", "')+'"'))}function a(e){var t=h.default(e,function(e){return"function"==typeof e});Object.keys(t).forEach(function(e){var n=t[e];if("undefined"==typeof n(void 0,{type:c.ActionTypes.INIT}))throw new Error('Reducer "'+e+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var r=Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof n(void 0,{type:r}))throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+c.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.")});var n,o=l.default(t,function(){return void 0});return function(e,a){void 0===e&&(e=o);var c=l.default(t,function(t,n){var r=t(e[n],a);if("undefined"==typeof r)throw new Error(u(n,a));return r});return"undefined"!=typeof r&&"undefined"!=typeof r.env,(!1||"undefined"!=typeof __DEV__&&__DEV__)&&(n||(i(e,c),n=!0)),c}}t.__esModule=!0,t.default=a;var c=n(1),f=n(3),s=o(f),d=n(4),l=o(d),p=n(8),h=o(p);e.exports=t.default}).call(t,n(9))},function(e,t){"use strict";function n(e,t){return Object.keys(e).reduce(function(n,r){return t(e[r])&&(n[r]=e[r]),n},{})}t.__esModule=!0,t.default=n,e.exports=t.default},function(e,t){function n(){f=!1,i.length?c=i.concat(c):s=-1,c.length&&r()}function r(){if(!f){var e=setTimeout(n);f=!0;for(var t=c.length;t;){for(i=c,c=[];++s<t;)i[s].run();s=-1,t=c.length}i=null,f=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function u(){}var i,a=e.exports={},c=[],f=!1,s=-1;a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new o(e,t)),1!==c.length||f||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=u,a.addListener=u,a.once=u,a.off=u,a.removeListener=u,a.removeAllListeners=u,a.emit=u,a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Redux=e():t.Redux=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var u=n[r]={exports:{},id:r,loaded:!1};return t[r].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=n(1),o=r(u),i=n(7),a=r(i),c=n(6),f=r(c),d=n(5),s=r(d),l=n(2),p=r(l);e.createStore=o.default,e.combineReducers=a.default,e.bindActionCreators=f.default,e.applyMiddleware=s.default,e.compose=p.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){function n(){return f}function r(t){return d.push(t),function(){var e=d.indexOf(t);d.splice(e,1)}}function u(t){if(!i.default(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(s)throw new Error("Reducers may not dispatch actions.");try{s=!0,f=c(f,t)}finally{s=!1}return d.slice().forEach(function(t){return t()}),t}function o(t){c=t,u({type:a.INIT})}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var c=t,f=e,d=[],s=!1;return u({type:a.INIT}),{dispatch:u,subscribe:r,getState:n,replaceReducer:o}}e.__esModule=!0,e.default=u;var o=n(3),i=r(o),a={INIT:"@@redux/INIT"};e.ActionTypes=a},function(t,e){"use strict";function n(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return function(t){return e.reduceRight(function(t,e){return e(t)},t)}}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var n=e.constructor;return"function"==typeof n&&n instanceof n&&r(n)===r(Object)}e.__esModule=!0,e.default=n;var r=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,r){return n[r]=e(t[r],r),n},{})}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function u(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return function(t){return function(n,r){var u=t(n,r),i=u.dispatch,c=[],f={getState:u.getState,dispatch:function(t){return i(t)}};return c=e.map(function(t){return t(f)}),i=a.default.apply(void 0,c)(u.dispatch),o({},u,{dispatch:i})}}}e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=u;var i=n(2),a=r(i);t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){return function(){return e(t.apply(void 0,arguments))}}function o(t,e){if("function"==typeof t)return u(t,e);if("object"!=typeof t||null==t)throw new Error("bindActionCreators expected an object or a function, instead received "+typeof t+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');return a.default(t,function(t){return u(t,e)})}e.__esModule=!0,e.default=o;var i=n(4),a=r(i);t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var n=e&&e.type,r=n&&'"'+n.toString()+'"'||"an action";return'Reducer "'+t+'" returned undefined handling '+r+". To ignore an action, you must explicitly return the previous state."}function o(t){var e=s.default(t,function(t){return"function"==typeof t});Object.keys(e).forEach(function(t){var n=e[t];if("undefined"==typeof n(void 0,{type:i.ActionTypes.INIT}))throw new Error('Reducer "'+t+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var r=Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof n(void 0,{type:r}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+i.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.")});var n=f.default(e,function(){return void 0});return function(t,r){void 0===t&&(t=n);var o=f.default(e,function(e,n){var o=e(t[n],r);if("undefined"==typeof o)throw new Error(u(n,r));return o});return o}}e.__esModule=!0,e.default=o;var i=n(1),a=n(3),c=(r(a),n(4)),f=r(c),d=n(8),s=r(d);t.exports=e.default},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,r){return e(t[r])&&(n[r]=t[r]),n},{})}e.__esModule=!0,e.default=n,t.exports=e.default}])}); |
@@ -126,14 +126,2 @@ 'use strict'; | ||
/** | ||
* Returns the reducer currently used by the store to calculate the state. | ||
* | ||
* It is likely that you will only need this function if you implement a hot | ||
* reloading mechanism for Redux. | ||
* | ||
* @returns {Function} The reducer used by the current store. | ||
*/ | ||
function getReducer() { | ||
return currentReducer; | ||
} | ||
/** | ||
* Replaces the reducer currently used by the store to calculate the state. | ||
@@ -162,5 +150,4 @@ * | ||
getState: getState, | ||
getReducer: getReducer, | ||
replaceReducer: replaceReducer | ||
}; | ||
} |
@@ -52,3 +52,3 @@ 'use strict'; | ||
}); | ||
_dispatch = _compose2['default'].apply(undefined, chain.concat([store.dispatch])); | ||
_dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch); | ||
@@ -55,0 +55,0 @@ return _extends({}, store, { |
@@ -46,2 +46,3 @@ 'use strict'; | ||
if (typeof actionCreators !== 'object' || actionCreators == null) { | ||
// eslint-disable-line no-eq-null | ||
throw new Error('bindActionCreators expected an object or a function, instead received ' + typeof actionCreators + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?'); | ||
@@ -48,0 +49,0 @@ } |
@@ -22,2 +22,4 @@ 'use strict'; | ||
/* eslint-disable no-console */ | ||
function getErrorMessage(key, action) { | ||
@@ -102,8 +104,3 @@ var actionType = action && action.type; | ||
if ( | ||
// Node-like CommonJS environments (Browserify, Webpack) | ||
typeof process !== 'undefined' && typeof process.env !== 'undefined' && process.env.NODE_ENV !== 'production' || | ||
// React Native | ||
typeof __DEV__ !== 'undefined' && __DEV__ //eslint-disable-line no-undef | ||
) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (!stateShapeVerified) { | ||
@@ -110,0 +107,0 @@ verifyStateShape(state, finalState); |
/** | ||
* Composes functions from left to right. | ||
* Composes single-argument functions from right to left. | ||
* | ||
* @param {...Function} funcs - The functions to compose. Each is expected to | ||
* accept a function as an argument and to return a function. | ||
* @returns {Function} A function obtained by composing functions from left to | ||
* right. | ||
* @param {...Function} funcs The functions to compose. | ||
* @returns {Function} A function obtained by composing functions from right to | ||
* left. For example, compose(f, g, h) is identical to x => h(g(f(x))). | ||
*/ | ||
@@ -19,7 +18,9 @@ "use strict"; | ||
return funcs.reduceRight(function (composed, f) { | ||
return f(composed); | ||
}); | ||
return function (arg) { | ||
return funcs.reduceRight(function (composed, f) { | ||
return f(composed); | ||
}, arg); | ||
}; | ||
} | ||
module.exports = exports["default"]; |
@@ -5,3 +5,3 @@ /** | ||
* @param {Object} obj The source object. | ||
* @param {Function} fn The mapper function taht receives the value and the key. | ||
* @param {Function} fn The mapper function that receives the value and the key. | ||
* @returns {Object} A new object that contains the mapped values for the keys. | ||
@@ -8,0 +8,0 @@ */ |
{ | ||
"name": "redux", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Predictable state container for JavaScript apps", | ||
@@ -34,13 +34,13 @@ "main": "lib/index.js", | ||
"keywords": [ | ||
"flux", | ||
"redux", | ||
"reducer", | ||
"react", | ||
"reactjs", | ||
"state", | ||
"predictable", | ||
"functional", | ||
"immutable", | ||
"hot", | ||
"reload", | ||
"hmr", | ||
"live", | ||
"edit", | ||
"webpack" | ||
"replay", | ||
"flux", | ||
"elm" | ||
], | ||
@@ -56,8 +56,8 @@ "author": "Dan Abramov <dan.abramov@me.com> (http://github.com/gaearon)", | ||
"babel-core": "^5.6.18", | ||
"babel-eslint": "^3.1.15", | ||
"babel-eslint": "^4.1.0", | ||
"babel-loader": "^5.1.4", | ||
"contextify": "^0.1.14", | ||
"eslint": "^0.23", | ||
"eslint-config-airbnb": "0.0.6", | ||
"eslint-plugin-react": "^2.3.0", | ||
"eslint": "^1.2.1", | ||
"eslint-config-airbnb": "0.0.8", | ||
"eslint-plugin-react": "^3.2.3", | ||
"expect": "^1.8.0", | ||
@@ -64,0 +64,0 @@ "gitbook-cli": "^0.3.4", |
@@ -33,4 +33,4 @@ # [Redux](http://rackt.github.io/redux) | ||
Redux evolves the ideas of [Flux](https://facebook.github.io/flux), but avoids its complexity by taking cues from [Elm](http://elm-lang.org/guide/architecture). | ||
Whether you used them or not, Redux takes a few minutes to get started with. | ||
Redux evolves the ideas of [Flux](https://facebook.github.io/flux), but avoids its complexity by taking cues from [Elm](https://github.com/evancz/elm-architecture-tutorial/). | ||
Whether you have used them or not, Redux takes a few minutes to get started with. | ||
@@ -52,2 +52,6 @@ ### Installation | ||
This assumes that you’re using [npm](http://npmjs.com/) package manager with a module bundler like [Webpack](http://webpack.github.io) or [Browserify](http://browserify.org/) to consume [CommonJS modules](http://webpack.github.io/docs/commonjs.html). | ||
If you don’t yet use [npm](http://npmjs.com/) or a modern module bundler, and would rather prefer a single-file [UMD](https://github.com/umdjs/umd) build that makes `Redux` available as a global object, you can grab a pre-built version from [cdnjs](https://cdnjs.com/libraries/redux). We *don’t* recommend this approach for any serious application, as most of the libraries complementary to Redux are only available on [npm](http://npmjs.com/). | ||
### The Gist | ||
@@ -128,2 +132,4 @@ | ||
If you’re new to the NPM ecosystem and have troubles getting a project up and running, or aren’t sure where to paste the gist above, check out [simplest-redux-example](https://github.com/jackielii/simplest-redux-example) that uses Redux together with React and Browserify. | ||
### Discussion | ||
@@ -130,0 +136,0 @@ |
@@ -113,14 +113,2 @@ import isPlainObject from './utils/isPlainObject'; | ||
/** | ||
* Returns the reducer currently used by the store to calculate the state. | ||
* | ||
* It is likely that you will only need this function if you implement a hot | ||
* reloading mechanism for Redux. | ||
* | ||
* @returns {Function} The reducer used by the current store. | ||
*/ | ||
function getReducer() { | ||
return currentReducer; | ||
} | ||
/** | ||
* Replaces the reducer currently used by the store to calculate the state. | ||
@@ -140,3 +128,2 @@ * | ||
// When a store is created, an "INIT" action is dispatched so that every | ||
@@ -151,5 +138,4 @@ // reducer returns their initial state. This effectively populates | ||
getState, | ||
getReducer, | ||
replaceReducer | ||
}; | ||
} |
@@ -30,3 +30,3 @@ import compose from './compose'; | ||
chain = middlewares.map(middleware => middleware(middlewareAPI)); | ||
dispatch = compose(...chain, store.dispatch); | ||
dispatch = compose(...chain)(store.dispatch); | ||
@@ -33,0 +33,0 @@ return { |
@@ -33,3 +33,3 @@ import mapValues from '../utils/mapValues'; | ||
if (typeof actionCreators !== 'object' || actionCreators == null) { | ||
if (typeof actionCreators !== 'object' || actionCreators == null) { // eslint-disable-line no-eq-null | ||
throw new Error( | ||
@@ -45,2 +45,1 @@ `bindActionCreators expected an object or a function, instead received ${typeof actionCreators}. ` + | ||
} | ||
@@ -6,2 +6,4 @@ import { ActionTypes } from '../createStore'; | ||
/* eslint-disable no-console */ | ||
function getErrorMessage(key, action) { | ||
@@ -107,12 +109,3 @@ var actionType = action && action.type; | ||
if (( | ||
// Node-like CommonJS environments (Browserify, Webpack) | ||
typeof process !== 'undefined' && | ||
typeof process.env !== 'undefined' && | ||
process.env.NODE_ENV !== 'production' | ||
) || | ||
// React Native | ||
typeof __DEV__ !== 'undefined' && | ||
__DEV__ //eslint-disable-line no-undef | ||
) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (!stateShapeVerified) { | ||
@@ -119,0 +112,0 @@ verifyStateShape(state, finalState); |
/** | ||
* Composes functions from left to right. | ||
* Composes single-argument functions from right to left. | ||
* | ||
* @param {...Function} funcs - The functions to compose. Each is expected to | ||
* accept a function as an argument and to return a function. | ||
* @returns {Function} A function obtained by composing functions from left to | ||
* right. | ||
* @param {...Function} funcs The functions to compose. | ||
* @returns {Function} A function obtained by composing functions from right to | ||
* left. For example, compose(f, g, h) is identical to x => h(g(f(x))). | ||
*/ | ||
export default function compose(...funcs) { | ||
return funcs.reduceRight((composed, f) => f(composed)); | ||
return arg => funcs.reduceRight((composed, f) => f(composed), arg); | ||
} |
@@ -5,3 +5,3 @@ /** | ||
* @param {Object} obj The source object. | ||
* @param {Function} fn The mapper function taht receives the value and the key. | ||
* @param {Function} fn The mapper function that receives the value and the key. | ||
* @returns {Object} A new object that contains the mapped values for the keys. | ||
@@ -8,0 +8,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
164
2
93758
1297