UNPKG

448 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = addComments;
7
8function addComments(node, type, comments) {
9 if (!comments || !node) return node;
10 const key = `${type}Comments`;
11
12 if (node[key]) {
13 if (type === "leading") {
14 node[key] = comments.concat(node[key]);
15 } else {
16 node[key] = node[key].concat(comments);
17 }
18 } else {
19 node[key] = comments;
20 }
21
22 return node;
23}
\No newline at end of file