@putout/compare
Advanced tools
Comparing version 8.1.0 to 8.2.0
@@ -32,2 +32,3 @@ 'use strict'; | ||
const {keys} = Object; | ||
const {isArray} = Array; | ||
@@ -37,2 +38,3 @@ const compareType = (type) => (path) => path.type === type; | ||
const superPush = (array) => (a, b) => array.push([a, b]); | ||
const maybeArray = (a) => isArray(a) ? a : [a]; | ||
@@ -115,2 +117,4 @@ const findParent = (path, type) => { | ||
module.exports.compareAll = (path, templateNodes) => { | ||
templateNodes = maybeArray(templateNodes); | ||
for (const template of templateNodes) { | ||
@@ -117,0 +121,0 @@ if (!compare(path, template)) |
{ | ||
"name": "@putout/compare", | ||
"version": "8.1.0", | ||
"version": "8.2.0", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -42,3 +42,3 @@ "description": "compare ast-nodes", | ||
"c8": "^7.5.0", | ||
"eslint": "^8.0.0-beta.0", | ||
"eslint": "^8.0.1", | ||
"eslint-plugin-node": "^11.0.0", | ||
@@ -45,0 +45,0 @@ "eslint-plugin-putout": "^10.0.0", |
@@ -38,3 +38,3 @@ # @putout/compare [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] | ||
### compare (node, baseNode) | ||
### compare(node: Node, baseNode: Node) | ||
@@ -44,2 +44,4 @@ - `node` - `AST-node` or `code` that will be generated; | ||
### compareAll(node: Node, baseNodes: Node|Nodes[]) | ||
#### Supported template variables: | ||
@@ -46,0 +48,0 @@ |
21472
535
187