@radham/gitignore
v0.1.0
Published
A .gitignore parser library.
Maintainers
Readme
@radham/gitignore
A .gitignore parser library.
Install
npm install @radham/gitignoreUsage
Using the following .gitignore file as an example:
# The following are ignored.
node_modules/
.envIt can be parsed like so:
import fs from 'node:fs';
import parse from '@radham/gitignore';
// Without any arguments it auto-reads the `.gitignore` in the current working direcctory and
// outputs globs.
parse(); // > ['**/node_modules/', '**/.env']
// You can manually provide the `.gitignore` contents and specify a different output format.
const source = fs.readFileSync('.gitignore').toString();
parse(source, { output: 'patterns' }); // > ['node_modules/', '.env']License
The BSD 3-Clause License. See the license file for details.
