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
- Host: GitHub
- URL: https://github.com/ratson/gitignore-to-ast
- Owner: ratson
- Created: 2017-07-12T22:44:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-12T22:45:55.000Z (almost 9 years ago)
- Last Synced: 2024-05-01T22:19:51.057Z (about 2 years ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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,
},
],
}
```