How to use the putout.isObjectExpression function in putout

To help you get started, we’ve selected a few putout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coderaiser / putout / packages / plugin-remove-unused-variables / lib / get-vars / traverse.js View on Github external
return (elementsPaths) => {
        for (const elementPath of elementsPaths) {
            const {node} = elementPath;
            
            if (isObjectExpression(node))
                traverseObjExpression(elementPath.get('properties'));
        }
    };
};
github coderaiser / putout / packages / plugin-react-hooks / lib / convert-state-to-hooks / index.js View on Github external
function isInitState(path) {
    const {node} = path;
    const {
        left,
        right,
    } = node;
    
    if (!isMemberExpression(left))
        return false;
    
    if (!isThisState(left))
        return false;
    
    if (!isObjectExpression(right))
        return false;
    
    return true;
}
github coderaiser / putout / packages / plugin-remove-unused-variables / lib / get-vars / get-vars.js View on Github external
ExportDefaultDeclaration(path) {
            const declarationPath = path.get('declaration');
            const {declaration} = path.node;
            const {id} = declaration;
            
            if (id && isFunctionDeclaration(declaration))
                use(path, declaration.id.name);
            else if (isIdentifier(declaration))
                use(path, declaration.name);
            else if (id && isClassDeclaration(declaration))
                use(path, declaration.id.name);
            else if (isObjectExpression(declaration))
                traverseObj(declarationPath.get('properties'));
        },
github coderaiser / putout / packages / plugin-remove-unused-variables / lib / get-vars / traverse.js View on Github external
if (computed && isIdentifier(key)) {
                use(path, key.name);
            }
            
            if (isIdentifier(value)) {
                use(path, value.name);
                continue;
            }
            
            if (isTemplateLiteral(value)) {
                traverseTmpl(path, value.expressions);
                continue;
            }
            
            if (isObjectExpression(value)) {
                const traverseObj = traverseObjectExpression(use);
                traverseObj(path.get('value.properties'));
                continue;
            }
        }
    };
};