globby
Advanced tools
Comparing version 10.0.0 to 10.0.1
@@ -83,3 +83,7 @@ import {IOptions as NodeGlobOptions} from 'glob'; | ||
/** | ||
@param patterns - See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). | ||
Find files and directories using glob patterns. | ||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`. | ||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-1) in addition to the ones in this package. | ||
@@ -106,3 +110,7 @@ @returns The matching paths. | ||
/** | ||
@param patterns - See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). | ||
Find files and directories using glob patterns. | ||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`. | ||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-1) in addition to the ones in this package. | ||
@@ -117,3 +125,7 @@ @returns The matching paths. | ||
/** | ||
@param patterns - See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). | ||
Find files and directories using glob patterns. | ||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`. | ||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-1) in addition to the ones in this package. | ||
@@ -141,5 +153,5 @@ @returns The stream of matching paths. | ||
@param patterns - See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). | ||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-1) in addition to the ones in this package. | ||
@returns 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. | ||
*/ | ||
@@ -156,3 +168,3 @@ generateGlobTasks( | ||
@param patterns - See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). | ||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@param options - See the [`node-glob` options](https://github.com/isaacs/node-glob#globhasmagicpattern-options). | ||
@@ -159,0 +171,0 @@ @returns Whether there are any special glob characters in the `patterns`. |
15
index.js
@@ -21,4 +21,15 @@ 'use strict'; | ||
const checkCwdOption = options => { | ||
if (options && options.cwd && !fs.statSync(options.cwd).isDirectory()) { | ||
const checkCwdOption = (options = {}) => { | ||
if (!options.cwd) { | ||
return; | ||
} | ||
let stat; | ||
try { | ||
stat = fs.statSync(options.cwd); | ||
} catch (_) { | ||
return; | ||
} | ||
if (!stat.isDirectory()) { | ||
throw new Error('The `cwd` option must be a path to a directory'); | ||
@@ -25,0 +36,0 @@ } |
{ | ||
"name": "globby", | ||
"version": "10.0.0", | ||
"version": "10.0.1", | ||
"description": "Extends `glob` with support for multiple patterns and exposes a Promise API", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -46,2 +46,4 @@ # globby [![Build Status](https://travis-ci.org/sindresorhus/globby.svg?branch=master)](https://travis-ci.org/sindresorhus/globby) | ||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`. | ||
### globby(patterns, options?) | ||
@@ -48,0 +50,0 @@ |
21937
409
185