All files index.js

41.18% Statements 7/17
12.5% Branches 1/8
50% Functions 1/2
41.18% Lines 7/17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 291x 1x 1x   1x 1x 1x     1x                                      
var through = require('through2'),
	flowRemoveTypes = require('flow-remove-types'),
	PluginError = require('gulp-util').PluginError;
 
module.exports = function gulpFlowRemoveTypes(options) {
	Eif(!options) {
		options = {}
	}
 
	return through.obj(function (file, enc, cb) {
		var result;
		if (file.isNull()) {
			return cb(null, file);
		}
 
		if (file.isBuffer()) {
			try {
				file.contents = new Buffer(flowRemoveTypes(file.contents.toString('utf8'), options).toString());
				this.push(file);
				cb();
			}
			catch (err) {
				throw new PluginError('gulp-flow-remove-types', err);
			}
		} else if (file.isStream()) {
			throw new PluginError('gulp-flow-remove-types', 'Streams are not supported!');
		}
	});
};