An open API service indexing awesome lists of open source software.

https://github.com/ratson/gitignore-to-ast

Parse .gitignore file to AST
https://github.com/ratson/gitignore-to-ast

Last synced: about 1 year ago
JSON representation

Parse .gitignore file to AST

Awesome Lists containing this project

README

          

# gitignore-to-ast

Parse .gitignore file to AST

## Installation

```
npm install gitignore-to-ast --save
```

## Usage

```js
const parseGitignore = require('gitignore-to-ast')
const parsed = parseGitignore('# comment\n*\r\n\n!.gitignore')
const result = {
type: 'root',
body: [
{
type: 'comment',
value: '# comment',
line: 1,
},
{
type: 'rule',
value: '*',
line: 2,
},
{
type: 'rule',
value: '!.gitignore',
line: 4,
},
],
}
```