HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/design.system/node_modules/react-docgen/dist/utils/resolveHOC.js
import isReactCreateClassCall from './isReactCreateClassCall.js';
import isReactForwardRefCall from './isReactForwardRefCall.js';
import resolveToValue from './resolveToValue.js';
/**
 * If the path is a call expression, it recursively resolves to the
 * rightmost argument, stopping if it finds a React.createClass call expression
 *
 * Else the path itself is returned.
 */
export default function resolveHOC(path) {
    if (path.isCallExpression() &&
        !isReactCreateClassCall(path) &&
        !isReactForwardRefCall(path)) {
        const node = path.node;
        const argumentLength = node.arguments.length;
        if (argumentLength && argumentLength > 0) {
            const args = path.get('arguments');
            const firstArg = args[0];
            // If the first argument is one of these types then the component might be the last argument
            // If there are all identifiers then we cannot figure out exactly and have to assume it is the first
            if (argumentLength > 1 &&
                (firstArg.isLiteral() ||
                    firstArg.isObjectExpression() ||
                    firstArg.isArrayExpression() ||
                    firstArg.isSpreadElement())) {
                return resolveHOC(resolveToValue(args[argumentLength - 1]));
            }
            return resolveHOC(resolveToValue(firstArg));
        }
    }
    return path;
}