Skip to content

Commit

Permalink
Readme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 31, 2019
1 parent ff3e1f9 commit 2b61484
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@ const globby = require('globby');

## API

### globby(patterns, [options])
### globby(patterns, options?)

Returns a `Promise<Array>` of matching paths.
Returns a `Promise<string[]>` of matching paths.

#### patterns

Type: `string` `Array`
Type: `string | string[]`

See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).

#### options

Type: `Object`
Type: `object`

See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-1) in addition to the ones below.

##### expandDirectories

Type: `boolean` `Array` `Object`<br>
Type: `boolean | string[] | object`<br>
Default: `true`

If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like below:
If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `object` with `files` and `extensions` like below:

```js
(async () => {
Expand All @@ -89,25 +89,25 @@ Default: `false`

Respect ignore patterns in `.gitignore` files that apply to the globbed files.

### globby.sync(patterns, [options])
### globby.sync(patterns, options?)

Returns an `Array` of matching paths.
Returns `string[]` of matching paths.

### globby.generateGlobTasks(patterns, [options])
### globby.generateGlobTasks(patterns, options?)

Returns an `Array<Object>` in the format `{pattern: string, options: Object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
Returns an `object[]` in the format `{pattern: string, options: Object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.

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.

### globby.hasMagic(patterns, [options])
### globby.hasMagic(patterns, options?)

Returns a `boolean` of whether there are any special glob characters in the `patterns`.

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.

This function is backed by [`node-glob`](https://github.com/isaacs/node-glob#globhasmagicpattern-options)

### globby.gitignore([options])
### globby.gitignore(options?)

Returns a `Promise<(path: string) => boolean>` indicating whether a given path is ignored via a `.gitignore` file.

Expand All @@ -123,7 +123,7 @@ const {gitignore} = require('globby');
})();
```

### globby.gitignore.sync([options])
### globby.gitignore.sync(options?)

Returns a `(path: string) => boolean` indicating whether a given path is ignored via a `.gitignore` file.

Expand Down

0 comments on commit 2b61484

Please sign in to comment.