add NodePath#addComment method

This commit is contained in:
Sebastian McKenzie 2015-06-07 23:35:46 +01:00
parent e91e10aae6
commit ede6237b6f

View File

@ -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.
*/