Socket
Socket
Sign inDemoInstall

gulp-filter

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-filter - npm Package Compare versions

Comparing version 5.1.0 to 6.0.0

15

index.js

@@ -7,5 +7,4 @@ 'use strict';

module.exports = (pattern, options) => {
module.exports = (pattern, options = {}) => {
pattern = typeof pattern === 'string' ? [pattern] : pattern;
options = options || {};

@@ -16,3 +15,3 @@ if (!Array.isArray(pattern) && typeof pattern !== 'function') {

return streamfilter((file, enc, cb) => {
return streamfilter((file, encoding, callback) => {
let match;

@@ -23,3 +22,3 @@

} else {
let relPath = path.relative(file.cwd, file.path);
let relativePath = path.relative(file.cwd, file.path);

@@ -29,10 +28,10 @@ // If the path leaves the current working directory, then we need to

// by minimatch (via multimatch)
if (/^\.\.[\\/]/.test(relPath)) {
relPath = path.resolve(relPath);
if (/^\.\.[\\/]/.test(relativePath)) {
relativePath = path.resolve(relativePath);
}
match = multimatch(relPath, pattern, options).length > 0;
match = multimatch(relativePath, pattern, options).length > 0;
}
cb(!match);
callback(!match);
}, {

@@ -39,0 +38,0 @@ objectMode: true,

{
"name": "gulp-filter",
"version": "5.1.0",
"description": "Filter files in a Vinyl stream",
"license": "MIT",
"repository": "sindresorhus/gulp-filter",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && mocha"
},
"files": [
"index.js"
],
"keywords": [
"gulpplugin",
"filter",
"ignore",
"file",
"files",
"match",
"minimatch",
"glob",
"globbing"
],
"dependencies": {
"multimatch": "^2.0.0",
"plugin-error": "^0.1.2",
"streamfilter": "^1.0.5"
},
"devDependencies": {
"mocha": "*",
"vinyl": "^2.1.0",
"xo": "*"
}
"name": "gulp-filter",
"version": "6.0.0",
"description": "Filter files in a `vinyl` stream",
"license": "MIT",
"repository": "sindresorhus/gulp-filter",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && mocha"
},
"files": [
"index.js"
],
"keywords": [
"gulpplugin",
"filter",
"ignore",
"file",
"files",
"match",
"minimatch",
"glob",
"globbing",
"vinyl"
],
"dependencies": {
"multimatch": "^4.0.0",
"plugin-error": "^1.0.1",
"streamfilter": "^3.0.0"
},
"devDependencies": {
"mocha": "^6.1.4",
"vinyl": "^2.1.0",
"xo": "^0.24.0"
}
}
# gulp-filter [![Build Status](https://travis-ci.org/sindresorhus/gulp-filter.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-filter)
> Filter files in a [Vinyl](https://github.com/gulpjs/vinyl) stream
> Filter files in a [`vinyl`](https://github.com/gulpjs/vinyl) stream
Enables you to work on a subset of the original files by filtering them using glob patterns. When you're done and want all the original files back you just use the `restore` stream.
Enables you to work on a subset of the original files by filtering them using glob patterns. When you're done and want all the original files back, you just use the `restore` stream.

@@ -117,11 +117,11 @@

Returns a [transform stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) with a [.restore](#optionsrestore) property.
Returns a [transform stream](https://nodejs.org/api/stream.html#stream_class_stream_transform) with a [.restore](#optionsrestore) property.
#### pattern
Type: `string` `Array` `Function`
Type: `string | string[] | Function`
Accepts a string/array with globbing patterns which are run through [multimatch](https://github.com/sindresorhus/multimatch).
If you supply a function, you'll get a [vinyl file object](https://github.com/wearefractal/vinyl#file) as the first argument and you're expected to return a boolean of whether to include the file:
If you supply a function, you'll get a [`vinyl` file object](https://github.com/wearefractal/vinyl#file) as the first argument and you're expected to return a boolean of whether to include the file:

@@ -134,7 +134,7 @@ ```js

Type: `Object`
Type: `object`
Accepts [minimatch options](https://github.com/isaacs/minimatch#options).
Accepts [`minimatch` options](https://github.com/isaacs/minimatch#options).
*Note:* Set `dot: true` if you need to match files prefixed with a dot (e.g. `.gitignore`).
*Note:* Set `dot: true` if you need to match files prefixed with a dot, for example, `.gitignore`.

@@ -156,6 +156,1 @@ ##### restore

When the stream is a `stream.Readable`, it ends by itself, but when it's `stream.PassThrough`, you are responsible of ending the stream.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc