PHP 8.2.30
Preview: wrapMapToProps.js Size: 2.98 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/react-redux/es/connect/wrapMapToProps.js

import verifyPlainObject from '../utils/verifyPlainObject';
export function wrapMapToPropsConstant( // * Note:
//  It seems that the dispatch argument
//  could be a dispatch function in some cases (ex: whenMapDispatchToPropsIsMissing)
//  and a state object in some others (ex: whenMapStateToPropsIsMissing)
// eslint-disable-next-line no-unused-vars
getConstant) {
  return function initConstantSelector(dispatch) {
    const constant = getConstant(dispatch);

    function constantSelector() {
      return constant;
    }

    constantSelector.dependsOnOwnProps = false;
    return constantSelector;
  };
} // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args
// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine
// whether mapToProps needs to be invoked when props have changed.
//
// A length of one signals that mapToProps does not depend on props from the parent component.
// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and
// therefore not reporting its length accurately..
// TODO Can this get pulled out so that we can subscribe directly to the store if we don't need ownProps?

export function getDependsOnOwnProps(mapToProps) {
  return mapToProps.dependsOnOwnProps ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
} // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
// this function wraps mapToProps in a proxy function which does several things:
//
//  * Detects whether the mapToProps function being called depends on props, which
//    is used by selectorFactory to decide if it should reinvoke on props changes.
//
//  * On first call, handles mapToProps if returns another function, and treats that
//    new function as the true mapToProps for subsequent calls.
//
//  * On first call, verifies the first result is a plain object, in order to warn
//    the developer that their mapToProps function is not returning a valid result.
//

export function wrapMapToPropsFunc(mapToProps, methodName) {
  return function initProxySelector(dispatch, {
    displayName
  }) {
    const proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
      return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch, undefined);
    }; // allow detectFactoryAndVerify to get ownProps


    proxy.dependsOnOwnProps = true;

    proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
      proxy.mapToProps = mapToProps;
      proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
      let props = proxy(stateOrDispatch, ownProps);

      if (typeof props === 'function') {
        proxy.mapToProps = props;
        proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
        props = proxy(stateOrDispatch, ownProps);
      }

      if (process.env.NODE_ENV !== 'production') verifyPlainObject(props, displayName, methodName);
      return props;
    };

    return proxy;
  };
}

Directory Contents

Dirs: 0 × Files: 14

Name Size Perms Modified Actions
233 B lrw-r--r-- 2026-02-28 00:29:48
Edit Download
233 B lrw-r--r-- 2026-02-28 00:28:28
Edit Download
1.30 KB lrw-r--r-- 2026-02-28 00:29:54
Edit Download
714 B lrw-r--r-- 2026-02-28 00:28:34
Edit Download
1.35 KB lrw-r--r-- 2026-02-28 00:29:54
Edit Download
440 B lrw-r--r-- 2026-02-28 00:28:36
Edit Download
1.21 KB lrw-r--r-- 2026-02-28 00:29:56
Edit Download
1.23 KB lrw-r--r-- 2026-02-28 00:28:38
Edit Download
4.67 KB lrw-r--r-- 2026-02-28 00:29:58
Edit Download
3.24 KB lrw-r--r-- 2026-02-28 00:29:02
Edit Download
127 B lrw-r--r-- 2026-02-28 00:30:10
Edit Download
688 B lrw-r--r-- 2026-02-28 00:29:32
Edit Download
1.40 KB lrw-r--r-- 2026-02-28 00:30:12
Edit Download
2.98 KB lrw-r--r-- 2026-02-28 00:29:34
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).