.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / globby / readme.md
1 # globby [![Build Status](https://travis-ci.org/sindresorhus/globby.svg?branch=master)](https://travis-ci.org/sindresorhus/globby)
2
3 > Extends [glob](https://github.com/isaacs/node-glob) with support for multiple patterns and exposes a Promise API
4
5
6 ## Install
7
8 ```
9 $ npm install --save globby
10 ```
11
12
13 ## Usage
14
15 ```
16 ├── unicorn
17 ├── cake
18 └── rainbow
19 ```
20
21 ```js
22 const globby = require('globby');
23
24 globby(['*', '!cake']).then(paths => {
25         console.log(paths);
26         //=> ['unicorn', 'rainbow']
27 });
28 ```
29
30
31 ## API
32
33 ### globby(patterns, [options])
34
35 Returns a Promise for an array of matching paths.
36
37 ### globby.sync(patterns, [options])
38
39 Returns an array of matching paths.
40
41 ### globby.generateGlobTasks(patterns, [options])
42
43 Returns an array of objects in the format `{ pattern: string, opts: Object }`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages.
44
45 Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
46
47 ### globby.hasMagic(patterns, [options])
48
49 Returns a `boolean` of whether there are any special glob characters in the `patterns`.
50
51 Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, then that is considered magical, unless `nobrace: true` is set.
52
53 #### patterns
54
55 Type: `string` `Array`
56
57 See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).
58
59 #### options
60
61 Type: `Object`
62
63 See the `node-glob` [options](https://github.com/isaacs/node-glob#options).
64
65
66 ## Globbing patterns
67
68 Just a quick overview.
69
70 - `*` matches any number of characters, but not `/`
71 - `?` matches a single character, but not `/`
72 - `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
73 - `{}` allows for a comma-separated list of "or" expressions
74 - `!` at the beginning of a pattern will negate the match
75
76 [Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/master/test.js)
77
78
79 ## Related
80
81 - [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem
82 - [glob-stream](https://github.com/wearefractal/glob-stream) - Streaming alternative
83 - [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching
84
85
86 ## License
87
88 MIT © [Sindre Sorhus](https://sindresorhus.com)