Skip to content

Commit

Permalink
Add convertPathToPattern() method
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 9, 2023
1 parent 2c06ae5 commit 3bd00a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type FastGlob from 'fast-glob';
import {type Options as FastGlobOptions, type Entry} from 'fast-glob';

export type GlobEntry = Entry;
Expand Down Expand Up @@ -203,3 +204,5 @@ export function isGitIgnored(options?: GitignoreOptions): Promise<GlobbyFilterFu
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
*/
export function isGitIgnoredSync(options?: GitignoreOptions): GlobbyFilterFunction;

export function convertPathToPattern(source: string): FastGlob.Pattern;
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,5 @@ export {
isGitIgnored,
isGitIgnoredSync,
} from './ignore.js';

export const {convertPathToPattern} = fastGlob;
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ for await (const path of globbyStream('*.tmp')) {
}
```

### convertPathToPattern(path)

Convert a path to a pattern. [Learn more.](https://github.com/mrmlnc/fast-glob#convertpathtopatternpath)

### generateGlobTasks(patterns, options?)

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.
Expand Down

0 comments on commit 3bd00a6

Please sign in to comment.