Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-comments

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-comments - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

19

lib/index.js

@@ -6,5 +6,5 @@ "use strict";

function filterComments(list, path, type) {
function filterComments(list, path, remove) {
return list.filter(function (o) {
return o.type.toLowerCase() !== type.toLowerCase();
return o.type.toLowerCase() !== remove.toLowerCase();
});

@@ -20,5 +20,6 @@ }

var _ref2 = _temp === void 0 ? {} : _temp,
_ref2$opts$type = _ref2.opts.type,
type = _ref2$opts$type === void 0 ? 'all' : _ref2$opts$type;
_ref2$opts$remove = _ref2.opts.remove,
remove = _ref2$opts$remove === void 0 ? 'all' : _ref2$opts$remove;
if (remove === 'none') return;
path.traverse({

@@ -30,11 +31,7 @@ enter: function enter(path) {

if (leadingCommentsList.length > 0 || trailingCommentsList.length > 0) {
if (type === 'none') return;
if (type === 'all') {
if (remove === 'all') {
t.removeComments(path.node);
} else {
// t.removeComments是清空全部注释,并不能区分去掉哪种注释
// t.removeComments(path.node);
path.node.leadingComments = filterComments(leadingCommentsList, path, type);
path.node.trailingComments = filterComments(trailingCommentsList, path, type);
path.node.leadingComments = filterComments(leadingCommentsList, path, remove);
path.node.trailingComments = filterComments(trailingCommentsList, path, remove);
}

@@ -41,0 +38,0 @@ }

{
"name": "babel-plugin-comments",
"version": "1.0.1",
"version": "1.0.2",
"description": "It's a babel plugin for remove comments.",

@@ -30,2 +30,3 @@ "main": "./lib/index.js",

"babel-jest": "^23.6.0",
"babel-plugin-comments": "^1.0.1",
"eslint": "^5.11.1",

@@ -32,0 +33,0 @@ "eslint-plugin-import": "^2.14.0",

@@ -26,3 +26,3 @@ babel-plugin-comments

**all** : all comments will be removed;
**all** (default): all comments will be removed;

@@ -29,0 +29,0 @@ **CommentLine** : commentline will be removed(such as: ```//example```)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc