From ede6237b6ffb343e48a765df2cd53d8e29aa17b6 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sun, 7 Jun 2015 23:35:46 +0100 Subject: [PATCH] add NodePath#addComment method --- src/babel/traversal/path/removal.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/babel/traversal/path/removal.js b/src/babel/traversal/path/removal.js index 35b3afcbf1..8521ca5246 100644 --- a/src/babel/traversal/path/removal.js +++ b/src/babel/traversal/path/removal.js @@ -58,6 +58,20 @@ export function _assertUnremoved() { } } +/** + * Description + */ + +export function addComment(type, content) { + var node = this.node; + var key = `${type}Comments`; + var comments = node[key] = node[key] || []; + comments.push({ + type: "CommentBlock", + value: content + }); +} + /** * Share comments amongst siblings. */