@putout/compare
Advanced tools
Comparing version 14.2.0 to 14.3.0
@@ -25,2 +25,3 @@ 'use strict'; | ||
isEqualBody, | ||
isEqualFunctionDeclarationBody, | ||
isEqualNop, | ||
@@ -57,2 +58,3 @@ isLinkedNode, | ||
isEqualBody, | ||
isEqualFunctionDeclarationBody, | ||
isEqualNop, | ||
@@ -59,0 +61,0 @@ isLinkedRegExp, |
@@ -92,2 +92,9 @@ 'use strict'; | ||
const isFunctionDeclarationBody = (a) => { | ||
if (isBody(a)) | ||
return true; | ||
return isBlockStatement(a) && isBody(a.body[0].expression); | ||
}; | ||
const isNop = (a) => isIdentifier(a, { | ||
@@ -134,2 +141,3 @@ name: NOP, | ||
}; | ||
module.exports.isAnyLiteral = (a, b) => { | ||
@@ -141,2 +149,3 @@ if (!isLiteral(b, {value: ANY})) | ||
}; | ||
module.exports.isArgs = (a) => { | ||
@@ -268,2 +277,12 @@ const b = !isArray(a) ? a : a[0]; | ||
module.exports.isEqualFunctionDeclarationBody = (node, templateNode) => { | ||
if (!node) | ||
return false; | ||
if (!isFunctionDeclarationBody(templateNode)) | ||
return false; | ||
return node.type === 'BlockStatement'; | ||
}; | ||
module.exports.isEqualNop = (node, templateNode) => { | ||
@@ -270,0 +289,0 @@ if (!isNop(templateNode)) |
{ | ||
"name": "@putout/compare", | ||
"version": "14.2.0", | ||
"version": "14.3.0", | ||
"type": "commonjs", | ||
@@ -41,4 +41,4 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
"c8": "^9.0.0", | ||
"eslint": "^9.0.0-alpha.0", | ||
"eslint-plugin-n": "^17.0.0-0", | ||
"eslint": "^9.0.0", | ||
"eslint-plugin-n": "^17.0.0", | ||
"eslint-plugin-putout": "^22.0.0", | ||
@@ -45,0 +45,0 @@ "just-camel-case": "^4.0.2", |
@@ -186,2 +186,6 @@ # @putout/compare [![NPM version][NPMIMGURL]][NPMURL] | ||
true; | ||
compare('function a(b) {return b;}', 'function __(__args) {__body}'); | ||
// returns | ||
true; | ||
``` | ||
@@ -188,0 +192,0 @@ |
28776
717
263