@putout/compare
Advanced tools
Comparing version 10.0.0 to 10.1.0
@@ -5,2 +5,3 @@ 'use strict'; | ||
const link = require('./link'); | ||
const { | ||
@@ -26,2 +27,3 @@ is, | ||
} = require('./is'); | ||
const { | ||
@@ -67,6 +69,3 @@ isClassBody, | ||
for (const compare of comparators) { | ||
if (compare(node, template, { | ||
add, | ||
templateStore, | ||
})) { | ||
if (compare(node, template, {add, templateStore})) { | ||
return true; | ||
@@ -134,2 +133,1 @@ } | ||
} | ||
@@ -28,2 +28,3 @@ 'use strict'; | ||
isLinkedNode, | ||
isLinkedId, | ||
isEqualNop, | ||
@@ -104,2 +105,5 @@ isTemplate, | ||
if (isLinkedId(node, templateNode)) | ||
return true; | ||
if (isStringLiteral(node) && isLinkedNode(templateNode)) | ||
@@ -142,2 +146,3 @@ return true; | ||
}; | ||
// @babel/template creates empty array directives | ||
@@ -194,2 +199,1 @@ // extra duplicate value | ||
} | ||
'use strict'; | ||
const {template} = require('@putout/engine-parser'); | ||
const { | ||
@@ -107,5 +108,16 @@ isBlockStatement, | ||
module.exports.isAny = (a) => { | ||
return isIdentifier(a, {name: ANY}) || isJSXText(a, {value: ANY}); | ||
if (isIdentifier(a, {name: ANY})) | ||
return true; | ||
if (isJSXText(a, {value: ANY})) | ||
return true; | ||
return false; | ||
}; | ||
module.exports.isAnyLiteral = (a, b) => isLiteral(b, {value: ANY}) && isEqualType(a, b); | ||
module.exports.isAnyLiteral = (a, b) => { | ||
if (!isLiteral(b, {value: ANY})) | ||
return false; | ||
return isEqualType(a, b); | ||
}; | ||
module.exports.isArgs = (a) => { | ||
@@ -199,2 +211,3 @@ const b = !isArray(a) ? a : a[0]; | ||
const {type} = node; | ||
return __ARRAY_TYPE.includes(type); | ||
@@ -208,2 +221,3 @@ }; | ||
const {type} = node; | ||
return __OBJECT_TYPE.includes(type); | ||
@@ -270,2 +284,1 @@ }; | ||
}; | ||
@@ -12,3 +12,6 @@ 'use strict'; | ||
node = node[0] || node; | ||
const {name, value} = node; | ||
const { | ||
name, | ||
value, | ||
} = node; | ||
@@ -40,2 +43,1 @@ if (isIdentifier(node)) | ||
}; | ||
@@ -21,3 +21,7 @@ 'use strict'; | ||
if (isArray(a) && a[0]) { | ||
const [{type, name, value}] = a; | ||
const [{ | ||
type, | ||
name, | ||
value, | ||
}] = a; | ||
return `${type}: ["${name || value}"]`; | ||
@@ -38,2 +42,1 @@ } | ||
} | ||
@@ -7,4 +7,8 @@ 'use strict'; | ||
const {template} = require('@putout/engine-parser'); | ||
const {replaceWith, extract} = require('@putout/operate'); | ||
const { | ||
replaceWith, | ||
extract, | ||
} = require('@putout/operate'); | ||
const { | ||
isIdentifier, | ||
@@ -96,3 +100,2 @@ isStatement, | ||
way = way.replace(/\.0.local$/, ''); | ||
else if (isArgsStr(name) || isJSXChildrenStr(name) || isJSXAttributesStr(name)) | ||
@@ -134,2 +137,3 @@ way = way.replace(/\.0$/, ''); | ||
const {value} = values[name]; | ||
const element = TemplateElement({ | ||
@@ -147,2 +151,1 @@ raw: makeRaw(value), | ||
} | ||
{ | ||
"name": "@putout/compare", | ||
"version": "10.0.0", | ||
"version": "10.1.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", |
@@ -33,3 +33,2 @@ # @putout/compare [![NPM version][NPMIMGURL]][NPMURL] | ||
type: 'ArrayPattern', | ||
//...etc | ||
}, | ||
@@ -36,0 +35,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25870
636
237