add NodePath#addComment method
This commit is contained in:
parent
e91e10aae6
commit
ede6237b6f
@ -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.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user