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/getMembers.js
/**
 * Given a "nested" Member/CallExpression, e.g.
 *
 * foo.bar()[baz][42]
 *
 * this returns a list of "members". In this example it would be something like
 * [
 *   {path: NodePath<bar>, arguments: NodePath<empty>, computed: false},
 *   {path: NodePath<baz>, arguments: null, computed: true},
 *   {path: NodePath<42>, arguments: null, computed: false}
 * ]
 */
export default function getMembers(path, includeRoot = false) {
    const result = [];
    let argumentPaths = [];
    let resultPath = path;
    // eslint-disable-next-line no-constant-condition
    while (true) {
        if (resultPath.isMemberExpression()) {
            const property = resultPath.get('property');
            result.push({
                path: property,
                computed: resultPath.node.computed,
                argumentPaths,
            });
            argumentPaths = [];
            resultPath = resultPath.get('object');
        }
        else if (resultPath.isCallExpression()) {
            const callee = resultPath.get('callee');
            if (callee.isExpression()) {
                argumentPaths = resultPath.get('arguments');
                resultPath = callee;
            }
            else {
                break;
            }
        }
        else {
            break;
        }
    }
    if (includeRoot && result.length > 0) {
        result.push({
            path: resultPath,
            computed: false,
            argumentPaths,
        });
    }
    return result.reverse();
}