Skip to content

Commit

Permalink
fix: ignore raw, in order to match "foo" with 'foo'.
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed Apr 10, 2018
1 parent 2cd2cd9 commit 64d4b38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
const STOP = false;
const SKIP_BRANCH = 1;

// ignore position info
const IGNORED_KEYS = ['start', 'end', 'loc', 'location', 'locations', 'line', 'column', 'range', 'ranges'];
// ignore position info, and raw
const IGNORED_KEYS = ['start', 'end', 'loc', 'location', 'locations', 'line', 'column', 'range', 'ranges', 'raw'];

let parser = function() {
throw new Error('No parser set, you need to set parser before use astMatcher. For instance, astMatcher.setParser(esprima.parse)');
Expand Down
5 changes: 5 additions & 0 deletions spec/with-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ module.exports = function (parserName, parser) {
t.end();
});

testP('extact matches string literal without testing raw', t => {
t.deepEqual(extractTest('a("foo")', "a('foo')"), {});
t.end();
});

testP('astMatcher builds matcher', t => {
t.equal(typeof astMatcher('a(__str_a)'), 'function');
t.end();
Expand Down

0 comments on commit 64d4b38

Please sign in to comment.