source: trip-planner-front/node_modules/@babel/helper-annotate-as-pure/lib/index.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 516 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = annotateAsPure;
7
8var t = require("@babel/types");
9
10const PURE_ANNOTATION = "#__PURE__";
11
12const isPureAnnotated = ({
13 leadingComments
14}) => !!leadingComments && leadingComments.some(comment => /[@#]__PURE__/.test(comment.value));
15
16function annotateAsPure(pathOrNode) {
17 const node = pathOrNode["node"] || pathOrNode;
18
19 if (isPureAnnotated(node)) {
20 return;
21 }
22
23 t.addComment(node, "leading", PURE_ANNOTATION);
24}
Note: See TracBrowser for help on using the repository browser.