refactor: switch ancestory/descendant logic [skip ci]
- Ref https://github.com/babel/babel/pull/4836#discussion_r88118790 @jridgewell
This commit is contained in:
parent
55a47a8819
commit
4462d59acd
@ -179,14 +179,14 @@ export function getAncestry() {
|
||||
* A helper to find if `this` path is an ancestor of @param maybeDescendant
|
||||
*/
|
||||
export function isAncestor(maybeDescendant) {
|
||||
return !!maybeDescendant.findParent((parent) => parent === this);
|
||||
return maybeDescendant.isDescendant(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper to find if `this` path is a descendant of @param maybeAncestor
|
||||
*/
|
||||
export function isDescendant(maybeAncestor) {
|
||||
return maybeAncestor.isAncestor(this);
|
||||
return !!this.findParent((parent) => parent === maybeAncestor);
|
||||
}
|
||||
|
||||
export function inType() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user