mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/RoboCommander.git
synced 2026-06-18 15:16:09 +00:00
Initial commit
This commit is contained in:
49
node_modules/react-redux/src/connect/mergeProps.js
generated
vendored
Normal file
49
node_modules/react-redux/src/connect/mergeProps.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import verifyPlainObject from '../utils/verifyPlainObject'
|
||||
|
||||
export function defaultMergeProps(stateProps, dispatchProps, ownProps) {
|
||||
return { ...ownProps, ...stateProps, ...dispatchProps }
|
||||
}
|
||||
|
||||
export function wrapMergePropsFunc(mergeProps) {
|
||||
return function initMergePropsProxy(
|
||||
dispatch, { displayName, pure, areMergedPropsEqual }
|
||||
) {
|
||||
let hasRunOnce = false
|
||||
let mergedProps
|
||||
|
||||
return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
|
||||
const nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps)
|
||||
|
||||
if (hasRunOnce) {
|
||||
if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps))
|
||||
mergedProps = nextMergedProps
|
||||
|
||||
} else {
|
||||
hasRunOnce = true
|
||||
mergedProps = nextMergedProps
|
||||
|
||||
if (process.env.NODE_ENV !== 'production')
|
||||
verifyPlainObject(mergedProps, displayName, 'mergeProps')
|
||||
}
|
||||
|
||||
return mergedProps
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function whenMergePropsIsFunction(mergeProps) {
|
||||
return (typeof mergeProps === 'function')
|
||||
? wrapMergePropsFunc(mergeProps)
|
||||
: undefined
|
||||
}
|
||||
|
||||
export function whenMergePropsIsOmitted(mergeProps) {
|
||||
return (!mergeProps)
|
||||
? () => defaultMergeProps
|
||||
: undefined
|
||||
}
|
||||
|
||||
export default [
|
||||
whenMergePropsIsFunction,
|
||||
whenMergePropsIsOmitted
|
||||
]
|
||||
Reference in New Issue
Block a user