add isUser and isGenerated path methods

This commit is contained in:
Sebastian McKenzie 2015-05-08 00:23:28 +01:00
parent 2621081a13
commit 2fbb3cad9f

View File

@ -125,6 +125,22 @@ export default class TraversalPath {
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
*/