## Usage ```js const fs = require('fs'); const gitignore = require('{%= name %}'); // Pass a string, buffer, or file path to gitignore() const contents = fs.readFileSync('.gitignore'); const { patterns, sections } = gitignore(contents); ``` ## Example ```js const parsed = gitignore(` # Logs logs *.log # Runtime data pids *.pid *.pid.lock *.seed `); // // results in the following // { patterns: ['logs', '*.log', 'pids', '*.pid', '*.pid.lock', '*.seed'], sections: [ { name: 'Logs', value: '# Logs', patterns: [ 'logs', '*.log'] }, { name: 'Runtime data', value: '# Runtime data', patterns: [ 'pids', '*.pid', '*.pid.lock', '*.seed' ] } ] } ``` ## Release history ### v2.0 ### v1.0 **Heads up! Breaking changes!** Prior to v1.0, this library also attempted to convert the returned patterns into valid globs. As of v1.0, parse-gitignore was refactored and simplified down to less than ~50 sloc and no dependencies to provide a quick and easy way of getting the array of ignore patterns from a [.gitignore]() file. This allows you to do whatever you need to do with the patterns.