![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
gulp-custom-filter
Advanced tools
A gulp plugin to filter files by customized filters.
$ npm install --save-dev gulp-custom-filter
var filter = require('gulp-custom-filter');
var gulp = require('gulp');
var less = require('gulp-less');
function myFilter(file) {
return file.basename.startsWith('my_');
}
gulp.task('less', function() {
return gulp.src('./less/**/*.less')
.pipe(filter(myFilter))
.pipe(less())
.pipe(gulp.dest('./css')
});
This is equivalent to:
var filter = require('gulp-custom-filter');
var gulp = require('gulp');
var less = require('gulp-less');
gulp.task('less', function() {
return gulp.src('./less/**/my_*.less')
.pipe(less())
.pipe(gulp.dest('./css')
});
You may set any predicate function to a vinyl file.
Nagates filter conditions
var not = filter.not;
gulp.src('./less/**/*.less')
.pipe(filter(not(myFilter)) // will pass files which not satisfy myFilter
This filter passes less files which its name does not start with 'my_'.
Passes files which satisfy every filter conditions.
var and = filter.and;
gulp.src('./less/**/*.less')
.pipe(filter(and(myFilter1, myFilter2)) // will pass files which satisfy myFilter1 and myFilter2
Passes files which satisfy at least one of the filter conditions.
var or = filter.or;
gulp.src('./less/**/*.less')
.pipe(filter(or(myFilter1, myFilter2)) // will pass files which satisfy myFilter1 or myFilter2
Passes every files. This is equivalent function() { return true; }
var all = filter.all;
gulp.src('./less/**/*.less')
.pipe(filter(all())) // no file will be filtered out.
Passes no file. This is equivalent function() { return false; }
var none = filter.none;
gulp.src('./less/**/*.less')
.pipe(filter(none())) // no file will be passed.
Glob pattern filter for file name. Just a wrapper of minimatch.
var glob = filter.glob;
gulp.src('./**/*.*')
.pipe(filter(glob('./**/*.less'))).
pattern
: a string or an array of glob pattern.options
: optional options.Ignore list filter.
var ignore = filter.ignore;
gulp.src('./**/*.*')
.pipe(filter(ignore('.gitignore')))
filename
: filename to ignore file.gulp-custom-filter
accepts three type of predicate functions.
A predicate must have one or two argument(s).
It returns a boolean value true
/false
.
gulp.src('./**/*.*')
.pipe(filter(function(file, encode) {
return file.isBuffer();
});
To fail the predicate, just throw an error.
gulp.src('./**/*.*')
.pipe(filter(function(file, encode) {
throw new Error('error');
});
A predicate must have three arguments. The third argument is a callback function to settle a result.
Call done
with the second argument of true
/false
.
gulp.src('./**/*.*')
.pipe(filter(function(file, encode, done) {
setTimeout(function() {
done(null, file.isBuffer()); // 1st argument must be falsy.
}, 0);
});
To fail the predicate, call done
with the first argument of non-falsy value.
gulp.src('./**/*.*')
.pipe(filter(function(file, encode, done) {
setTimeout(function() {
done(new Error('error'));
}, 0);
});
A predicate must have one or two argument(s).
It returns a fulfilling promise of boolean value true
/false
.
gulp.src('./**/*.*')
.pipe(filter(function(file, encode) {
return Promise.resolve(file.isBuffer());
});
To fail the predicate, return a rejecting promise.
gulp.src('./**/*.*')
.pipe(filter(function(file, encode) {
return Promise.reject(new Error('error'));
});
v0.4.4
v0.4.3
v0.3.0
v0.2.5
FAQs
A gulp plugin to filter files by customized filters
The npm package gulp-custom-filter receives a total of 568 weekly downloads. As such, gulp-custom-filter popularity was classified as not popular.
We found that gulp-custom-filter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.