--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
23
node_modules/gulp-if/index.js
generated
vendored
Normal file
23
node_modules/gulp-if/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
var match = require('gulp-match');
|
||||
var ternaryStream = require('ternary-stream');
|
||||
var through2 = require('through2');
|
||||
|
||||
module.exports = function (condition, trueChild, falseChild, minimatchOptions) {
|
||||
if (!trueChild) {
|
||||
throw new Error('gulp-if: child action is required');
|
||||
}
|
||||
|
||||
if (typeof condition === 'boolean') {
|
||||
// no need to evaluate the condition for each file
|
||||
// other benefit is it never loads the other stream
|
||||
return condition ? trueChild : (falseChild || through2.obj());
|
||||
}
|
||||
|
||||
function classifier (file) {
|
||||
return !!match(file, condition, minimatchOptions);
|
||||
}
|
||||
|
||||
return ternaryStream(classifier, trueChild, falseChild);
|
||||
};
|
||||
Loading…
Reference in a new issue