@putout/compare
Advanced tools
Comparing version 9.10.0 to 9.11.0
@@ -14,2 +14,3 @@ 'use strict'; | ||
isJSXChildren, | ||
isJSXAttributes, | ||
isLinkedArgs, | ||
@@ -54,2 +55,3 @@ isLinkedId, | ||
second(isJSXChildren), | ||
second(isJSXAttributes), | ||
addObject, | ||
@@ -56,0 +58,0 @@ compareArrays, |
@@ -14,2 +14,4 @@ 'use strict'; | ||
isJSXText, | ||
isJSXIdentifier, | ||
isJSXAttribute, | ||
} = require('@babel/types'); | ||
@@ -25,2 +27,3 @@ | ||
const JSX_CHILDREN = '__jsx_children'; | ||
const JSX_ATTRIBUTES = '__jsx_attributes'; | ||
const NOP = '__nop'; | ||
@@ -39,2 +42,3 @@ const ANY = '__'; | ||
JSX_CHILDREN, | ||
JSX_ATTRIBUTES, | ||
IMPORTS, | ||
@@ -129,2 +133,11 @@ BODY, | ||
module.exports.isJSXAttributes = (a) => { | ||
if (!isJSXAttribute(a)) | ||
return false; | ||
return isJSXIdentifier(a.name, { | ||
name: JSX_ATTRIBUTES, | ||
}); | ||
}; | ||
module.exports.isLinkedId = (a, b) => { | ||
@@ -229,2 +242,5 @@ if (!isIdentifier(b) || !LINKED_ID.test(b.name)) | ||
if (isJSXIdentifier(a) && LINKED_NODE.test(a.name)) | ||
return true; | ||
if (isTemplateElement(a) && LINKED_NODE.test(a.value.raw)) | ||
@@ -231,0 +247,0 @@ return true; |
@@ -57,3 +57,3 @@ 'use strict'; | ||
noScope: true, | ||
'Identifier|StringLiteral|TemplateElement|RegExpLiteral|JSXText'(path) { | ||
'Identifier|StringLiteral|TemplateElement|RegExpLiteral|JSXText|JSXAttribute'(path) { | ||
const {node} = path; | ||
@@ -60,0 +60,0 @@ const way = []; |
{ | ||
"name": "@putout/compare", | ||
"version": "9.10.0", | ||
"version": "9.11.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", |
@@ -191,2 +191,13 @@ # @putout/compare [![NPM version][NPMIMGURL]][NPMURL] | ||
##### __jsx_attributes | ||
Any count of attributes of `JSXElement`: | ||
```js | ||
compare('<div hello="world"></div>', '<__a __jsx_attributes/>'); | ||
// returns | ||
true; | ||
``` | ||
##### __nop | ||
@@ -193,0 +204,0 @@ |
24483
590
239