jonschlinkert/parse-gitignore

refactor

Opened this issue · 1 comments

refactor code to:

  • only parse .gitignore with the main export
  • expose a toGlob function for converting the parsed patterns to glob patterns

Hey @jonschlinkert what about a function that returns the patterns as useful RegExp for Node, what I'm trying now is

const filename = 'expedition.log'
const [logPattern] = ['*.log']

if (logPatter.test(filename)) {...}

evidently doesn't work because JSRegExp don't recognize * because

The preceding token is not quantifiable