Skip to content

Commit 8f8dfa3

Browse files
committed
feature: @putout/compare: __a: NumericLiteral
1 parent cb05e65 commit 8f8dfa3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/compare/lib/compare.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818
isPath,
1919
isEqualType,
2020
isTemplate,
21+
isLinkedNode,
2122
parseTemplate,
2223
} = require('./is');
2324

@@ -81,6 +82,9 @@ function compare(path, template, options = {}, equal = noop) {
8182
if (isId(node, templateNode))
8283
return true;
8384

85+
if (isLinkedNode(templateNode))
86+
return true;
87+
8488
if (node.type === template)
8589
return true;
8690

packages/compare/test/compare.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ test('compare: template var', (t) => {
200200
t.end();
201201
});
202202

203+
test('compare: template var: number', (t) => {
204+
const a = '5';
205+
const b = '__a';
206+
207+
const result = compare(a, b);
208+
209+
t.ok(result);
210+
t.end();
211+
});
212+
203213
test('compare: __object: root', (t) => {
204214
const result = compare('({})', '__object');
205215

0 commit comments

Comments
 (0)