UNPKG

@codeque/core

Version:

Multiline code search for every language. Structural code search for JavaScript, TypeScript, HTML and CSS

30 lines (27 loc) 892 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMatchJsxIdentifierUsingIdentifierNodesComparator = void 0; /** * Support for matching JSXIdentifier using Identifier in query * Q: $$T; C: <SomeT /> // without brackets */ const createMatchJsxIdentifierUsingIdentifierNodesComparator = () => ({ fileNode, queryNode }, _, { fileKeysToTraverseForOtherMatches }) => { if (queryNode && fileNode) { if (queryNode.type === 'Identifier' && fileNode.type === 'JSXIdentifier' && queryNode.name === fileNode.name) { return { levelMatch: true, queryKeysToTraverseForValidatingMatch: [], fileKeysToTraverseForValidatingMatch: [], fileKeysToTraverseForOtherMatches }; } } }; exports.createMatchJsxIdentifierUsingIdentifierNodesComparator = createMatchJsxIdentifierUsingIdentifierNodesComparator;