Skip to content

Class: GitIgnore

Mutable path predicate composed from root and nested .gitignore files.

new GitIgnore(root): GitIgnore

string | URL

GitIgnore

readonly matcher: PathMatcher

Stable composable matcher that observes later set, delete, and clear calls.


readonly root: string

clear(): void

Remove every registered .gitignore.

void


delete(path): boolean

Remove one .gitignore file. Returns whether it was registered.

string

boolean


get(path): string | undefined

Return the retained content for a registered .gitignore.

string

string | undefined


ignores(path, directory?): boolean

Whether a path is ignored after applying parent then nested rule files.

string

boolean = false

boolean


set(path, content): void

Add or replace one .gitignore file and its in-memory content.

string

string

void


static isFile(path): boolean

Whether path names a .gitignore control file.

string

boolean


static load(root, options?): Promise<GitIgnore>

Load every applicable .gitignore beneath root.

string | URL

GitIgnoreLoadOptions = {}

Promise<GitIgnore>


static loadSync(root, options?): GitIgnore

Synchronous counterpart to GitIgnore.load.

string | URL

GitIgnoreLoadOptions = {}

GitIgnore