Files
enviPy-bayer/static/js/ketcher2/node_modules/gulp-cond/src/index.js
2025-06-23 20:13:54 +02:00

21 lines
495 B
JavaScript

var Stream = require('readable-stream');
var PLUGIN_NAME = 'gulp-cond';
function gulpCond(condition, expr1, expr2) {
var value = 'function' == typeof condition ? condition() : condition;
var outStream;
if(value) {
outStream = 'function' == typeof expr1 ? expr1() : expr1;
} else if(expr2) {
outStream = 'function' == typeof expr2 ? expr2() : expr2;
} else {
outStream = new Stream.PassThrough({objectMode: true});
}
return outStream;
};
module.exports = gulpCond;