Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
437 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = addComments;
|
---|
| 7 |
|
---|
| 8 | function 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].push(...comments);
|
---|
| 17 | }
|
---|
| 18 | } else {
|
---|
| 19 | node[key] = comments;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | return node;
|
---|
| 23 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.