Skip to content

Commit

Permalink
Avoid isIdentifier() crash on null/undefined values (#778)
Browse files Browse the repository at this point in the history
* Avoid isIdentifier() crash on null/undefined values

* Create gold-candles-sing.md

Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
  • Loading branch information
developit and JoviDeCroock authored Jul 24, 2021
1 parent a1d5f7e commit fd94818
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gold-candles-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wmr": patch
---

Avoid isIdentifier() crash on null/undefined values
2 changes: 1 addition & 1 deletion packages/wmr/src/lib/acorn-traverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ const TYPES = {
/** @type {(a:Node,b?:Node)=>boolean} */
isIdentifier(a, b) {
if (a instanceof Path) a = a.node;
if (a.type !== 'Identifier') return false;
if (!a || a.type !== 'Identifier') return false;
return !b || TYPES.isNodesEquivalent(a, b);
},
react: {
Expand Down

0 comments on commit fd94818

Please sign in to comment.