Skip to content

Commit 3bd00a6

Browse files
committedNov 9, 2023
Add convertPathToPattern() method
1 parent 2c06ae5 commit 3bd00a6

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
 

‎index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type FastGlob from 'fast-glob';
12
import {type Options as FastGlobOptions, type Entry} from 'fast-glob';
23

34
export type GlobEntry = Entry;
@@ -203,3 +204,5 @@ export function isGitIgnored(options?: GitignoreOptions): Promise<GlobbyFilterFu
203204
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
204205
*/
205206
export function isGitIgnoredSync(options?: GitignoreOptions): GlobbyFilterFunction;
207+
208+
export function convertPathToPattern(source: string): FastGlob.Pattern;

‎index.js

+2
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,5 @@ export {
260260
isGitIgnored,
261261
isGitIgnoredSync,
262262
} from './ignore.js';
263+
264+
export const {convertPathToPattern} = fastGlob;

‎readme.md

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ for await (const path of globbyStream('*.tmp')) {
113113
}
114114
```
115115

116+
### convertPathToPattern(path)
117+
118+
Convert a path to a pattern. [Learn more.](https://github.com/mrmlnc/fast-glob#convertpathtopatternpath)
119+
116120
### generateGlobTasks(patterns, options?)
117121

118122
Returns an `Promise<object[]>` in the format `{patterns: 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.

0 commit comments

Comments
 (0)
Please sign in to comment.