All Projects → jonschlinkert → matched

jonschlinkert / matched

Licence: MIT license
Glob matching with support for multiple patterns and negation. Use `~` in cwd to find files in user home, or `@` for global npm modules.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to matched

Micromatch
Contributing Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Stars: ✭ 1,979 (+7816%)
Mutual labels:  glob, glob-pattern, glob-matching, wildcard, globby
bash-glob
Bash-powered globbing for node.js. Alternative to node-glob. Does not work on Windows 9 and lower.
Stars: ✭ 13 (-48%)
Mutual labels:  files, pattern, fs, glob, file-system
glob-fs
file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
Stars: ✭ 54 (+116%)
Mutual labels:  files, fs, glob, glob-pattern
to-absolute-glob
Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.
Stars: ✭ 16 (-36%)
Mutual labels:  pattern, glob, glob-pattern
dots
Implements the wildcard file matching in Go used by golint, go test etc.
Stars: ✭ 26 (+4%)
Mutual labels:  glob, glob-pattern, wildcard
glob-tool
A tool to test globs against sets of test strings quickly and easily for the DigitalOcean Community.
Stars: ✭ 14 (-44%)
Mutual labels:  glob, glob-pattern, glob-matching
Fast Glob
🚀 It's a very fast and efficient glob library for Node.js
Stars: ✭ 1,150 (+4500%)
Mutual labels:  fs, glob, find
glob
Pure Nim library for matching file paths against Unix style glob patterns.
Stars: ✭ 58 (+132%)
Mutual labels:  pattern, glob, glob-matching
globrex
Glob to regular expression with support for extended globs.
Stars: ✭ 52 (+108%)
Mutual labels:  pattern, glob, wildcard
Xcv
✂️ Cut, Copy and Paste files with Bash
Stars: ✭ 144 (+476%)
Mutual labels:  files, glob
go-storage
A vendor-neutral storage library for Golang: Write once, run on every storage service.
Stars: ✭ 387 (+1448%)
Mutual labels:  files, fs
copy
Copy files using glob patterns. Sync, async, promise or streams. (node.js utility)
Stars: ✭ 84 (+236%)
Mutual labels:  files, fs
Globbing
Introduction to "globbing" or glob matching, a programming concept that allows "filepath expansion" and matching using wildcards.
Stars: ✭ 86 (+244%)
Mutual labels:  pattern, glob
Nanomatch
Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but without support for extended globs (extglobs), posix brackets or braces, and with complete Bash 4.3 wildcard support: ("*", "**", and "?").
Stars: ✭ 79 (+216%)
Mutual labels:  pattern, glob
Glob
Go glob
Stars: ✭ 670 (+2580%)
Mutual labels:  pattern, glob
extglob
Extended globs. Add (almost) the expressive power of regular expressions to glob patterns.
Stars: ✭ 25 (+0%)
Mutual labels:  pattern, glob
delete-empty
Recursively delete all empty folders in a directory and child directories.
Stars: ✭ 38 (+52%)
Mutual labels:  files, glob
Globby
User-friendly glob matching
Stars: ✭ 1,864 (+7356%)
Mutual labels:  files, glob
Musoq
Use SQL on various data sources
Stars: ✭ 252 (+908%)
Mutual labels:  files, find
Temperment
Get a random temporary file or directory path that will delete itself
Stars: ✭ 21 (-16%)
Mutual labels:  files, fs

matched Donate NPM version NPM monthly downloads NPM total downloads Build Status

Adds array support to node-glob, sync and async. Also supports tilde expansion (user home) and resolving to global npm modules.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.

Install

Install with npm (requires Node.js >=10):

$ npm install --save matched

Usage

const glob = require('matched');
// async signature
glob(patterns[, options]);

// sync signature
glob.sync(patterns[, options]);
  • patterns (string|array) - one or more glob patterns
  • options - options to pass to node-glob;

Also note that if non-glob file paths are passed, only paths that exist on the file system will be returned.

promise

glob(['*.txt'])
  .then(files => console.log(files)) //=> ['a.txt', 'b.txt', 'c.txt']
  .catch(console.error)

// or with async-await
(async() => {
  const files = await glob('*.txt');
  console.log(files);
  //=> ['foo.txt', 'bar.txt']
})();

callback

glob(['*.js'], (err, files) => {
  console.log(files);
  //=> ['utils.js', 'index.js']
});

sync

const files = glob.sync(['*.js']);
//=> ['utils.js', 'index.js']

options

All methods take an options object to be forwarded to node-glob as the second argument.

const files = glob(['*.js'], { cwd: 'test' });
console.log(files);
//=> ['test.js']

v4.1

  • Adds support for options.onMatch() which is passed to node-glob as a listener for the match event.
  • Adds support for options.onFiles() to allow the user to get the files returned by each glob pattern.
  • Small optimizations in logic for handling non-glob patterns that are passed for matching literal file names.

v4.0

v3.0

  • Removes cache property from results array.
  • Optimizations

v0.4.1

  • Exposes a non-enumerable cache property on the returned files array. This is a patch release since the property does not change the existing API and should not otherwise effect behavior or results.

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

  • findup-sync: Find the first file matching a given pattern in the current directory or the nearest… more | homepage
  • is-glob: Returns true if the given string looks like a glob pattern or an extglob pattern… more | homepage
  • micromatch: Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch. | homepage

Contributors

Commits Contributor
73 jonschlinkert
8 TrySound
1 sindresorhus

Author

Jon Schlinkert

License

Copyright © 2020, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.8.0, on January 15, 2020.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].