From ce03457b19ca4595f725d7592b1bed71c21c8559 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 13 Jun 2015 18:50:05 +0100 Subject: [PATCH] add getOpposite path method --- src/babel/traversal/path/family.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/babel/traversal/path/family.js b/src/babel/traversal/path/family.js index cfba7de496..4558abfaf9 100644 --- a/src/babel/traversal/path/family.js +++ b/src/babel/traversal/path/family.js @@ -23,6 +23,18 @@ export function getStatementParent(): ?NodePath { return path; } +/** + * Description + */ + +export function getOpposite() { + if (this.key === "left") { + return this.getSibling("right"); + } else if (this.key === "right") { + return this.getSibling("left"); + } +} + /** * Description */