Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

matched

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matched - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

.editorconfig

39

.verbrc.md

@@ -5,2 +5,3 @@ # {%= name %} {%= badge('fury') %}

#### [Why?](#why)

@@ -10,3 +11,2 @@ ## Install

## Usage

@@ -21,8 +21,2 @@

```js
var matched = require('matched');
matched('**/*.js');
//=> ['index.js', 'test/test.js']
```
## API

@@ -34,5 +28,4 @@

See supported [globby](https//github.com/sindresorhus/globby) options.
See supported [globby](https://github.com/sindresorhus/globby) options.
### patterns

@@ -58,3 +51,3 @@

Pass an array of additional directories to exlude:
Pass an array of additional directories to exclude:

@@ -93,5 +86,29 @@ ```js

## Why?
**Problem**
Let's say you want to return all of the `.js` files in a project, excluding `node_modules` and a few other similar directories. Normally you would need to do something like this:
```js
glob(['**/*.js', '!**/node_modules/**']);
```
The problem with this approach is that typically _even the excluded file paths are fully expanded before the result set is returned_. e.g. all of the files in `node_modules` would be scanned first.
**Solution**
Matched allows you to exlude directories before they reach [globby](https://github.com/sindresorhus/globby). In a nutshell, matched uses `fs.readdirSync` to build up a list of directories relative to the `cwd`, then for each (non-excluded) directory matched passes the glob pattern to globby. The following is all that's needed to return all of the `.js` files in a project.
```js
var matched = require('matched');
matched('**/*.js');
//=> ['index.js', 'test/test.js']
```
Try it, you'll be surprised how fast it is comparatively. However, I'm not sure how well this approach will scale with complicated patterns. See [the tests](./test/test.js) for the use cases that are covered so far. Feel free to create pull requests or issues if you have suggestions for improvement.
## Author
{%= contrib("jon") %}
{%= include("author") %}

@@ -98,0 +115,0 @@ ## License

{
"name": "matched",
"description": "Super fast globbing library.",
"version": "0.2.1",
"version": "0.2.2",
"homepage": "https://github.com/jonschlinkert/matched",

@@ -6,0 +6,0 @@ "author": {

@@ -5,2 +5,3 @@ # matched [![NPM version](https://badge.fury.io/js/matched.png)](http://badge.fury.io/js/matched)

#### [Why?](#why)

@@ -14,3 +15,2 @@ ## Install

## Usage

@@ -25,8 +25,2 @@

```js
var matched = require('matched');
matched('**/*.js');
//=> ['index.js', 'test/test.js']
```
## API

@@ -38,5 +32,4 @@

See supported [globby](https//github.com/sindresorhus/globby) options.
See supported [globby](https://github.com/sindresorhus/globby) options.
### patterns

@@ -62,3 +55,3 @@

Pass an array of additional directories to exlude:
Pass an array of additional directories to exclude:

@@ -97,9 +90,33 @@ ```js

## Why?
**Problem**
Let's say you want to return all of the `.js` files in a project, excluding `node_modules` and a few other similar directories. Normally you would need to do something like this:
```js
glob(['**/*.js', '!**/node_modules/**']);
```
The problem with this approach is that typically _even the excluded file paths are fully expanded before the result set is returned_. e.g. all of the files in `node_modules` would be scanned first.
**Solution**
Matched allows you to exlude directories before they reach [globby](https://github.com/sindresorhus/globby). In a nutshell, matched uses `fs.readdirSync` to build up a list of directories relative to the `cwd`, then for each (non-excluded) directory matched passes the glob pattern to globby. The following is all that's needed to return all of the `.js` files in a project.
```js
var matched = require('matched');
matched('**/*.js');
//=> ['index.js', 'test/test.js']
```
Try it, you'll be surprised how fast it is comparatively. However, I'm not sure how well this approach will scale with complicated patterns. See [the tests](./test/test.js) for the use cases that are covered so far. Feel free to create pull requests or issues if you have suggestions for improvement.
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

@@ -106,0 +123,0 @@ ## License

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