Socket
Socket
Sign inDemoInstall

redux

Package Overview
Dependencies
3
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0-beta.1 to 4.0.0-beta.2

27

dist/redux.js

@@ -26,2 +26,3 @@ (function (global, factory) {

/* global window */
var root;

@@ -60,20 +61,2 @@

var _extends = Object.assign || function (target) {

@@ -203,3 +186,3 @@ for (var i = 1; i < arguments.length; i++) {

if (typeof listener !== 'function') {
throw new Error('Expected listener to be a function.');
throw new Error('Expected the listener to be a function.');
}

@@ -375,5 +358,3 @@

throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
} catch (e) {} // eslint-disable-line no-empty
}

@@ -649,3 +630,3 @@

if ("development" !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
warning('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
warning("You are currently using minified code outside of NODE_ENV === 'production'. " + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
}

@@ -652,0 +633,0 @@

2

dist/redux.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Redux={})}(this,function(e){"use strict";function t(e){if("object"!==(void 0===e?"undefined":d(e))||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function r(e,n,o){function i(){b===y&&(b=y.slice())}function u(){if(v)throw Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return h}function a(e){if("function"!=typeof e)throw Error("Expected listener to be a function.");if(v)throw Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See http://redux.js.org/docs/api/Store.html#subscribe for more details.");var t=!0;return i(),b.push(e),function(){if(t){if(v)throw Error("You may not unsubscribe from a store listener while the reducer is executing. See http://redux.js.org/docs/api/Store.html#subscribe for more details.");t=!1,i();var r=b.indexOf(e);b.splice(r,1)}}}function s(e){if(!t(e))throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(v)throw Error("Reducers may not dispatch actions.");try{v=!0,h=p(h,e)}finally{v=!1}for(var r=y=b,n=0;r.length>n;n++)(0,r[n])();return e}var l;if("function"==typeof n&&void 0===o&&(o=n,n=void 0),void 0!==o){if("function"!=typeof o)throw Error("Expected the enhancer to be a function.");return o(r)(e,n)}if("function"!=typeof e)throw Error("Expected the reducer to be a function.");var p=e,h=n,y=[],b=y,v=!1;return s({type:f.INIT}),l={dispatch:s,subscribe:a,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error("Expected the nextReducer to be a function.");p=e,s({type:f.REPLACE})}},l[c]=function(){var e,t=a;return e={subscribe:function(e){function r(){e.next&&e.next(u())}if("object"!==(void 0===e?"undefined":d(e)))throw new TypeError("Expected the observer to be an object.");return r(),{unsubscribe:t(r)}}},e[c]=function(){return this},e},l}function n(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+r+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function o(e){Object.keys(e).forEach(function(t){var r=e[t];if(void 0===r(void 0,{type:f.INIT}))throw 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. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+f.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, but can be null.')})}function i(e,t){return function(){return t(e.apply(this,arguments))}}function u(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}var a,c=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}(a="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),f={INIT:"@@redux/INIT"+Math.random().toString(36).substring(7).split("").join("."),REPLACE:"@@redux/REPLACE"+Math.random().toString(36).substring(7).split("").join(".")},d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};e.createStore=r,e.combineReducers=function(e){for(var t=Object.keys(e),r={},i=0;t.length>i;i++){var u=t[i];"function"==typeof e[u]&&(r[u]=e[u])}var a=Object.keys(r),c=void 0;try{o(r)}catch(e){c=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(c)throw c;for(var o=!1,i={},u=0;a.length>u;u++){var f=a[u],d=r[f],s=e[f],l=d(s,t);if(void 0===l){var p=n(f,t);throw Error(p)}i[f]=l,o=o||l!==s}return o?i:e}},e.bindActionCreators=function(e,t){if("function"==typeof e)return i(e,t);if("object"!==(void 0===e?"undefined":d(e))||null===e)throw Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":void 0===e?"undefined":d(e))+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(e),n={},o=0;r.length>o;o++){var u=r[o],a=e[u];"function"==typeof a&&(n[u]=i(a,t))}return n},e.applyMiddleware=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return function(e){return function(){for(var r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];var i=e.apply(void 0,n),a=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},c=[],f={getState:i.getState,dispatch:function(){return a.apply(void 0,arguments)}};return c=t.map(function(e){return e(f)}),a=u.apply(void 0,c)(i.dispatch),s({},i,{dispatch:a})}}},e.compose=u,e.__DO_NOT_USE__ActionTypes=f,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Redux={})}(this,function(e){"use strict";var t=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),r={INIT:"@@redux/INIT"+Math.random().toString(36).substring(7).split("").join("."),REPLACE:"@@redux/REPLACE"+Math.random().toString(36).substring(7).split("").join(".")},n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function i(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+r+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function u(e,t){return function(){return t(e.apply(this,arguments))}}function a(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}e.createStore=function e(o,i,u){var a;if("function"==typeof i&&void 0===u&&(u=i,i=void 0),void 0!==u){if("function"!=typeof u)throw Error("Expected the enhancer to be a function.");return u(e)(o,i)}if("function"!=typeof o)throw Error("Expected the reducer to be a function.");var c=o,f=i,d=[],s=d,l=!1;function p(){s===d&&(s=d.slice())}function h(){if(l)throw Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return f}function y(e){if("function"!=typeof e)throw Error("Expected the listener to be a function.");if(l)throw Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See http://redux.js.org/docs/api/Store.html#subscribe for more details.");var t=!0;return p(),s.push(e),function(){if(t){if(l)throw Error("You may not unsubscribe from a store listener while the reducer is executing. See http://redux.js.org/docs/api/Store.html#subscribe for more details.");t=!1,p();var r=s.indexOf(e);s.splice(r,1)}}}function b(e){if(!function(e){if("object"!==(void 0===e?"undefined":n(e))||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw Error("Reducers may not dispatch actions.");try{l=!0,f=c(f,e)}finally{l=!1}for(var t=d=s,r=0;t.length>r;r++)(0,t[r])();return e}return b({type:r.INIT}),(a={dispatch:b,subscribe:y,getState:h,replaceReducer:function(e){if("function"!=typeof e)throw Error("Expected the nextReducer to be a function.");c=e,b({type:r.REPLACE})}})[t]=function(){var e,r=y;return(e={subscribe:function(e){if("object"!==(void 0===e?"undefined":n(e)))throw new TypeError("Expected the observer to be an object.");function t(){e.next&&e.next(h())}return t(),{unsubscribe:r(t)}}})[t]=function(){return this},e},a},e.combineReducers=function(e){for(var t=Object.keys(e),n={},o=0;t.length>o;o++){var u=t[o];"function"==typeof e[u]&&(n[u]=e[u])}var a=Object.keys(n),c=void 0;try{!function(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:r.INIT}))throw 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. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+r.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, but can be null.')})}(n)}catch(e){c=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(c)throw c;for(var r=!1,o={},u=0;a.length>u;u++){var f=a[u],d=e[f],s=(0,n[f])(d,t);if(void 0===s){var l=i(f,t);throw Error(l)}o[f]=s,r=r||s!==d}return r?o:e}},e.bindActionCreators=function(e,t){if("function"==typeof e)return u(e,t);if("object"!==(void 0===e?"undefined":n(e))||null===e)throw Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":void 0===e?"undefined":n(e))+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(e),o={},i=0;r.length>i;i++){var a=r[i],c=e[a];"function"==typeof c&&(o[a]=u(c,t))}return o},e.applyMiddleware=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return function(e){return function(){for(var r=arguments.length,n=Array(r),i=0;r>i;i++)n[i]=arguments[i];var u,c=e.apply(void 0,n),f=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},d={getState:c.getState,dispatch:function(){return f.apply(void 0,arguments)}};return u=t.map(function(e){return e(d)}),f=a.apply(void 0,u)(c.dispatch),o({},c,{dispatch:f})}}},e.compose=a,e.__DO_NOT_USE__ActionTypes=r,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -20,20 +20,2 @@ import $$observable from 'symbol-observable';

var _extends = Object.assign || function (target) {

@@ -163,3 +145,3 @@ for (var i = 1; i < arguments.length; i++) {

if (typeof listener !== 'function') {
throw new Error('Expected listener to be a function.');
throw new Error('Expected the listener to be a function.');
}

@@ -335,5 +317,3 @@

throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
} catch (e) {} // eslint-disable-line no-empty
}

@@ -609,5 +589,5 @@

if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
warning('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
warning("You are currently using minified code outside of NODE_ENV === 'production'. " + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
}
export { createStore, combineReducers, bindActionCreators, applyMiddleware, compose, ActionTypes as __DO_NOT_USE__ActionTypes };

@@ -23,2 +23,12 @@

/**
* An Action type which accepts any other properties.
* This is mainly for the use of the `Reducer` type.
* This is not part of `Action` itself to prevent users who are extending `Action.
*/
export interface AnyAction extends Action {
// Allows any extra properties to be defined in an action.
[extraProps: string]: any;
}
/* reducers */

@@ -50,3 +60,3 @@

*/
export type Reducer<S = any, A extends Action = Action> = (state: S | undefined, action: A) => S;
export type Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;

@@ -80,3 +90,4 @@ /**

*/
export function combineReducers<S, A extends Action = Action>(reducers: ReducersMapObject<S, A>): Reducer<S, A>;
export function combineReducers<S>(reducers: ReducersMapObject<S, any>): Reducer<S>;
export function combineReducers<S, A extends Action = AnyAction>(reducers: ReducersMapObject<S, A>): Reducer<S, A>;

@@ -104,6 +115,7 @@

*
* @template D the type of things (actions or otherwise) which may be dispatched.
* @template A The type of things (actions or otherwise) which may be
* dispatched.
*/
export interface Dispatch<D = Action> {
<A extends D>(action: A): A;
export interface Dispatch<A extends Action = AnyAction> {
<T extends A>(action: T): T;
}

@@ -125,5 +137,4 @@

* @template A the type of actions which may be dispatched by this store.
* @template N The type of non-actions which may be dispatched by this store.
*/
export interface Store<S = any, A extends Action = Action, N = never> {
export interface Store<S = any, A extends Action = AnyAction> {
/**

@@ -155,3 +166,3 @@ * Dispatches an action. It is the only way to trigger a state change.

*/
dispatch: Dispatch<A | N>;
dispatch: Dispatch<A>;

@@ -213,33 +224,11 @@ /**

* @template A The type of actions which may be dispatched.
* @template D The type of all things which may be dispatched.
* @template Ext Store extension that is mixed in to the Store type.
* @template StateExt State extension that is mixed into the state type.
*/
export interface StoreCreator {
<S, A extends Action, N>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<N>): Store<S, A, N>;
<S, A extends Action, N>(reducer: Reducer<S, A>, preloadedState: DeepPartial<S>, enhancer?: StoreEnhancer<N>): Store<S, A, N>;
<S, A extends Action, Ext, StateExt>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<Ext, StateExt>): Store<S & StateExt, A> & Ext;
<S, A extends Action, Ext, StateExt>(reducer: Reducer<S, A>, preloadedState: DeepPartial<S>, enhancer?: StoreEnhancer<Ext>): Store<S & StateExt> & Ext;
}
/**
* A store enhancer is a higher-order function that composes a store creator
* to return a new, enhanced store creator. This is similar to middleware in
* that it allows you to alter the store interface in a composable way.
*
* Store enhancers are much the same concept as higher-order components in
* React, which are also occasionally called “component enhancers”.
*
* Because a store is not an instance, but rather a plain-object collection of
* functions, copies can be easily created and modified without mutating the
* original store. There is an example in `compose` documentation
* demonstrating that.
*
* Most likely you'll never write a store enhancer, but you may use the one
* provided by the developer tools. It is what makes time travel possible
* without the app being aware it is happening. Amusingly, the Redux
* middleware implementation is itself a store enhancer.
*
*/
export type StoreEnhancer<N = never> = (next: StoreEnhancerStoreCreator<N>) => StoreEnhancerStoreCreator<N>;
export type GenericStoreEnhancer<N = never> = StoreEnhancer<N>;
export type StoreEnhancerStoreCreator<N = never> = <S = any, A extends Action = Action>(reducer: Reducer<S, A>, preloadedState?: DeepPartial<S>) => Store<S, A, N>;
/**
* Creates a Redux store that holds the state tree.

@@ -274,7 +263,31 @@ * The only way to change the data in the store is to call `dispatch()` on it.

/**
* A store enhancer is a higher-order function that composes a store creator
* to return a new, enhanced store creator. This is similar to middleware in
* that it allows you to alter the store interface in a composable way.
*
* Store enhancers are much the same concept as higher-order components in
* React, which are also occasionally called “component enhancers”.
*
* Because a store is not an instance, but rather a plain-object collection of
* functions, copies can be easily created and modified without mutating the
* original store. There is an example in `compose` documentation
* demonstrating that.
*
* Most likely you'll never write a store enhancer, but you may use the one
* provided by the developer tools. It is what makes time travel possible
* without the app being aware it is happening. Amusingly, the Redux
* middleware implementation is itself a store enhancer.
*
* @template Ext Store extension that is mixed into the Store type.
* @template StateExt State extension that is mixed into the state type.
*/
export type StoreEnhancer<Ext = {}, StateExt = {}> = (next: StoreEnhancerStoreCreator) => StoreEnhancerStoreCreator<Ext, StateExt>;
export type StoreEnhancerStoreCreator<Ext = {}, StateExt = {}> = <S = any, A extends Action = AnyAction>(reducer: Reducer<S, A>, preloadedState?: DeepPartial<S>) => Store<S & StateExt, A> & Ext;
/* middleware */
export interface MiddlewareAPI<S = any, D = Action> {
dispatch: Dispatch<D>;
export interface MiddlewareAPI<D extends Dispatch = Dispatch, S = any> {
dispatch: D;
getState(): S;

@@ -291,5 +304,10 @@ }

* asynchronous API call into a series of synchronous actions.
*
* @template DispatchExt Extra Dispatch signature added by this middleware.
* @template S The type of the state supported by this middleware.
* @template D The type of Dispatch of the store where this middleware is
* installed.
*/
export interface Middleware {
<S = any, D = Action>(api: MiddlewareAPI<S, D>): (next: Dispatch<D>) => Dispatch<D>;
export interface Middleware<DispatchExt = {}, S = any, D extends Dispatch = Dispatch> {
(api: MiddlewareAPI<D, S>): (next: Dispatch<AnyAction>) => (action: any) => any;
}

@@ -313,4 +331,13 @@

* @returns A store enhancer applying the middleware.
*
* @template Ext Dispatch signature added by a middleware.
* @template S The type of the state supported by a middleware.
*/
export function applyMiddleware(...middlewares: Middleware[]): GenericStoreEnhancer;
export function applyMiddleware(): StoreEnhancer;
export function applyMiddleware<Ext1, S>(middleware1: Middleware<Ext1, S, any>): StoreEnhancer<{dispatch: Ext1}>;
export function applyMiddleware<Ext1, Ext2, S>(middleware1: Middleware<Ext1, S, any>, middleware2: Middleware<Ext2, S, any>): StoreEnhancer<{dispatch: Ext1 & Ext2}>;
export function applyMiddleware<Ext1, Ext2, Ext3, S>(middleware1: Middleware<Ext1, S, any>, middleware2: Middleware<Ext2, S, any>, middleware3: Middleware<Ext3, S, any>): StoreEnhancer<{dispatch: Ext1 & Ext2 & Ext3}>;
export function applyMiddleware<Ext1, Ext2, Ext3, Ext4, S>(middleware1: Middleware<Ext1, S, any>, middleware2: Middleware<Ext2, S, any>, middleware3: Middleware<Ext3, S, any>, middleware4: Middleware<Ext4, S, any>): StoreEnhancer<{dispatch: Ext1 & Ext2 & Ext3 & Ext4}>;
export function applyMiddleware<Ext1, Ext2, Ext3, Ext4, Ext5, S>(middleware1: Middleware<Ext1, S, any>, middleware2: Middleware<Ext2, S, any>, middleware3: Middleware<Ext3, S, any>, middleware4: Middleware<Ext4, S, any>, middleware5: Middleware<Ext5, S, any>): StoreEnhancer<{dispatch: Ext1 & Ext2 & Ext3 & Ext4 & Ext5}>;
export function applyMiddleware<Ext, S = any>(...middlewares: Middleware<any, S, any>[]): StoreEnhancer<{dispatch: Ext}>;

@@ -367,3 +394,3 @@

*/
export function bindActionCreators<A, C extends ActionCreator<A>>(actionCreator: C, dispatch: Dispatch<A>): C;
export function bindActionCreators<A, C extends ActionCreator<A>>(actionCreator: C, dispatch: Dispatch): C;

@@ -373,5 +400,5 @@ export function bindActionCreators<

B extends ActionCreator<any>
>(actionCreator: A, dispatch: Dispatch<any>): B;
>(actionCreator: A, dispatch: Dispatch): B;
export function bindActionCreators<A, M extends ActionCreatorsMapObject<A>>(actionCreators: M, dispatch: Dispatch<A>): M;
export function bindActionCreators<A, M extends ActionCreatorsMapObject<A>>(actionCreators: M, dispatch: Dispatch): M;

@@ -381,3 +408,3 @@ export function bindActionCreators<

N extends ActionCreatorsMapObject<any>
>(actionCreators: M, dispatch: Dispatch<any>): N;
>(actionCreators: M, dispatch: Dispatch): N;

@@ -384,0 +411,0 @@

@@ -26,20 +26,2 @@ 'use strict';

var _extends = Object.assign || function (target) {

@@ -169,3 +151,3 @@ for (var i = 1; i < arguments.length; i++) {

if (typeof listener !== 'function') {
throw new Error('Expected listener to be a function.');
throw new Error('Expected the listener to be a function.');
}

@@ -341,5 +323,3 @@

throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
} catch (e) {} // eslint-disable-line no-empty
}

@@ -615,3 +595,3 @@

if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
warning('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
warning("You are currently using minified code outside of NODE_ENV === 'production'. " + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
}

@@ -618,0 +598,0 @@

{
"name": "redux",
"version": "4.0.0-beta.1",
"version": "4.0.0-beta.2",
"description": "Predictable state container for JavaScript apps",

@@ -17,2 +17,4 @@ "main": "lib/redux.js",

"clean": "rimraf lib dist es coverage",
"format": "prettier --write \"{src,test}/**/*.js\"",
"format:check": "prettier --list-different \"{src,test}/**/*.js\"",
"lint": "eslint src test build",

@@ -28,3 +30,3 @@ "pretest": "npm run build:commonjs",

"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min",
"prepare": "npm run clean && npm run lint && npm test && npm run build",
"prepare": "npm run clean && npm run format:check && npm run lint && npm test && npm run build",
"examples:lint": "eslint examples",

@@ -66,3 +68,3 @@ "examples:test": "cross-env CI=true babel-node examples/testAll.js",

"loose-envify": "^1.1.0",
"symbol-observable": "^1.0.3"
"symbol-observable": "^1.2.0"
},

@@ -72,4 +74,4 @@ "devDependencies": {

"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-jest": "^21.2.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.2.2",
"babel-plugin-external-helpers": "^6.22.0",

@@ -79,21 +81,22 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0",

"babel-register": "^6.26.0",
"cross-env": "^5.1.0",
"eslint": "^4.9.0",
"eslint-config-react-app": "^2.0.1",
"eslint-plugin-flowtype": "^2.39.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.4.0",
"cross-env": "^5.1.3",
"eslint": "^4.17.0",
"eslint-config-react-app": "^2.1.0",
"eslint-plugin-flowtype": "^2.44.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.6.1",
"gitbook-cli": "^2.3.2",
"glob": "^7.1.1",
"jest": "^21.2.1",
"jest": "^22.3.0",
"prettier": "^1.10.2",
"rimraf": "^2.6.2",
"rollup": "^0.50.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup": "^0.56.0",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-node-resolve": "^3.0.3",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^2.0.1",
"rxjs": "^5.5.0",
"typescript": "^2.4.2",
"typescript-definition-tester": "0.0.5"
"rollup-plugin-uglify": "^3.0.0",
"rxjs": "^5.5.6",
"typescript": "^2.7.1",
"typings-tester": "^0.3.1"
},

@@ -100,0 +103,0 @@ "npmName": "redux",

@@ -1,2 +0,2 @@

# <a href='http://redux.js.org'><img src='https://camo.githubusercontent.com/f28b5bc7822f1b7bb28a96d8d09e7d79169248fc/687474703a2f2f692e696d6775722e636f6d2f4a65567164514d2e706e67' height='60'></a>
# <a href='http://redux.js.org'><img src='https://camo.githubusercontent.com/f28b5bc7822f1b7bb28a96d8d09e7d79169248fc/687474703a2f2f692e696d6775722e636f6d2f4a65567164514d2e706e67' height='60' alt='Redux Logo' aria-label='Redux.js.org' /></a>

@@ -22,3 +22,3 @@ Redux is a predictable state container for JavaScript apps.

### Testimonials
## Testimonials

@@ -34,3 +34,3 @@ >[“Love what you're doing with Redux”](https://twitter.com/jingc/status/616608251463909376)

### Before Proceeding Further
## Before Proceeding Further

@@ -40,7 +40,7 @@ >**Also read:**

### Developer Experience
## Developer Experience
I wrote Redux while working on my React Europe talk called [“Hot Reloading with Time Travel”](https://www.youtube.com/watch?v=xsSnOQynTHs). My goal was to create a state management library with minimal API but completely predictable behavior, so it is possible to implement logging, hot reloading, time travel, universal apps, record and replay, without any buy-in from the developer.
### Influences
## Influences

@@ -50,3 +50,3 @@ Redux evolves the ideas of [Flux](http://facebook.github.io/flux/), but avoids its complexity by taking cues from [Elm](https://github.com/evancz/elm-architecture-tutorial/).

### Installation
## Installation

@@ -69,3 +69,3 @@ To install the stable version:

#### Complementary Packages
### Complementary Packages

@@ -81,3 +81,3 @@ Most likely, you'll also need [the React bindings](https://github.com/reactjs/react-redux) and [the developer tools](https://github.com/gaearon/redux-devtools).

### The Gist
## The Gist

@@ -144,3 +144,3 @@ The whole state of your app is stored in an object tree inside a single *store*.

### Learn Redux from Its Creator
## Learn Redux from Its Creator

@@ -166,7 +166,7 @@ [Getting Started with Redux](https://egghead.io/series/getting-started-with-redux) is a video course consisting of 30 videos narrated by Dan Abramov, author of Redux. It is designed to complement the “Basics” part of the docs while bringing additional insights about immutability, testing, Redux best practices, and using Redux with React. **This course is free and will always be.**

#### [Watch the 30 Free Videos!](https://egghead.io/series/getting-started-with-redux)
### [Watch the 30 Free Videos!](https://egghead.io/series/getting-started-with-redux)
If you enjoyed my course, consider supporting Egghead by [buying a subscription](https://egghead.io/pricing). Subscribers have access to the source code of every example in my videos and tons of advanced lessons on other topics, including JavaScript in depth, React, Angular, and more. Many [Egghead instructors](https://egghead.io/instructors) are also open source library authors, so buying a subscription is a nice way to thank them for the work that they've done.
### Documentation
## Documentation

@@ -186,3 +186,3 @@ * [Introduction](http://redux.js.org/docs/introduction/index.html)

### Examples
## Examples

@@ -204,7 +204,7 @@ Almost all examples have a corresponding CodeSandbox sandbox. This is an interactive version of the code that you can play with online.

### Discussion
## Discussion
Join the [#redux](https://discord.gg/0ZcbPKXt5bZ6au5t) channel of the [Reactiflux](http://www.reactiflux.com) Discord community.
### Thanks
## Thanks

@@ -224,7 +224,7 @@ * [The Elm Architecture](https://github.com/evancz/elm-architecture-tutorial) for a great intro to modeling state updates with reducers;

### Logo
## Logo
You can find the official logo [on GitHub](https://github.com/reactjs/redux/tree/master/logo).
### Change Log
## Change Log

@@ -234,3 +234,3 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Patrons
## Patrons

@@ -245,4 +245,4 @@ The work on Redux was [funded by the community](https://www.patreon.com/reactdx).

### License
## License
MIT

@@ -20,3 +20,3 @@ import compose from './compose'

export default function applyMiddleware(...middlewares) {
return (createStore) => (...args) => {
return createStore => (...args) => {
const store = createStore(...args)

@@ -26,3 +26,3 @@ let dispatch = () => {

`Dispatching while constructing your middleware is not allowed. ` +
`Other middleware would not be applied to this dispatch.`
`Other middleware would not be applied to this dispatch.`
)

@@ -29,0 +29,0 @@ }

function bindActionCreator(actionCreator, dispatch) {
return function() { return dispatch(actionCreator.apply(this, arguments)) }
return function() {
return dispatch(actionCreator.apply(this, arguments))
}
}

@@ -33,4 +35,6 @@

throw new Error(
`bindActionCreators expected an object or a function, instead received ${actionCreators === null ? 'null' : typeof actionCreators}. ` +
`Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`
`bindActionCreators expected an object or a function, instead received ${
actionCreators === null ? 'null' : typeof actionCreators
}. ` +
`Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?`
)

@@ -37,0 +41,0 @@ }

@@ -7,3 +7,4 @@ import ActionTypes from './utils/actionTypes'

const actionType = action && action.type
const actionDescription = (actionType && `action "${String(actionType)}"`) || 'an action'
const actionDescription =
(actionType && `action "${String(actionType)}"`) || 'an action'

@@ -17,7 +18,13 @@ return (

function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
function getUnexpectedStateShapeWarningMessage(
inputState,
reducers,
action,
unexpectedKeyCache
) {
const reducerKeys = Object.keys(reducers)
const argumentName = action && action.type === ActionTypes.INIT ?
'preloadedState argument passed to createStore' :
'previous state received by the reducer'
const argumentName =
action && action.type === ActionTypes.INIT
? 'preloadedState argument passed to createStore'
: 'previous state received by the reducer'

@@ -34,3 +41,3 @@ if (reducerKeys.length === 0) {

`The ${argumentName} has unexpected type of "` +
({}).toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] +
{}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] +
`". Expected argument to be an object with the following ` +

@@ -41,5 +48,4 @@ `keys: "${reducerKeys.join('", "')}"`

const unexpectedKeys = Object.keys(inputState).filter(key =>
!reducers.hasOwnProperty(key) &&
!unexpectedKeyCache[key]
const unexpectedKeys = Object.keys(inputState).filter(
key => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]
)

@@ -71,18 +77,26 @@

`Reducer "${key}" 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. If you don't want to set a value for this reducer, ` +
`you can use null instead of undefined.`
`If the state passed to the reducer is undefined, you must ` +
`explicitly return the initial state. The initial state may ` +
`not be undefined. If you don't want to set a value for this reducer, ` +
`you can use null instead of undefined.`
)
}
const type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.')
const type =
'@@redux/PROBE_UNKNOWN_ACTION_' +
Math.random()
.toString(36)
.substring(7)
.split('')
.join('.')
if (typeof reducer(undefined, { type }) === 'undefined') {
throw new Error(
`Reducer "${key}" returned undefined when probed with a random type. ` +
`Don't try to handle ${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, but can be null.`
`Don't try to handle ${
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, but can be null.`
)

@@ -145,3 +159,8 @@ }

if (process.env.NODE_ENV !== 'production') {
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache)
const warningMessage = getUnexpectedStateShapeWarningMessage(
state,
finalReducers,
action,
unexpectedKeyCache
)
if (warningMessage) {

@@ -148,0 +167,0 @@ warning(warningMessage)

@@ -70,4 +70,4 @@ import $$observable from 'symbol-observable'

'You may not call store.getState() while the reducer is executing. ' +
'The reducer has already received the state as an argument. ' +
'Pass it down from the top reducer instead of reading it from the store.'
'The reducer has already received the state as an argument. ' +
'Pass it down from the top reducer instead of reading it from the store.'
)

@@ -104,3 +104,3 @@ }

if (typeof listener !== 'function') {
throw new Error('Expected listener to be a function.')
throw new Error('Expected the listener to be a function.')
}

@@ -111,5 +111,5 @@

'You may not call store.subscribe() while the reducer is executing. ' +
'If you would like to be notified after the store has been updated, subscribe from a ' +
'component and invoke store.getState() in the callback to access the latest state. ' +
'See http://redux.js.org/docs/api/Store.html#subscribe for more details.'
'If you would like to be notified after the store has been updated, subscribe from a ' +
'component and invoke store.getState() in the callback to access the latest state. ' +
'See http://redux.js.org/docs/api/Store.html#subscribe for more details.'
)

@@ -131,3 +131,3 @@ }

'You may not unsubscribe from a store listener while the reducer is executing. ' +
'See http://redux.js.org/docs/api/Store.html#subscribe for more details.'
'See http://redux.js.org/docs/api/Store.html#subscribe for more details.'
)

@@ -173,3 +173,3 @@ }

'Actions must be plain objects. ' +
'Use custom middleware for async actions.'
'Use custom middleware for async actions.'
)

@@ -181,3 +181,3 @@ }

'Actions may not have an undefined "type" property. ' +
'Have you misspelled a constant?'
'Have you misspelled a constant?'
)

@@ -197,3 +197,3 @@ }

const listeners = currentListeners = nextListeners
const listeners = (currentListeners = nextListeners)
for (let i = 0; i < listeners.length; i++) {

@@ -200,0 +200,0 @@ const listener = listeners[i]

@@ -21,7 +21,7 @@ import createStore from './createStore'

warning(
'You are currently using minified code outside of NODE_ENV === \'production\'. ' +
'This means that you are running a slower development build of Redux. ' +
'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' +
'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' +
'to ensure you have the correct code for your production build.'
"You are currently using minified code outside of NODE_ENV === 'production'. " +
'This means that you are running a slower development build of Redux. ' +
'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' +
'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' +
'to ensure you have the correct code for your production build.'
)

@@ -28,0 +28,0 @@ }

@@ -8,6 +8,18 @@ /**

const ActionTypes = {
INIT: '@@redux/INIT' + Math.random().toString(36).substring(7).split('').join('.'),
REPLACE: '@@redux/REPLACE' + Math.random().toString(36).substring(7).split('').join('.')
INIT:
'@@redux/INIT' +
Math.random()
.toString(36)
.substring(7)
.split('')
.join('.'),
REPLACE:
'@@redux/REPLACE' +
Math.random()
.toString(36)
.substring(7)
.split('')
.join('.')
}
export default ActionTypes

@@ -18,5 +18,3 @@ /**

throw new Error(message)
/* eslint-disable no-empty */
} catch (e) { }
/* eslint-enable no-empty */
} catch (e) {} // eslint-disable-line no-empty
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc