parse-gitignore
Parse a gitignore file into an array of patterns. Comments and empty lines are stripped.
Install with npm
npm i parse-gitignore --save
Usage
var gitignore = require('parse-gitignore');
var str = fs.readFileSync('.gitignore', 'utf8');
gitignore(str);
Pass additional patterns
Since the function already does unique-ifying, you can optionally pass an array of patterns to combine additional patterns to whatever is in .gitignore
and get an array of unique patterns:
gitignore(str, ['foo', 'bar']);
Run tests
Install dev dependencies:
npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on February 27, 2015.