Sha256: 38baf413ecc479f183df642444c77d749abfd09007fe8ef65bbe1dea70037352

Contents?: true

Size: 544 Bytes

Versions: 7

Compression:

Stored size: 544 Bytes

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = annotateAsPure;

var _t = require("@babel/types");

const {
  addComment
} = _t;
const PURE_ANNOTATION = "#__PURE__";

const isPureAnnotated = ({
  leadingComments
}) => !!leadingComments && leadingComments.some(comment => /[@#]__PURE__/.test(comment.value));

function annotateAsPure(pathOrNode) {
  const node = pathOrNode["node"] || pathOrNode;

  if (isPureAnnotated(node)) {
    return;
  }

  addComment(node, "leading", PURE_ANNOTATION);
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.16.1 test/dummy/node_modules/@babel/helper-annotate-as-pure/lib/index.js
disco_app-0.15.2 test/dummy/node_modules/@babel/helper-annotate-as-pure/lib/index.js
disco_app-0.18.4 test/dummy/node_modules/@babel/helper-annotate-as-pure/lib/index.js
disco_app-0.18.1 test/dummy/node_modules/@babel/helper-annotate-as-pure/lib/index.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@babel/helper-annotate-as-pure/lib/index.js
disco_app-0.14.0 test/dummy/node_modules/@babel/helper-annotate-as-pure/lib/index.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@babel/helper-annotate-as-pure/lib/index.js