0.0.1 • Published 7 years ago

gitignore-to-ast v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

gitignore-to-ast

Parse .gitignore file to AST

Installation

npm install gitignore-to-ast --save

Usage

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,
    },
  ],
}