@putout/compare
Advanced tools
Comparing version 9.12.1 to 9.13.0
@@ -29,2 +29,3 @@ 'use strict'; | ||
isJSXText, | ||
isTemplateElement, | ||
} = require('@babel/types'); | ||
@@ -38,2 +39,3 @@ | ||
const comparators = [ | ||
compareTemplateElements, | ||
compareJSXTexts, | ||
@@ -93,2 +95,13 @@ compareAny, | ||
function compareTemplateElements(node, template) { | ||
if (!isTemplateElement(node) || !isTemplateElement(template)) | ||
return false; | ||
const isValue = node.value.raw === template.value.raw; | ||
const isCooked = node.value.cooked === template.value.cooked; | ||
const isTail = node.tail === template.tail; | ||
return isValue && isCooked && isTail; | ||
} | ||
function linkNodes(node, template, {add, templateStore}) { | ||
@@ -95,0 +108,0 @@ if (node && isLinkedNode(template) || isLinkedArgs(template) || isLinkedId(node, template)) |
@@ -7,2 +7,3 @@ 'use strict'; | ||
isStringLiteral, | ||
isTemplateElement, | ||
} = require('@babel/types'); | ||
@@ -19,2 +20,5 @@ | ||
return value; | ||
if (isTemplateElement(node)) | ||
return node.value.cooked; | ||
}; | ||
@@ -21,0 +25,0 @@ |
@@ -12,2 +12,5 @@ 'use strict'; | ||
isJSXElement, | ||
isLiteral, | ||
isTemplateLiteral, | ||
TemplateElement, | ||
} = require('@babel/types'); | ||
@@ -126,2 +129,8 @@ | ||
if (isLiteral(values[name]) && isTemplateLiteral(node)) { | ||
const {value} = values[name]; | ||
nessy(way, TemplateElement({raw: value}), node); | ||
continue; | ||
} | ||
nessy(way, values[name], node); | ||
@@ -128,0 +137,0 @@ } |
{ | ||
"name": "@putout/compare", | ||
"version": "9.12.1", | ||
"version": "9.13.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", |
25477
614