Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wearefractal/vinyl-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Jul 2, 2015
2 parents 5af3ed8 + b0295b1 commit 1b7322d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
14 changes: 1 addition & 13 deletions lib/src/index.js
Expand Up @@ -8,6 +8,7 @@ var duplexify = require('duplexify');
var merge = require('merge-stream');
var sourcemaps = require('gulp-sourcemaps');
var filterSince = require('vinyl-filter-since');
var isValidGlob = require('is-valid-glob');

var getContents = require('./getContents');
var resolveSymlinks = require('./resolveSymlinks');
Expand Down Expand Up @@ -66,17 +67,4 @@ function src(glob, opt) {
return outputStream;
}

function isValidGlob(glob) {
if (typeof glob === 'string') {
return true;
}
if (!Array.isArray(glob)) {
return false;
}
if (glob.length !== 0) {
return glob.every(isValidGlob);
}
return true;
}

module.exports = src;
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -16,6 +16,7 @@
"glob-watcher": "^2.0.0",
"graceful-fs": "^3.0.0",
"gulp-sourcemaps": "^1.5.2",
"is-valid-glob": "^0.1.0",
"merge-stream": "^0.1.7",
"mkdirp": "^0.5.0",
"object-assign": "^2.0.0",
Expand Down
12 changes: 12 additions & 0 deletions test/src.js
Expand Up @@ -41,6 +41,18 @@ describe('source stream', function() {
}
});

it('should explode on invalid glob (nested array)', function(done) {
var stream;
try {
stream = vfs.src([['./fixtures/*.coffee']]);
} catch (err) {
should.exist(err);
should.not.exist(stream);
err.message.should.containEql('Invalid glob argument');
done();
}
});

it('should not explode on invalid glob (empty array)', function(done) {
var stream = vfs.src([]);
stream.once('data', done);
Expand Down

0 comments on commit 1b7322d

Please sign in to comment.