This commit is contained in:
17
node_modules/redux/src/utils/actionTypes.js
generated
vendored
Normal file
17
node_modules/redux/src/utils/actionTypes.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* These are private action types reserved by Redux.
|
||||
* For any unknown actions, you must return the current state.
|
||||
* If the current state is undefined, you must return the initial state.
|
||||
* Do not reference these action types directly in your code.
|
||||
*/
|
||||
|
||||
const randomString = () =>
|
||||
Math.random().toString(36).substring(7).split('').join('.')
|
||||
|
||||
const ActionTypes = {
|
||||
INIT: `@@redux/INIT${randomString()}`,
|
||||
REPLACE: `@@redux/REPLACE${randomString()}`,
|
||||
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`,
|
||||
}
|
||||
|
||||
export default ActionTypes
|
||||
15
node_modules/redux/src/utils/formatProdErrorMessage.js
generated
vendored
Normal file
15
node_modules/redux/src/utils/formatProdErrorMessage.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
||||
*
|
||||
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
|
||||
* during build.
|
||||
* @param {number} code
|
||||
*/
|
||||
function formatProdErrorMessage(code) {
|
||||
return (
|
||||
`Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or ` +
|
||||
'use the non-minified dev environment for full errors. '
|
||||
)
|
||||
}
|
||||
|
||||
export default formatProdErrorMessage
|
||||
14
node_modules/redux/src/utils/isPlainObject.js
generated
vendored
Normal file
14
node_modules/redux/src/utils/isPlainObject.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @param {any} obj The object to inspect.
|
||||
* @returns {boolean} True if the argument appears to be a plain object.
|
||||
*/
|
||||
export default function isPlainObject(obj) {
|
||||
if (typeof obj !== 'object' || obj === null) return false
|
||||
|
||||
let proto = obj
|
||||
while (Object.getPrototypeOf(proto) !== null) {
|
||||
proto = Object.getPrototypeOf(proto)
|
||||
}
|
||||
|
||||
return Object.getPrototypeOf(obj) === proto
|
||||
}
|
||||
70
node_modules/redux/src/utils/kindOf.js
generated
vendored
Normal file
70
node_modules/redux/src/utils/kindOf.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// other
|
||||
return type.slice(8, -1).toLowerCase().replace(/\s/g, '')
|
||||
}
|
||||
|
||||
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 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)
|
||||
}
|
||||
|
||||
return typeOfVal
|
||||
}
|
||||
3
node_modules/redux/src/utils/symbol-observable.js
generated
vendored
Normal file
3
node_modules/redux/src/utils/symbol-observable.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// Inlined version of the `symbol-observable` polyfill
|
||||
export default (() =>
|
||||
(typeof Symbol === 'function' && Symbol.observable) || '@@observable')()
|
||||
19
node_modules/redux/src/utils/warning.js
generated
vendored
Normal file
19
node_modules/redux/src/utils/warning.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Prints a warning in the console if it exists.
|
||||
*
|
||||
* @param {String} message The warning message.
|
||||
* @returns {void}
|
||||
*/
|
||||
export default function warning(message) {
|
||||
/* eslint-disable no-console */
|
||||
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
||||
console.error(message)
|
||||
}
|
||||
/* eslint-enable no-console */
|
||||
try {
|
||||
// This error was thrown as a convenience so that if you enable
|
||||
// "break on all exceptions" in your console,
|
||||
// it would pause the execution at this line.
|
||||
throw new Error(message)
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
}
|
||||
Reference in New Issue
Block a user