From 2b6148457719800f72d8c387be01e0fadcf2730e Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 31 May 2019 19:15:14 +0700 Subject: [PATCH] Readme tweaks --- readme.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/readme.md b/readme.md index 8a98e74..46db037 100644 --- a/readme.md +++ b/readme.md @@ -43,28 +43,28 @@ const globby = require('globby'); ## API -### globby(patterns, [options]) +### globby(patterns, options?) -Returns a `Promise` of matching paths. +Returns a `Promise` 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`
+Type: `boolean | string[] | object`
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 () => { @@ -89,17 +89,17 @@ 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` 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`. @@ -107,7 +107,7 @@ Note that the options affect the results. If `noext: true` is set, then `+(a|b)` 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. @@ -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.