Comparing version 0.3.8 to 0.3.9
@@ -6,2 +6,3 @@ 'use strict'; | ||
var duplex = require('duplexer2'); | ||
var through = require('through2'); | ||
@@ -19,5 +20,12 @@ var gs = require('glob-stream'); | ||
function src(glob, opt) { | ||
var pass = through.obj(); | ||
if (!isValidGlob(glob)) { | ||
throw new Error('Invalid glob argument: ' + glob); | ||
} | ||
// return dead stream if empty array | ||
if (Array.isArray(glob) && glob.length === 0) { | ||
process.nextTick(pass.end.bind(pass)); | ||
return pass; | ||
} | ||
@@ -41,4 +49,5 @@ var options = defaults({}, opt, { | ||
return outputStream | ||
.pipe(through.obj()); | ||
outputStream = outputStream.pipe(pass); | ||
return duplex(pass, outputStream); | ||
} | ||
@@ -51,2 +60,5 @@ | ||
if (Array.isArray(glob) && glob.length !== 0) { | ||
return glob.every(isValidGlob); | ||
} | ||
if (Array.isArray(glob) && glob.length === 0) { | ||
return true; | ||
@@ -53,0 +65,0 @@ } |
{ | ||
"name": "vinyl-fs", | ||
"description": "Vinyl adapter for the file system", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"homepage": "http://github.com/wearefractal/vinyl-fs", | ||
@@ -10,2 +10,3 @@ "repository": "git://github.com/wearefractal/vinyl-fs.git", | ||
"dependencies": { | ||
"duplexer2": "0.0.2", | ||
"glob-stream": "^3.1.5", | ||
@@ -12,0 +13,0 @@ "glob-watcher": "^0.0.6", |
@@ -29,3 +29,3 @@ var spies = require('./spy'); | ||
try { | ||
stream = gulp.src(); | ||
stream = vfs.src(); | ||
} catch (err) { | ||
@@ -41,3 +41,3 @@ should.exist(err); | ||
try { | ||
stream = gulp.src(123); | ||
stream = vfs.src(123); | ||
} catch (err) { | ||
@@ -50,11 +50,8 @@ should.exist(err); | ||
it('should explode on invalid glob (empty array)', function(done) { | ||
var stream; | ||
try { | ||
stream = gulp.src([]); | ||
} catch (err) { | ||
should.exist(err); | ||
should.not.exist(stream); | ||
it('should not explode on invalid glob (empty array)', function(done) { | ||
var stream = vfs.src([]); | ||
stream.once('data', done); | ||
stream.once('end', function(){ | ||
done(); | ||
} | ||
}); | ||
}); | ||
@@ -61,0 +58,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42930
1015
9
+ Addedduplexer2@0.0.2
+ Addedduplexer2@0.0.2(transitive)
+ Addedreadable-stream@1.1.14(transitive)