| # editorconfig.org | ||
| root = true | ||
| [*] | ||
| indent_style = space | ||
| indent_size = 2 | ||
| end_of_line = lf | ||
| charset = utf-8 | ||
| trim_trailing_whitespace = false | ||
| insert_final_newline = true |
+28
-11
@@ -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 |
+1
-1
| { | ||
| "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": { |
+29
-12
@@ -5,2 +5,3 @@ # matched [](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 |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
15398
19.37%14
7.69%126
15.6%