Socket
Socket
Sign inDemoInstall

gulp-decomment

Package Overview
Dependencies
58
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.1.0

46

index.js
'use strict';
var through = require('through2');
var gutil = require('gulp-util');
var decomment = require('decomment');
var PluginError = gutil.PluginError;
var PluginError = require('gulp-util').PluginError;
var PLUGIN_NAME = 'gulp-decomment';
function gulpDecomment() {
var stream = through.obj(function (file, enc, cb) {
function main(options, func) {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {

@@ -18,32 +13,23 @@ cb(null, file);

}
if (file.isStream()) {
cb(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
return;
cb(new PluginError("gulp-decomment", "Streaming not supported."));
}
/*
if (noopt || (!block && !line)) {
strip = stripComments;
} else if (block && line) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Please choose either block or line, not both!'));
} else if (block) {
strip = stripComments.block;
} else if (line) {
strip = stripComments.line;
} else {
this.emit('error', new PluginError(PLUGIN_NAME, 'Please define options correctly'));
}
*/
if (file.isBuffer()) {
file.contents = new Buffer(decomment(file.contents.toString()));
}
file.contents = new Buffer(func(file.contents.toString(), options));
this.push(file);
return cb();
});
}
return stream;
function gulpDecomment(options) {
return main(options, decomment);
}
gulpDecomment.text = function (options) {
return main(options, decomment.text);
};
gulpDecomment.html = function (options) {
return main(options, decomment.html);
};
module.exports = gulpDecomment;
{
"name": "gulp-decomment",
"version": "0.0.1",
"description": "Removes comments from JSON or JavaScript.",
"main": "lib/index.js",
"version": "0.1.0",
"description": "Removes comments from JSON, JavaScript, CSS, HTML, etc.",
"scripts": {

@@ -12,5 +11,14 @@ "test": "jasmine-node test",

"files": [
"test",
"index.js"
],
"dependencies": {
"decomment": "0.7",
"gulp-util": "3.0",
"through2": "2.0"
},
"devDependencies": {
"coveralls": "2.x",
"istanbul": "0.4",
"jasmine-node": "1.x"
},
"homepage": "https://github.com/vitaly-t/gulp-decomment",

@@ -28,3 +36,6 @@ "repository": {

"JavaScript",
"JSON"
"JSON",
"CSS",
"HTML",
"Text"
],

@@ -35,14 +46,3 @@ "author": {

},
"license": "MIT",
"engines": {
"node": ">=0.10",
"npm": ">=1.4"
},
"dependencies": {
},
"devDependencies": {
"coveralls": "2.x",
"istanbul": "0.4",
"jasmine-node": "1.x"
}
"license": "MIT"
}
gulp-decomment
==============
Removes comments from JSON or JavaScript.
Uses [decomment] to remove comments from JSON, JavaScript, CSS, HTML, etc.
**This library is currently under development.**
[![Build Status](https://travis-ci.org/vitaly-t/gulp-decomment.svg?branch=master)](https://travis-ci.org/vitaly-t/gulp-decomment)
[![Coverage Status](https://coveralls.io/repos/vitaly-t/gulp-decomment/badge.svg?branch=master)](https://coveralls.io/r/vitaly-t/gulp-decomment?branch=master)
## Installing
```
$ npm install gulp-decomment
```
## Testing
```
$ npm test
```
Testing with coverage:
```
$ npm run coverage
```
## Usage
```js
var gulp = require('gulp');
var decomment = require('gulp-decomment');
gulp.task('default', function () {
return gulp.src('input.js')
.pipe(decomment())
.pipe(gulp.dest('dest'));
});
```
## API
Available methods, according to [decomment API](https://github.com/vitaly-t/decomment#api):
* [decomment([options])](https://github.com/vitaly-t/decomment#decommentcode-options--string)
* [decomment.text([options])](https://github.com/vitaly-t/decomment#decommenttexttext-options--string)
* [decomment.html([options])](https://github.com/vitaly-t/decomment#decommenthtmlhtml-options--string)
## License
Copyright © 2016 [Vitaly Tomilov](https://github.com/vitaly-t);
Released under the MIT license.
[decomment]:https://github.com/vitaly-t/decomment
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc