add isUser and isGenerated path methods
This commit is contained in:
parent
2621081a13
commit
2fbb3cad9f
@ -125,6 +125,22 @@ export default class TraversalPath {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this node was a part of the original AST.
|
||||||
|
*/
|
||||||
|
|
||||||
|
isUser() {
|
||||||
|
return this.node && !!this.node.loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this node was generated by us and not a part of the original AST.
|
||||||
|
*/
|
||||||
|
|
||||||
|
isGenerated() {
|
||||||
|
return !this.isUser();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description
|
* Description
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user