Comparing version 4.1.0 to 4.2.1
@@ -45,55 +45,55 @@ (function (global, factory) { | ||
function kindOf(val) { | ||
var typeOfVal = typeof val; | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined'; | ||
if (val === null) return 'null'; | ||
var type = typeof val; | ||
{ | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined'; | ||
if (val === null) return 'null'; | ||
var type = typeof val; | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': | ||
{ | ||
return type; | ||
} | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': | ||
{ | ||
return type; | ||
} | ||
} | ||
if (Array.isArray(val)) return 'array'; | ||
if (isDate(val)) return 'date'; | ||
if (isError(val)) return 'error'; | ||
var constructorName = ctorName(val); | ||
if (Array.isArray(val)) return 'array'; | ||
if (isDate(val)) return 'date'; | ||
if (isError(val)) return 'error'; | ||
var constructorName = ctorName(val); | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName; | ||
} // other | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName; | ||
} // other | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); | ||
} | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
function isError(val) { | ||
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; | ||
} | ||
function isError(val) { | ||
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; | ||
} | ||
function kindOf(val) { | ||
var typeOfVal = typeof val; | ||
{ | ||
typeOfVal = miniKindOf(val); | ||
@@ -106,25 +106,25 @@ } | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* @deprecated | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* **We recommend using the `configureStore` method | ||
* of the `@reduxjs/toolkit` package**, which replaces `createStore`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* Redux Toolkit is our recommended approach for writing Redux logic today, | ||
* including store setup, reducers, data fetching, and more. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* **For more details, please read this Redux docs page:** | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* `configureStore` from Redux Toolkit is an improved version of `createStore` that | ||
* simplifies setup and helps avoid common bugs. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
* You should not be using the `redux` core package by itself today, except for learning purposes. | ||
* The `createStore` method from the core `redux` package will not be removed, but we encourage | ||
* all users to migrate to using Redux Toolkit for all Redux code. | ||
* | ||
* If you want to use `createStore` without this visual deprecation warning, use | ||
* the `legacy_createStore` import instead: | ||
* | ||
* `import { legacy_createStore as createStore} from 'redux'` | ||
* | ||
*/ | ||
@@ -379,3 +379,35 @@ | ||
} | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* | ||
* **We recommend using `configureStore` from the | ||
* `@reduxjs/toolkit` package**, which replaces `createStore`: | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
*/ | ||
var legacy_createStore = createStore; | ||
/** | ||
@@ -718,13 +750,2 @@ * Prints a warning in the console if it exists. | ||
/* | ||
* This is a dummy function to check if the function name has been altered by minification. | ||
* If the function has been minified and NODE_ENV !== 'production', warn the user. | ||
*/ | ||
function isCrushed() {} | ||
if (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 setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.'); | ||
} | ||
exports.__DO_NOT_USE__ActionTypes = ActionTypes; | ||
@@ -736,2 +757,3 @@ exports.applyMiddleware = applyMiddleware; | ||
exports.createStore = createStore; | ||
exports.legacy_createStore = legacy_createStore; | ||
@@ -738,0 +760,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).Redux={})}(this,(function(r){"use strict";function t(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var e="function"==typeof Symbol&&Symbol.observable||"@@observable",n=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+n(),REPLACE:"@@redux/REPLACE"+n(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+n()}};function i(r){if("object"!=typeof r||null===r)return!1;for(var t=r;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function f(r,t){return function(){return t(r.apply(this,arguments))}}function u(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function c(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function p(r){for(var t=1;arguments.length>t;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?c(Object(e),!0).forEach((function(t){u(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function a(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return 0===t.length?function(r){return r}:1===t.length?t[0]:t.reduce((function(r,t){return function(){return r(t.apply(void 0,arguments))}}))}r.__DO_NOT_USE__ActionTypes=o,r.applyMiddleware=function(){for(var r=arguments.length,e=Array(r),n=0;r>n;n++)e[n]=arguments[n];return function(r){return function(){var n=r.apply(void 0,arguments),o=function(){throw Error(t(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},f=e.map((function(r){return r(i)}));return o=a.apply(void 0,f)(n.dispatch),p(p({},n),{},{dispatch:o})}}},r.bindActionCreators=function(r,e){if("function"==typeof r)return f(r,e);if("object"!=typeof r||null===r)throw Error(t(16));var n={};for(var o in r){var i=r[o];"function"==typeof i&&(n[o]=f(i,e))}return n},r.combineReducers=function(r){for(var e=Object.keys(r),n={},i=0;e.length>i;i++){var f=e[i];"function"==typeof r[f]&&(n[f]=r[f])}var u,c=Object.keys(n);try{!function(r){Object.keys(r).forEach((function(e){var n=r[e];if(void 0===n(void 0,{type:o.INIT}))throw Error(t(12));if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error(t(13))}))}(n)}catch(r){u=r}return function(r,e){if(void 0===r&&(r={}),u)throw u;for(var o=!1,i={},f=0;c.length>f;f++){var p=c[f],a=r[p],l=(0,n[p])(a,e);if(void 0===l)throw Error(t(14));i[p]=l,o=o||l!==a}return(o=o||c.length!==Object.keys(r).length)?i:r}},r.compose=a,r.createStore=function r(n,f,u){var c;if("function"==typeof f&&"function"==typeof u||"function"==typeof u&&"function"==typeof arguments[3])throw Error(t(0));if("function"==typeof f&&void 0===u&&(u=f,f=void 0),void 0!==u){if("function"!=typeof u)throw Error(t(1));return u(r)(n,f)}if("function"!=typeof n)throw Error(t(2));var p=n,a=f,l=[],y=l,s=!1;function d(){y===l&&(y=l.slice())}function b(){if(s)throw Error(t(3));return a}function h(r){if("function"!=typeof r)throw Error(t(4));if(s)throw Error(t(5));var e=!0;return d(),y.push(r),function(){if(e){if(s)throw Error(t(6));e=!1,d();var n=y.indexOf(r);y.splice(n,1),l=null}}}function v(r){if(!i(r))throw Error(t(7));if(void 0===r.type)throw Error(t(8));if(s)throw Error(t(9));try{s=!0,a=p(a,r)}finally{s=!1}for(var e=l=y,n=0;e.length>n;n++){(0,e[n])()}return r}function O(r){if("function"!=typeof r)throw Error(t(10));p=r,v({type:o.REPLACE})}function E(){var r,n=h;return(r={subscribe:function(r){if("object"!=typeof r||null===r)throw Error(t(11));function e(){r.next&&r.next(b())}return e(),{unsubscribe:n(e)}}})[e]=function(){return this},r}return v({type:o.INIT}),(c={dispatch:v,subscribe:h,getState:b,replaceReducer:O})[e]=E,c},Object.defineProperty(r,"__esModule",{value:!0})})); | ||
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).Redux={})}(this,(function(r){"use strict";function t(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var e="function"==typeof Symbol&&Symbol.observable||"@@observable",n=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+n(),REPLACE:"@@redux/REPLACE"+n(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+n()}};function i(r){if("object"!=typeof r||null===r)return!1;for(var t=r;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function f(r,n,u){var c;if("function"==typeof n&&"function"==typeof u||"function"==typeof u&&"function"==typeof arguments[3])throw Error(t(0));if("function"==typeof n&&void 0===u&&(u=n,n=void 0),void 0!==u){if("function"!=typeof u)throw Error(t(1));return u(f)(r,n)}if("function"!=typeof r)throw Error(t(2));var p=r,a=n,l=[],y=l,s=!1;function d(){y===l&&(y=l.slice())}function b(){if(s)throw Error(t(3));return a}function h(r){if("function"!=typeof r)throw Error(t(4));if(s)throw Error(t(5));var e=!0;return d(),y.push(r),function(){if(e){if(s)throw Error(t(6));e=!1,d();var n=y.indexOf(r);y.splice(n,1),l=null}}}function v(r){if(!i(r))throw Error(t(7));if(void 0===r.type)throw Error(t(8));if(s)throw Error(t(9));try{s=!0,a=p(a,r)}finally{s=!1}for(var e=l=y,n=0;e.length>n;n++){(0,e[n])()}return r}function O(r){if("function"!=typeof r)throw Error(t(10));p=r,v({type:o.REPLACE})}function E(){var r,n=h;return(r={subscribe:function(r){if("object"!=typeof r||null===r)throw Error(t(11));function e(){r.next&&r.next(b())}return e(),{unsubscribe:n(e)}}})[e]=function(){return this},r}return v({type:o.INIT}),(c={dispatch:v,subscribe:h,getState:b,replaceReducer:O})[e]=E,c}var u=f;function c(r,t){return function(){return t(r.apply(this,arguments))}}function p(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function a(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function l(r){for(var t=1;arguments.length>t;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?a(Object(e),!0).forEach((function(t){p(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):a(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function y(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return 0===t.length?function(r){return r}:1===t.length?t[0]:t.reduce((function(r,t){return function(){return r(t.apply(void 0,arguments))}}))}r.__DO_NOT_USE__ActionTypes=o,r.applyMiddleware=function(){for(var r=arguments.length,e=Array(r),n=0;r>n;n++)e[n]=arguments[n];return function(r){return function(){var n=r.apply(void 0,arguments),o=function(){throw Error(t(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},f=e.map((function(r){return r(i)}));return o=y.apply(void 0,f)(n.dispatch),l(l({},n),{},{dispatch:o})}}},r.bindActionCreators=function(r,e){if("function"==typeof r)return c(r,e);if("object"!=typeof r||null===r)throw Error(t(16));var n={};for(var o in r){var i=r[o];"function"==typeof i&&(n[o]=c(i,e))}return n},r.combineReducers=function(r){for(var e=Object.keys(r),n={},i=0;e.length>i;i++){var f=e[i];"function"==typeof r[f]&&(n[f]=r[f])}var u,c=Object.keys(n);try{!function(r){Object.keys(r).forEach((function(e){var n=r[e];if(void 0===n(void 0,{type:o.INIT}))throw Error(t(12));if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error(t(13))}))}(n)}catch(r){u=r}return function(r,e){if(void 0===r&&(r={}),u)throw u;for(var o=!1,i={},f=0;c.length>f;f++){var p=c[f],a=r[p],l=(0,n[p])(a,e);if(void 0===l)throw Error(t(14));i[p]=l,o=o||l!==a}return(o=o||c.length!==Object.keys(r).length)?i:r}},r.compose=y,r.createStore=f,r.legacy_createStore=u,Object.defineProperty(r,"__esModule",{value:!0})})); |
167
es/redux.js
@@ -52,55 +52,55 @@ import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2'; | ||
function kindOf(val) { | ||
var typeOfVal = typeof val; | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined'; | ||
if (val === null) return 'null'; | ||
var type = typeof val; | ||
if (process.env.NODE_ENV !== 'production') { | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined'; | ||
if (val === null) return 'null'; | ||
var type = typeof val; | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': | ||
{ | ||
return type; | ||
} | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': | ||
{ | ||
return type; | ||
} | ||
} | ||
if (Array.isArray(val)) return 'array'; | ||
if (isDate(val)) return 'date'; | ||
if (isError(val)) return 'error'; | ||
var constructorName = ctorName(val); | ||
if (Array.isArray(val)) return 'array'; | ||
if (isDate(val)) return 'date'; | ||
if (isError(val)) return 'error'; | ||
var constructorName = ctorName(val); | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName; | ||
} // other | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName; | ||
} // other | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); | ||
} | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
function isError(val) { | ||
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; | ||
} | ||
function isError(val) { | ||
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; | ||
} | ||
function kindOf(val) { | ||
var typeOfVal = typeof val; | ||
if (process.env.NODE_ENV !== 'production') { | ||
typeOfVal = miniKindOf(val); | ||
@@ -113,25 +113,25 @@ } | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* @deprecated | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* **We recommend using the `configureStore` method | ||
* of the `@reduxjs/toolkit` package**, which replaces `createStore`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* Redux Toolkit is our recommended approach for writing Redux logic today, | ||
* including store setup, reducers, data fetching, and more. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* **For more details, please read this Redux docs page:** | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* `configureStore` from Redux Toolkit is an improved version of `createStore` that | ||
* simplifies setup and helps avoid common bugs. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
* You should not be using the `redux` core package by itself today, except for learning purposes. | ||
* The `createStore` method from the core `redux` package will not be removed, but we encourage | ||
* all users to migrate to using Redux Toolkit for all Redux code. | ||
* | ||
* If you want to use `createStore` without this visual deprecation warning, use | ||
* the `legacy_createStore` import instead: | ||
* | ||
* `import { legacy_createStore as createStore} from 'redux'` | ||
* | ||
*/ | ||
@@ -386,3 +386,35 @@ | ||
} | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* | ||
* **We recommend using `configureStore` from the | ||
* `@reduxjs/toolkit` package**, which replaces `createStore`: | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
*/ | ||
var legacy_createStore = createStore; | ||
/** | ||
@@ -676,13 +708,2 @@ * Prints a warning in the console if it exists. | ||
/* | ||
* This is a dummy function to check if the function name has been altered by minification. | ||
* If the function has been minified and NODE_ENV !== 'production', warn the user. | ||
*/ | ||
function isCrushed() {} | ||
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 setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.'); | ||
} | ||
export { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore }; | ||
export { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore, legacy_createStore }; |
136
index.d.ts
@@ -69,3 +69,3 @@ /** | ||
} | ||
: never | ||
: S | ||
: { | ||
@@ -376,30 +376,130 @@ [K in keyof S]: S[K] extends string | number | boolean | symbol | ||
/** | ||
* @deprecated | ||
* | ||
* **We recommend using the `configureStore` method | ||
* of the `@reduxjs/toolkit` package**, which replaces `createStore`. | ||
* | ||
* Redux Toolkit is our recommended approach for writing Redux logic today, | ||
* including store setup, reducers, data fetching, and more. | ||
* | ||
* **For more details, please read this Redux docs page:** | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* `configureStore` from Redux Toolkit is an improved version of `createStore` that | ||
* simplifies setup and helps avoid common bugs. | ||
* | ||
* You should not be using the `redux` core package by itself today, except for learning purposes. | ||
* The `createStore` method from the core `redux` package will not be removed, but we encourage | ||
* all users to migrate to using Redux Toolkit for all Redux code. | ||
* | ||
* If you want to use `createStore` without this visual deprecation warning, use | ||
* the `legacy_createStore` import instead: | ||
* | ||
* `import { legacy_createStore as createStore} from 'redux'` | ||
* | ||
*/ | ||
export declare function createStore<S, A extends Action, Ext, StateExt>( | ||
reducer: Reducer<S, A>, | ||
enhancer?: StoreEnhancer<Ext, StateExt> | ||
): Store<S & StateExt, A> & Ext | ||
/** | ||
* @deprecated | ||
* | ||
* **We recommend using the `configureStore` method | ||
* of the `@reduxjs/toolkit` package**, which replaces `createStore`. | ||
* | ||
* Redux Toolkit is our recommended approach for writing Redux logic today, | ||
* including store setup, reducers, data fetching, and more. | ||
* | ||
* **For more details, please read this Redux docs page:** | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* `configureStore` from Redux Toolkit is an improved version of `createStore` that | ||
* simplifies setup and helps avoid common bugs. | ||
* | ||
* You should not be using the `redux` core package by itself today, except for learning purposes. | ||
* The `createStore` method from the core `redux` package will not be removed, but we encourage | ||
* all users to migrate to using Redux Toolkit for all Redux code. | ||
* | ||
* If you want to use `createStore` without this visual deprecation warning, use | ||
* the `legacy_createStore` import instead: | ||
* | ||
* `import { legacy_createStore as createStore} from 'redux'` | ||
* | ||
*/ | ||
export declare function createStore<S, A extends Action, Ext, StateExt>( | ||
reducer: Reducer<S, A>, | ||
preloadedState?: PreloadedState<S>, | ||
enhancer?: StoreEnhancer<Ext> | ||
): Store<S & StateExt, A> & Ext | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* | ||
* **We recommend using `configureStore` from the | ||
* `@reduxjs/toolkit` package**, which replaces `createStore`: | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several | ||
* reducers | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* | ||
* @template S State object type. | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* | ||
* @param reducer A function that returns the next state tree, given the | ||
* current state tree and the action to handle. | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* | ||
* @param [preloadedState] The initial state. You may optionally specify it to | ||
* hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. If you use `combineReducers` to | ||
* produce the root reducer function, this must be an object with the same | ||
* shape as `combineReducers` keys. | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* | ||
* @param [enhancer] The store enhancer. You may optionally specify it to | ||
* enhance the store with third-party capabilities such as middleware, time | ||
* travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
*/ | ||
export declare function legacy_createStore<S, A extends Action, Ext, StateExt>( | ||
reducer: Reducer<S, A>, | ||
enhancer?: StoreEnhancer<Ext, StateExt> | ||
): Store<S & StateExt, A> & Ext | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* | ||
* @returns A Redux store that lets you read the state, dispatch actions and | ||
* subscribe to changes. | ||
* **We recommend using `configureStore` from the | ||
* `@reduxjs/toolkit` package**, which replaces `createStore`: | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
*/ | ||
export const createStore: StoreCreator | ||
export declare function legacy_createStore<S, A extends Action, Ext, StateExt>( | ||
reducer: Reducer<S, A>, | ||
preloadedState?: PreloadedState<S>, | ||
enhancer?: StoreEnhancer<Ext> | ||
): Store<S & StateExt, A> & Ext | ||
@@ -406,0 +506,0 @@ /** |
166
lib/redux.js
@@ -60,55 +60,55 @@ 'use strict'; | ||
function kindOf(val) { | ||
var typeOfVal = typeof val; | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined'; | ||
if (val === null) return 'null'; | ||
var type = typeof val; | ||
if (process.env.NODE_ENV !== 'production') { | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined'; | ||
if (val === null) return 'null'; | ||
var type = typeof val; | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': | ||
{ | ||
return type; | ||
} | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': | ||
{ | ||
return type; | ||
} | ||
} | ||
if (Array.isArray(val)) return 'array'; | ||
if (isDate(val)) return 'date'; | ||
if (isError(val)) return 'error'; | ||
var constructorName = ctorName(val); | ||
if (Array.isArray(val)) return 'array'; | ||
if (isDate(val)) return 'date'; | ||
if (isError(val)) return 'error'; | ||
var constructorName = ctorName(val); | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName; | ||
} // other | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName; | ||
} // other | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); | ||
} | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
function isError(val) { | ||
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; | ||
} | ||
function isError(val) { | ||
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true; | ||
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; | ||
} | ||
function kindOf(val) { | ||
var typeOfVal = typeof val; | ||
if (process.env.NODE_ENV !== 'production') { | ||
typeOfVal = miniKindOf(val); | ||
@@ -121,25 +121,25 @@ } | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* @deprecated | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* **We recommend using the `configureStore` method | ||
* of the `@reduxjs/toolkit` package**, which replaces `createStore`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* Redux Toolkit is our recommended approach for writing Redux logic today, | ||
* including store setup, reducers, data fetching, and more. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* **For more details, please read this Redux docs page:** | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* `configureStore` from Redux Toolkit is an improved version of `createStore` that | ||
* simplifies setup and helps avoid common bugs. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
* You should not be using the `redux` core package by itself today, except for learning purposes. | ||
* The `createStore` method from the core `redux` package will not be removed, but we encourage | ||
* all users to migrate to using Redux Toolkit for all Redux code. | ||
* | ||
* If you want to use `createStore` without this visual deprecation warning, use | ||
* the `legacy_createStore` import instead: | ||
* | ||
* `import { legacy_createStore as createStore} from 'redux'` | ||
* | ||
*/ | ||
@@ -394,3 +394,35 @@ | ||
} | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* | ||
* **We recommend using `configureStore` from the | ||
* `@reduxjs/toolkit` package**, which replaces `createStore`: | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
*/ | ||
var legacy_createStore = createStore; | ||
/** | ||
@@ -684,13 +716,2 @@ * Prints a warning in the console if it exists. | ||
/* | ||
* This is a dummy function to check if the function name has been altered by minification. | ||
* If the function has been minified and NODE_ENV !== 'production', warn the user. | ||
*/ | ||
function isCrushed() {} | ||
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 setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.'); | ||
} | ||
exports.__DO_NOT_USE__ActionTypes = ActionTypes; | ||
@@ -702,1 +723,2 @@ exports.applyMiddleware = applyMiddleware; | ||
exports.createStore = createStore; | ||
exports.legacy_createStore = legacy_createStore; |
{ | ||
"name": "redux", | ||
"version": "4.1.0", | ||
"version": "4.2.1", | ||
"description": "Predictable state container for JavaScript apps", | ||
@@ -82,3 +82,3 @@ "license": "MIT", | ||
"eslint-plugin-react": "^7.19.0", | ||
"eslint-plugin-react-hooks": "^3.0.0", | ||
"eslint-plugin-react-hooks": "^2.0.0", | ||
"glob": "^7.1.6", | ||
@@ -85,0 +85,0 @@ "jest": "^25.4.0", |
@@ -8,27 +8,27 @@ import $$observable from './utils/symbol-observable' | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* @deprecated | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* **We recommend using the `configureStore` method | ||
* of the `@reduxjs/toolkit` package**, which replaces `createStore`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* Redux Toolkit is our recommended approach for writing Redux logic today, | ||
* including store setup, reducers, data fetching, and more. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* **For more details, please read this Redux docs page:** | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* `configureStore` from Redux Toolkit is an improved version of `createStore` that | ||
* simplifies setup and helps avoid common bugs. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
* You should not be using the `redux` core package by itself today, except for learning purposes. | ||
* The `createStore` method from the core `redux` package will not be removed, but we encourage | ||
* all users to migrate to using Redux Toolkit for all Redux code. | ||
* | ||
* If you want to use `createStore` without this visual deprecation warning, use | ||
* the `legacy_createStore` import instead: | ||
* | ||
* `import { legacy_createStore as createStore} from 'redux'` | ||
* | ||
*/ | ||
export default function createStore(reducer, preloadedState, enhancer) { | ||
export function createStore(reducer, preloadedState, enhancer) { | ||
if ( | ||
@@ -317,1 +317,33 @@ (typeof preloadedState === 'function' && typeof enhancer === 'function') || | ||
} | ||
/** | ||
* Creates a Redux store that holds the state tree. | ||
* | ||
* **We recommend using `configureStore` from the | ||
* `@reduxjs/toolkit` package**, which replaces `createStore`: | ||
* **https://redux.js.org/introduction/why-rtk-is-redux-today** | ||
* | ||
* The only way to change the data in the store is to call `dispatch()` on it. | ||
* | ||
* There should only be a single store in your app. To specify how different | ||
* parts of the state tree respond to actions, you may combine several reducers | ||
* into a single reducer function by using `combineReducers`. | ||
* | ||
* @param {Function} reducer A function that returns the next state tree, given | ||
* the current state tree and the action to handle. | ||
* | ||
* @param {any} [preloadedState] The initial state. You may optionally specify it | ||
* to hydrate the state from the server in universal apps, or to restore a | ||
* previously serialized user session. | ||
* If you use `combineReducers` to produce the root reducer function, this must be | ||
* an object with the same shape as `combineReducers` keys. | ||
* | ||
* @param {Function} [enhancer] The store enhancer. You may optionally specify it | ||
* to enhance the store with third-party capabilities such as middleware, | ||
* time travel, persistence, etc. The only store enhancer that ships with Redux | ||
* is `applyMiddleware()`. | ||
* | ||
* @returns {Store} A Redux store that lets you read the state, dispatch actions | ||
* and subscribe to changes. | ||
*/ | ||
export const legacy_createStore = createStore |
@@ -1,2 +0,2 @@ | ||
import createStore from './createStore' | ||
import { createStore, legacy_createStore } from './createStore' | ||
import combineReducers from './combineReducers' | ||
@@ -6,27 +6,7 @@ import bindActionCreators from './bindActionCreators' | ||
import compose from './compose' | ||
import warning from './utils/warning' | ||
import __DO_NOT_USE__ActionTypes from './utils/actionTypes' | ||
/* | ||
* This is a dummy function to check if the function name has been altered by minification. | ||
* If the function has been minified and NODE_ENV !== 'production', warn the user. | ||
*/ | ||
function isCrushed() {} | ||
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 setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + | ||
'to ensure you have the correct code for your production build.' | ||
) | ||
} | ||
export { | ||
createStore, | ||
legacy_createStore, | ||
combineReducers, | ||
@@ -33,0 +13,0 @@ bindActionCreators, |
@@ -1,66 +0,66 @@ | ||
export function kindOf(val) { | ||
let typeOfVal = typeof val | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined' | ||
if (val === null) return 'null' | ||
if (process.env.NODE_ENV !== 'production') { | ||
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of | ||
function miniKindOf(val) { | ||
if (val === void 0) return 'undefined' | ||
if (val === null) return 'null' | ||
const type = typeof val | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': { | ||
return type | ||
} | ||
default: | ||
break | ||
} | ||
const type = typeof val | ||
switch (type) { | ||
case 'boolean': | ||
case 'string': | ||
case 'number': | ||
case 'symbol': | ||
case 'function': { | ||
return type | ||
} | ||
default: | ||
break | ||
} | ||
if (Array.isArray(val)) return 'array' | ||
if (isDate(val)) return 'date' | ||
if (isError(val)) return 'error' | ||
if (Array.isArray(val)) return 'array' | ||
if (isDate(val)) return 'date' | ||
if (isError(val)) return 'error' | ||
const constructorName = ctorName(val) | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName | ||
default: | ||
break | ||
} | ||
const constructorName = ctorName(val) | ||
switch (constructorName) { | ||
case 'Symbol': | ||
case 'Promise': | ||
case 'WeakMap': | ||
case 'WeakSet': | ||
case 'Map': | ||
case 'Set': | ||
return constructorName | ||
default: | ||
break | ||
} | ||
// other | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, '') | ||
} | ||
// other | ||
return type.slice(8, -1).toLowerCase().replace(/\s/g, '') | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null | ||
} | ||
function ctorName(val) { | ||
return typeof val.constructor === 'function' ? val.constructor.name : null | ||
} | ||
function isError(val) { | ||
return ( | ||
val instanceof Error || | ||
(typeof val.message === 'string' && | ||
val.constructor && | ||
typeof val.constructor.stackTraceLimit === 'number') | ||
) | ||
} | ||
function isError(val) { | ||
return ( | ||
val instanceof Error || | ||
(typeof val.message === 'string' && | ||
val.constructor && | ||
typeof val.constructor.stackTraceLimit === 'number') | ||
) | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true | ||
return ( | ||
typeof val.toDateString === 'function' && | ||
typeof val.getDate === 'function' && | ||
typeof val.setDate === 'function' | ||
) | ||
} | ||
function isDate(val) { | ||
if (val instanceof Date) return true | ||
return ( | ||
typeof val.toDateString === 'function' && | ||
typeof val.getDate === 'function' && | ||
typeof val.setDate === 'function' | ||
) | ||
} | ||
export function kindOf(val) { | ||
let typeOfVal = typeof val | ||
if (process.env.NODE_ENV !== 'production') { | ||
typeOfVal = miniKindOf(val) | ||
@@ -67,0 +67,0 @@ } |
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
175632
3343
46
21